re-emable most dts-lint errors

This commit is contained in:
Dan Chao
2018-12-02 13:04:25 -08:00
parent 51f148ad83
commit 4ec7a6b59b
2 changed files with 92 additions and 99 deletions

View File

@@ -11,7 +11,7 @@ import { Client, ClientOptions, types, ResultCallback } from "cassandra-driver";
import * as Long from "long";
import { Readable } from "stream";
declare function CassanKnex (options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex;
declare function CassanKnex(options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex;
export = CassanKnex;
@@ -49,134 +49,134 @@ declare namespace CassanKnex {
}
interface QueryBuilderRoot {
insert <T = any> (values: Partial<T> | T): InsertQueryBuilder<T>;
select <T = any> (...columns: Array<keyof T>): SelectQueryBuilder<T>;
select <T = any> (values: SelectAsClause<T>): SelectQueryBuilder<T>;
update <T = any> (table: string): UpdateQueryBuilder<T>;
delete <T = any> (): DeleteQueryBuilder<T>;
alterColumnFamily <T = any> (columnFamily: string): AlterColumnFamilyQueryBuilder<T>;
createColumnFamily <T = any> (columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createColumnFamilyIfNotExists <T = any> (columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createIndex <T = any> (columnFamily: string, indexName: string, column: keyof T): QueryBuilder;
createIndexCustom <T = any> (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder;
createType <T = any> (typeName: string): CreateTypeQueryBuilder<T>;
createTypeIfNotExists <T = any> (typeName: string): CreateTypeQueryBuilder<T>;
dropColumnFamily (columnFamily: string): QueryBuilder;
dropColumnFamilyIfExists (columnFamily: string): QueryBuilder;
dropType (): QueryBuilder;
dropTypeIfExists (): QueryBuilder;
truncate (columnFamily: string): QueryBuilder;
alterKeyspace (keyspace: string): KeyspaceQueryBuilder;
createKeyspace (keyspace: string): KeyspaceQueryBuilder;
createKeyspaceIfNotExists (keyspace: string): KeyspaceQueryBuilder;
dropKeyspace (): QueryBuilder;
dropKeyspaceIfExists (): QueryBuilder;
insert <T = any>(values: Partial<T> | T): InsertQueryBuilder;
select <T = any>(...columns: Array<keyof T>): SelectQueryBuilder<T>;
select <T = any>(values: SelectAsClause<T>): SelectQueryBuilder<T>;
update <T = any>(table: string): UpdateQueryBuilder<T>;
delete <T = any>(): DeleteQueryBuilder<T>;
alterColumnFamily <T = any>(columnFamily: string): AlterColumnFamilyQueryBuilder<T>;
createColumnFamily <T = any>(columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createColumnFamilyIfNotExists <T = any>(columnFamily: string): CreateColumnFamilyQueryBuilder<T>;
createIndex <T = any>(columnFamily: string, indexName: string, column: keyof T): QueryBuilder;
createIndexCustom <T = any>(columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder;
createType <T = any>(typeName: string): CreateTypeQueryBuilder<T>;
createTypeIfNotExists <T = any>(typeName: string): CreateTypeQueryBuilder<T>;
dropColumnFamily(columnFamily: string): QueryBuilder;
dropColumnFamilyIfExists(columnFamily: string): QueryBuilder;
dropType(): QueryBuilder;
dropTypeIfExists(): QueryBuilder;
truncate(columnFamily: string): QueryBuilder;
alterKeyspace(keyspace: string): KeyspaceQueryBuilder;
createKeyspace(keyspace: string): KeyspaceQueryBuilder;
createKeyspaceIfNotExists(keyspace: string): KeyspaceQueryBuilder;
dropKeyspace(): QueryBuilder;
dropKeyspaceIfExists(): QueryBuilder;
}
interface QueryBuilder {
cql (): string;
bindings (): any[];
exec (cb: ResultCallback): undefined;
eachRow (onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined;
stream (params: StreamParams): undefined;
cql(): string;
bindings(): any[];
exec(cb: ResultCallback): undefined;
eachRow(onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined;
stream(params: StreamParams): undefined;
}
interface FieldValueQueryBuilder<T> {
decimal <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, types.BigDecimal, this>;
boolean <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, boolean, this>;
blob <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, Buffer, this>;
timestamp <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, Date, this>;
date <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, types.LocalDate, this>;
inet <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, types.InetAddress, this>;
bigint <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, Long, this>;
counter <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, Long, this>;
double <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, Long, this>;
int <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, number, this>;
float <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, number, this>;
map <K extends keyof T, A extends string, B> (columnName: K, a: A, b: B): TypeMatchedValue<T, K, Map<A, B>, this>;
ascii <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, string, this>;
text <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, string, this>;
timeuuid <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, types.TimeUuid, this>;
uuid <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, types.Uuid, this>;
varchar <K extends keyof T> (columnName: K): TypeMatchedValue<T, K, string, this>;
list <K extends keyof T> (columnName: K, typeName: string): TypeMatchedValue<T, K, any[], this>;
primary (primaryKey: string): this;
set <K extends keyof T, A extends string> (columnName: K, a: A): TypeMatchedValue<T, K, Set<T[K]>, this>;
decimal <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.BigDecimal, this>;
boolean <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, boolean, this>;
blob <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Buffer, this>;
timestamp <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Date, this>;
date <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.LocalDate, this>;
inet <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.InetAddress, this>;
bigint <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
counter <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
double <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, Long, this>;
int <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, number, this>;
float <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, number, this>;
map <K extends keyof T, A extends string, B>(columnName: K, a: A, b: B): TypeMatchedValue<T, K, Map<A, B>, this>;
ascii <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
text <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
timeuuid <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.TimeUuid, this>;
uuid <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, types.Uuid, this>;
varchar <K extends keyof T>(columnName: K): TypeMatchedValue<T, K, string, this>;
list <K extends keyof T>(columnName: K, typeName: string): TypeMatchedValue<T, K, any[], this>;
primary(primaryKey: string): this;
set <K extends keyof T, A extends string>(columnName: K, a: A): TypeMatchedValue<T, K, Set<T[K]>, this>;
}
interface CreateableColumnFamilyBuilder<T> {
withCaching (): this;
withCompression (): this;
withCompaction (): this;
withClusteringOrderBy <K extends keyof T> (value: K, direction: 'desc' | 'asc'): this;
withCaching(): this;
withCompression(): this;
withCompaction(): this;
withClusteringOrderBy <K extends keyof T>(value: K, direction: 'desc' | 'asc'): this;
}
interface CreateableIndexBuilder {
withOptions (opts: MappedDict<string>): this;
withOptions(opts: MappedDict<string>): this;
}
interface KeyspaceableQueryBuilder {
withNetworkTopologyStrategy (strategy: MappedDict<number>): this;
withSimpleStrategy (replicas: number): this;
withDurableWrites (durableWrites: boolean): this;
withNetworkTopologyStrategy(strategy: MappedDict<number>): this;
withSimpleStrategy(replicas: number): this;
withDurableWrites(durableWrites: boolean): this;
}
interface InsertableQueryBuilder {
into (table: string): this;
ifNotExists (): this;
into(table: string): this;
ifNotExists(): this;
}
interface TtlableQueryBuilder {
usingTimestamp (timestamp: number): this;
usingTTL (ttl: number): this;
usingTimestamp(timestamp: number): this;
usingTTL(ttl: number): this;
}
interface WhereableQueryBuilder<T> {
where <K extends keyof T> (lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
where <K extends keyof T> (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
orWhere <K extends keyof T> (lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
orWhere <K extends keyof T> (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
andWhere <K extends keyof T> (lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
andWhere <K extends keyof T> (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
tokenWhere <K extends keyof T> (lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
tokenWhere <K extends keyof T> (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
ttl <K extends keyof T> (columnName: K): this;
where <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
where <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
orWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
orWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
andWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
andWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
tokenWhere <K extends keyof T>(lhs: K, comparison: InRestriction, rhs: Array<T[K]>): this;
tokenWhere <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this;
ttl <K extends keyof T>(columnName: K): this;
}
interface IfableQueryBuilder<T> {
if <K extends keyof T> (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this;
if <K extends keyof T>(lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this;
}
interface LimitableQueryBuilder {
limit (limit: number): this;
limitPerPartition (limit: number): this;
limit(limit: number): this;
limitPerPartition(limit: number): this;
}
interface FromableQueryBuilder {
from (table: string): this;
from(table: string): this;
}
interface UpdateableQueryBuilder<T> {
set <K extends keyof T> (key: K, value: T[K]): this;
set (object: Partial<T>): this;
add <K extends keyof T> (key: K, value: { [str: string]: T[K] }): TypeMatchedValue<T, K, Map<string, T[K]>, this>;
add <K extends keyof T> (key: K, value: Array<T[K]>): TypeMatchedValue<T, K, any[] | Set<any>, this>;
add (object: Partial<T>): this;
remove <K extends keyof T> (key: K, value: Array<T[K]>): this;
remove (object: Partial<T>): this;
increment (column: keyof T, amount: number): this;
increment (object: Partial<T>): this;
decrement (column: keyof T, amount: number): this;
decrement (object: Partial<T>): this;
set <K extends keyof T>(key: K, value: T[K]): this;
set(object: Partial<T>): this;
add <K extends keyof T>(key: K, value: { [str: string]: T[K] }): TypeMatchedValue<T, K, Map<string, T[K]>, this>;
add <K extends keyof T>(key: K, value: Array<T[K]>): TypeMatchedValue<T, K, any[] | Set<any>, this>;
add(object: Partial<T>): this;
remove <K extends keyof T>(key: K, value: Array<T[K]>): this;
remove(object: Partial<T>): this;
increment(column: keyof T, amount: number): this;
increment(object: Partial<T>): this;
decrement(column: keyof T, amount: number): this;
decrement(object: Partial<T>): this;
}
interface AlterableQueryBuilder<T> {
drop <K extends keyof T> (...columns: K[]): this;
rename <K extends keyof T> (column: K, newColumn: K): this;
alter <K extends keyof T> (column: K, newType: string): this;
drop <K extends keyof T>(...columns: K[]): this;
rename <K extends keyof T>(column: K, newColumn: K): this;
alter <K extends keyof T>(column: K, newType: string): this;
}
type InsertQueryBuilder<T> = QueryBuilder
type InsertQueryBuilder = QueryBuilder
& InsertableQueryBuilder
& TtlableQueryBuilder;
type SelectQueryBuilder<T> = QueryBuilder

View File

@@ -1,14 +1,7 @@
{
"extends": "dtslint/dt.json",
"rules": {
"space-before-function-paren": [true, "always"],
"no-unnecessary-generics": false,
"strict-export-declare-modifiers": false,
"prefer-readonly": false,
"await-promise": false,
"no-for-in-array": false,
"no-void-expression": false,
"expect": true,
"no-declare-current-package": false
}
"rules": {
"no-unnecessary-generics": false,
"strict-export-declare-modifiers": false
}
}