mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 20:02:05 +08:00
Merge pull request #21219 from aleung/cassandra
cassandra-driver: give sslOptions a type
This commit is contained in:
@@ -1,9 +1,16 @@
|
||||
import * as cassandra from 'cassandra-driver';
|
||||
import * as util from 'util';
|
||||
import * as fs from 'fs';
|
||||
|
||||
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
|
||||
const client = new cassandra.Client({
|
||||
contactPoints: ['h1', 'h2'],
|
||||
keyspace: 'ks1',
|
||||
sslOptions: {
|
||||
cert: fs.readFileSync('certFilePath')
|
||||
}
|
||||
});
|
||||
|
||||
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
|
||||
const 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);
|
||||
});
|
||||
|
||||
67
types/cassandra-driver/index.d.ts
vendored
67
types/cassandra-driver/index.d.ts
vendored
@@ -12,11 +12,12 @@ export type ResultCallback = (err: Error, result: types.ResultSet) => void;
|
||||
|
||||
import * as events from "events";
|
||||
import * as stream from "stream";
|
||||
import * as tls from "tls";
|
||||
import _Long = require("long");
|
||||
|
||||
export namespace policies {
|
||||
namespace addressResolution {
|
||||
var EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
|
||||
let EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
|
||||
|
||||
interface AddressTranslator {
|
||||
translate(address: string, port: number, callback: Callback): void;
|
||||
@@ -32,10 +33,10 @@ export namespace policies {
|
||||
}
|
||||
|
||||
namespace loadBalancing {
|
||||
var DCAwareRoundRobinPolicy: DCAwareRoundRobinPolicyStatic;
|
||||
var RoundRobinPolicy: RoundRobinPolicyStatic;
|
||||
var TokenAwarePolicy: TokenAwarePolicyStatic;
|
||||
var WhiteListPolicy: WhiteListPolicyStatic;
|
||||
let DCAwareRoundRobinPolicy: DCAwareRoundRobinPolicyStatic;
|
||||
let RoundRobinPolicy: RoundRobinPolicyStatic;
|
||||
let TokenAwarePolicy: TokenAwarePolicyStatic;
|
||||
let WhiteListPolicy: WhiteListPolicyStatic;
|
||||
|
||||
interface LoadBalancingPolicy {
|
||||
init(client: Client, hosts: HostMap, callback: Callback): void;
|
||||
@@ -72,8 +73,8 @@ export namespace policies {
|
||||
}
|
||||
|
||||
namespace reconnection {
|
||||
var ConstantReconnectionPolicy: ConstantReconnectionPolicyStatic;
|
||||
var ExponentialReconnectionPolicy: ExponentialReconnectionPolicyStatic;
|
||||
let ConstantReconnectionPolicy: ConstantReconnectionPolicyStatic;
|
||||
let ExponentialReconnectionPolicy: ExponentialReconnectionPolicyStatic;
|
||||
|
||||
interface ReconnectionPolicy {
|
||||
newSchedule(): { next: Function };
|
||||
@@ -93,7 +94,7 @@ export namespace policies {
|
||||
}
|
||||
|
||||
namespace retry {
|
||||
var RetryPolicy: RetryPolicyStatic;
|
||||
let RetryPolicy: RetryPolicyStatic;
|
||||
|
||||
interface DecisionInfo {
|
||||
decision: number;
|
||||
@@ -128,18 +129,18 @@ export namespace policies {
|
||||
}
|
||||
|
||||
export namespace types {
|
||||
var BigDecimal: BigDecimalStatic;
|
||||
var InetAddress: InetAddressStatic;
|
||||
var Integer: IntegerStatic;
|
||||
var LocalDate: LocalDateStatic;
|
||||
var LocalTime: LocalTimeStatic;
|
||||
var Long: _Long;
|
||||
var ResultSet: ResultSetStatic;
|
||||
// var ResultStream: ResultStreamStatic;
|
||||
var Row: RowStatic;
|
||||
var TimeUuid: TimeUuidStatic;
|
||||
var Tuple: TupleStatic;
|
||||
var Uuid: UuidStatic;
|
||||
let BigDecimal: BigDecimalStatic;
|
||||
let InetAddress: InetAddressStatic;
|
||||
let Integer: IntegerStatic;
|
||||
let LocalDate: LocalDateStatic;
|
||||
let LocalTime: LocalTimeStatic;
|
||||
let Long: _Long;
|
||||
let ResultSet: ResultSetStatic;
|
||||
// let ResultStream: ResultStreamStatic;
|
||||
let Row: RowStatic;
|
||||
let TimeUuid: TimeUuidStatic;
|
||||
let Tuple: TupleStatic;
|
||||
let Uuid: UuidStatic;
|
||||
|
||||
enum consistencies {
|
||||
any = 0,
|
||||
@@ -433,10 +434,10 @@ export namespace types {
|
||||
}
|
||||
}
|
||||
|
||||
export var Client: ClientStatic;
|
||||
export var Host: HostStatic;
|
||||
export var HostMap: HostMapStatic;
|
||||
export var Encoder: EncoderStatic;
|
||||
export let Client: ClientStatic;
|
||||
export let Host: HostStatic;
|
||||
export let HostMap: HostMapStatic;
|
||||
export let Encoder: EncoderStatic;
|
||||
|
||||
export interface ClientOptions {
|
||||
contactPoints: Array<string>,
|
||||
@@ -468,7 +469,7 @@ export interface ClientOptions {
|
||||
coalescingThreshold: number
|
||||
},
|
||||
authProvider?: auth.AuthProvider,
|
||||
sslOptions?: any,
|
||||
sslOptions?: tls.ConnectionOptions,
|
||||
encoding?: {
|
||||
map: Function,
|
||||
set: Function,
|
||||
@@ -564,8 +565,8 @@ export interface Encoder {
|
||||
}
|
||||
|
||||
export namespace auth {
|
||||
var Authenticator: AuthenticatorStatic;
|
||||
var PlainTextAuthProvider: PlainTextAuthProviderStatic;
|
||||
let Authenticator: AuthenticatorStatic;
|
||||
let PlainTextAuthProvider: PlainTextAuthProviderStatic;
|
||||
|
||||
interface AuthenticatorStatic {
|
||||
new (): Authenticator;
|
||||
@@ -623,12 +624,12 @@ export namespace errors {
|
||||
}
|
||||
|
||||
export namespace metadata {
|
||||
var Aggregate: AggregateStatic;
|
||||
var Index: IndexStatic;
|
||||
var MaterializedView: MaterializedViewStatic;
|
||||
var Metadata: MetadataStatic;
|
||||
var SchemaFunction: SchemaFunctionStatic;
|
||||
var TableMetadata: TableMetadataStatic;
|
||||
let Aggregate: AggregateStatic;
|
||||
let Index: IndexStatic;
|
||||
let MaterializedView: MaterializedViewStatic;
|
||||
let Metadata: MetadataStatic;
|
||||
let SchemaFunction: SchemaFunctionStatic;
|
||||
let TableMetadata: TableMetadataStatic;
|
||||
|
||||
type caching = "all" | "keys_only" | "rows_only" | "none";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user