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


TypeScript Client.execute方法代码示例

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

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

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


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