本文整理汇总了TypeScript中cassandra-driver.Client.execute方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Client.execute方法的具体用法?TypeScript Client.execute怎么用?TypeScript Client.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cassandra-driver.Client
的用法示例。
在下文中一共展示了Client.execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: CustomRequestLogger
},
encoding: {
map: Map,
set: Set,
useBigIntAsLong: false,
useBigIntAsVarint: true
},
requestTracker: new cassandra.tracker.RequestLogger({ logNormalRequests: true }),
metrics: new CustomRequestLogger()
});
console.log(client.metrics);
const query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
client.execute(query, ['guy'], (err, result) => {
console.log('got user profile with email ' + result.rows[0].email);
});
client.execute(query, [ 'guy' ], { prepare: true, counter: false }).then(
(result) => console.log(result.first().email),
(error) => console.log(error)
);
const mapper = new cassandra.mapping.Mapper(
client,
{
models: {
// example copied from library examples
// tslint:disable-next-line:object-literal-key-quotes
'Video': {
tables: [ 'videos', 'user_videos', 'latest_videos' ],
示例2: function
/// <reference types="cassandra-driver" />
import * as cassandra from 'cassandra-driver';
import * as util from 'util';
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
client.execute(query, ['guy'], function(err: any, result: any) {
console.log('got user profile with email ' + result.rows[0].email);
});
示例3: function
import * as cassandra from 'cassandra-driver';
import * as util from 'util';
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
client.execute(query, ['guy'], function(err, result) {
console.log('got user profile with email ' + result.rows[0].email);
});
client.execute(query, [ 'guy' ], { prepare: true }).then(
(result) => console.log(result.first().email),
(error) => console.log(error)
);
示例4: function
/// <reference types="cassandra-driver" />
import * as cassandra from 'cassandra-driver';
import * as util from 'util';
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
client.execute(query, ['guy'], {}, function(err, result) {
console.log('got user profile with email ' + result.rows[0].get("email"));
});