本文整理汇总了TypeScript中rethinkdb.row函数的典型用法代码示例。如果您正苦于以下问题:TypeScript row函数的具体用法?TypeScript row怎么用?TypeScript row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了row函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
r.connect({ host: "localhost", port: 28015 }, function(err: Error, conn: r.Connection) {
console.log("HI", err, conn);
conn.server((err, server) => {});
const testDb = r.db("test");
r.table("players").hasFields("games_won").run(conn, errorAndCursorCallback);
r.table("players").hasFields({ "games_won": { "championships": true } }).run(conn, errorAndCursorCallback);
r.table("players").filter(r.row.hasFields("games_won").not()).run(conn, errorAndCursorCallback);
r.table("players").filter(r.row.hasFields({ "games_won": { "championships": true } }).not()).run(conn, errorAndCursorCallback);
r.table("players").filter(
r.row.hasFields("games_won").not()
.or(r.row("games_won").not().eq(true))
.and(true)
)
.run(conn, errorAndCursorCallback);
const center = r.point(123, 456);
r.table("geo")
.getIntersecting(r.circle(center, 1000, { unit: "m" }), { index: "location" })
.orderBy(r.row("location").distance(center, { unit: "m" }))
.eqJoin("external", testDb.table("other"), { index: "external" })
.getField("right")
.run(conn, errorAndCursorCallback);
testDb.tableCreate("users").run(conn, function(err, stuff) {
const users = testDb.table("users");
users.wait({waitFor: 'ready_for_reads'});
users.insert({ name: "bob" }).run(conn, function() {
});
users.hasFields("foo_bar").run(conn, () => {});
users.filter(function(doc?) {
return doc("henry").eq("bob");
})
.filter(r.row("updatedAt").default(0).lt(r.now().sub(1000)))
.between("james", "beth")
.limit(4)
.run(conn, function(err, cursor) {
cursor.toArray<string>((err, strings) => {
console.log(strings);
});
});
});
testDb.table("users").indexCreate("name_index", [r.row("name")]);
r.js("'str1' + 'str2'").run(conn, function (err, value) {});
r.uuid().run(conn, function (err, uuid) {});
r.uuid("input value").run(conn, function (err, uuid) {});
r.table("games").changes().run(conn, function(err, cursor) {
cursor.each(console.log);
});
});
示例2: function
routerAuthenticated.post('/enter/:barId/:userId', async function () {
if (this.request.body.title && this.request.body.artist) {
var conn = await r.connect(AppConfig.dbConfig);
var currentTrack = {
artist: this.request.body.artist,
title: this.request.body.title,
location: this.params.barId,
album: this.request.body.album ? this.request.body.album : '',
begin: r.now(),
};
await r.table('locations').get(this.params.barId).update({ lastTrack: currentTrack }).run(conn);
await r.table('users')
.get(this.params.userId)
.update({
tagCounter: r.row('tagCounter').add(1).default(0),
firstTagCounter: r.row('firstTagCounter').add(1).default(0)
}).run(conn)
this.body = await r.table("tracks").insert(currentTrack).run(conn);
conn.close();
} else {
this.body = {};
}
});
示例3: function
r.connect({ host: "localhost", port: 28015 }, function(err: Error, conn: r.Connection) {
console.log("HI", err, conn);
const testDb = r.db("test");
r.table("players").hasFields("games_won").run(conn, errorAndCursorCallback);
r.table("players").hasFields({ "games_won": { "championships": true } }).run(conn, errorAndCursorCallback);
r.table("players").filter(r.row.hasFields("games_won").not()).run(conn, errorAndCursorCallback);
r.table("players").filter(r.row.hasFields({ "games_won": { "championships": true } }).not()).run(conn, errorAndCursorCallback);
r.table("players").filter(
r.row.hasFields("games_won").not()
.or(r.row("games_won").not().eq(true))
.and(true)
)
.run(conn, errorAndCursorCallback);
testDb.tableCreate("users").run(conn, function(err, stuff) {
const users = testDb.table("users");
users.insert({ name: "bob" }).run(conn, function() {
});
users.hasFields("foo_bar").run(conn, () => {});
users.filter(function(doc?) {
return doc("henry").eq("bob");
})
.filter(r.row("updatedAt").default(0).lt(r.now().sub(1000)))
.between("james", "beth")
.limit(4)
.run(conn, function(err, cursor) {
cursor.toArray<string>((err, strings) => {
console.log(strings);
});
});
});
r.js("'str1' + 'str2'").run(conn, function (err, value) {});
r.uuid().run(conn, function (err, uuid) {});
r.uuid("input value").run(conn, function (err, uuid) {});
r.table("games").changes().run(conn, function(err, cursor) {
cursor.each(console.log);
});
});