当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript cassandra-driver.Client类代码示例

本文整理汇总了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);
});
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:31,代码来源:cassandra-driver-tests.ts

示例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)
);
开发者ID:ChanceM,项目名称:DefinitelyTyped,代码行数:14,代码来源:cassandra-driver-tests.ts

示例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);
});
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:11,代码来源:cassandra-driver-tests.ts

示例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"));
});
开发者ID:rchaser53,项目名称:DefinitelyTyped,代码行数:11,代码来源:cassandra-driver.tests.ts

示例5:

  return Rx.Observable.create(observer => {

    client.connect(function (err) {
      if (err) {
        observer.error(err);
      }
      observer.next();
      observer.complete();
    });

  });
开发者ID:projectSHAI,项目名称:expressgular2,代码行数:11,代码来源:index.ts

示例6: cassandraDisconnect

export function cassandraDisconnect() {
  client.shutdown(() => {
    console.log('Cassandra DB is now shutdown.');
  });
};
开发者ID:projectSHAI,项目名称:expressgular2,代码行数:5,代码来源:index.ts


注:本文中的cassandra-driver.Client类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。