本文整理汇总了TypeScript中cassandra-driver.Client类的典型用法代码示例。如果您正苦于以下问题:TypeScript Client类的具体用法?TypeScript Client怎么用?TypeScript Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: onWriteTimeoutError
onWriteTimeoutError(e: cassandra.errors.ResponseError): void {
throw new Error("Method not implemented.");
}
onWriteTimeoutRetry(e: Error): void {
throw new Error("Method not implemented.");
}
}
const client = new cassandra.Client({
contactPoints: ['h1', 'h2'],
localDataCenter: 'datacenter1',
keyspace: 'ks1',
sslOptions: {
cert: fs.readFileSync('certFilePath')
},
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);
});
示例2: 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)
);
示例3: 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);
});
示例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"));
});
示例5:
return Rx.Observable.create(observer => {
client.connect(function (err) {
if (err) {
observer.error(err);
}
observer.next();
observer.complete();
});
});
示例6: cassandraDisconnect
export function cassandraDisconnect() {
client.shutdown(() => {
console.log('Cassandra DB is now shutdown.');
});
};