我有这个模块,
// data.js
(async data => {
const r = require('rethinkdb');
const [err, conn] = await r.connect();
console.log(conn, err);
const pluck = async (selectors, table) => await r.table(table).pluck(selectors).run(conn);
const without = async (selectors, table) => await r.table(table).without(selectors).run(conn);
const filter = async (selectors, table) => await r.table(table).filter(selectors).run(conn);
const get = async (id, table) => await r.table(table).get(id).run(conn);
const insert = async (doc, table) => await r.table(table).insert(doc).run(conn);
const update = async (id, doc, table) => await r.table(table).get(id).insert(doc).run(conn);
const remove = async (id, doc, table) => await r.table(table).get(id).delete(doc).run(conn);
const sample = async (num, table) => await r.table(table).sample(num).run(conn);
data.exports = {
pluck,
without,
filter,
get,
insert,
update,
remove,
sample,
};
})(module).catch(console.log); // Line 26
每当我运行它时,我都会收到此错误:
TypeError: undefined is not a function
at __dirname (D:\Dropbox\Development\nodejs\statoshiluck.io\lib\data.js:26:1)
at <anonymous>
我根本无法弄清楚要做什么,我用google搜索和google搜索,stackoverflowed和stackoverflowed。请发送帮助!