knex
- Version 3.1.0
- Published
- 874 kB
- 14 dependencies
- MIT license
Install
npm i knex
yarn add knex
pnpm add knex
Overview
A batteries-included SQL query & schema builder for PostgresSQL, MySQL, CockroachDB, MSSQL and SQLite3
Index
Variables
Functions
Classes
Interfaces
Namespaces
Knex
- AliasDict
- AliasQueryBuilder
- AlterColumnBuilder
- AlterColumnView
- AlterTableBuilder
- AlterViewBuilder
- AnalyticFunction
- As
- AsymmetricAggregation
- AsyncConnectionConfigProvider
- BatchInsertBuilder
- BetterSqlite3ConnectionConfig
- ChainableInterface
- ClearStatements
- Client
- ColumnBuilder
- ColumnDescriptor
- ColumnInfo
- ColumnNameQueryBuilder
- Comment
- CompositeTableType
- Config
- ConnectionConfig
- ConnectionConfigProvider
- CreateTableBuilder
- DbColumn
- DbRecord
- DbRecordArr
- DefaultToOptions
- deferrableType
- Distinct
- DistinctOn
- EnumOptions
- Except
- ExposedPromiseKeys
- ForeignConstraintBuilder
- FunctionHelper
- GroupBy
- Having
- HavingNull
- HavingRange
- HintComment
- InferrableColumnDescriptor
- Intersect
- IntersectAliases
- IsolationLevels
- Join
- JoinCallback
- JoinClause
- JoinRaw
- JsonExtract
- JsonExtraction
- JsonInsert
- JsonRemove
- JsonSet
- lengthOperator
- LogFn
- Logger
- Lookup
- MariaSqlConnectionConfig
- MariaSslConfiguration
- MaybeRawColumn
- MaybeRawRecord
- Migration
- MigrationSource
- Migrator
- MigratorConfig
- MsSqlAuthenticationTypeOptions
- MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
- MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
- MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
- MsSqlColumnBuilder
- MsSqlConnectionConfig
- MsSqlConnectionConfigBase
- MsSqlDefaultAuthenticationConfig
- MsSqlNtlmAuthenticationConfig
- MultikeyForeignConstraintBuilder
- MySql2ConnectionConfig
- MySqlAlterColumnBuilder
- MySqlColumnBuilder
- MySqlConnectionConfig
- OnConflictQueryBuilder
- OracleDbConnectionConfig
- OrderBy
- PartitionBy
- PgConnectionConfig
- PgCustomTypesConfig
- PgGetTypeParser
- PoolConfig
- PostgreSqlColumnBuilder
- QueryBuilder
- QueryCallback
- QueryCallbackWithArgs
- QueryInterface
- Raw
- RawBinding
- RawBuilder
- RawQueryBuilder
- RedshiftConnectionConfig
- Ref
- RefBuilder
- ReferencingColumnBuilder
- RefMemberTag
- ResolveTableType
- SchemaBuilder
- Seed
- Seeder
- SeederConfig
- SeedSource
- Select
- SocketConnectionConfig
- Sql
- Sqlite3ConnectionConfig
- SqlLiteColumnBuilder
- SqlNative
- StaticConnectionConfig
- storageEngineIndexType
- StringTagSupport
- SyncConnectionConfigProvider
- Table
- TableBuilder
- TableDescriptor
- TableInterfaceScope
- TableNames
- TableType
- Transaction
- TransactionConfig
- TransactionProvider
- TypePreservingAggregation
- Union
- Using
- Value
- ValueDict
- ViewBuilder
- Where
- WhereBetween
- WhereExists
- WhereIn
- WhereJsonObject
- WhereJsonPath
- WhereNull
- WhereRaw
- WhereWrapped
- With
- WithRaw
- WithSchema
- WithWrapped
knex.Knex
- AliasDict
- AliasQueryBuilder
- AlterColumnBuilder
- AlterColumnView
- AlterTableBuilder
- AlterViewBuilder
- AnalyticFunction
- As
- AsymmetricAggregation
- AsyncConnectionConfigProvider
- BatchInsertBuilder
- BetterSqlite3ConnectionConfig
- ChainableInterface
- ClearStatements
- Client
- ColumnBuilder
- ColumnDescriptor
- ColumnInfo
- ColumnNameQueryBuilder
- Comment
- CompositeTableType
- Config
- ConnectionConfig
- ConnectionConfigProvider
- CreateTableBuilder
- DbColumn
- DbRecord
- DbRecordArr
- DefaultToOptions
- deferrableType
- Distinct
- DistinctOn
- EnumOptions
- Except
- ExposedPromiseKeys
- ForeignConstraintBuilder
- FunctionHelper
- GroupBy
- Having
- HavingNull
- HavingRange
- HintComment
- InferrableColumnDescriptor
- Intersect
- IntersectAliases
- IsolationLevels
- Join
- JoinCallback
- JoinClause
- JoinRaw
- JsonExtract
- JsonExtraction
- JsonInsert
- JsonRemove
- JsonSet
- lengthOperator
- LogFn
- Logger
- Lookup
- MariaSqlConnectionConfig
- MariaSslConfiguration
- MaybeRawColumn
- MaybeRawRecord
- Migration
- MigrationSource
- Migrator
- MigratorConfig
- MsSqlAuthenticationTypeOptions
- MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
- MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
- MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
- MsSqlColumnBuilder
- MsSqlConnectionConfig
- MsSqlConnectionConfigBase
- MsSqlDefaultAuthenticationConfig
- MsSqlNtlmAuthenticationConfig
- MultikeyForeignConstraintBuilder
- MySql2ConnectionConfig
- MySqlAlterColumnBuilder
- MySqlColumnBuilder
- MySqlConnectionConfig
- OnConflictQueryBuilder
- OracleDbConnectionConfig
- OrderBy
- PartitionBy
- PgConnectionConfig
- PgCustomTypesConfig
- PgGetTypeParser
- PoolConfig
- PostgreSqlColumnBuilder
- QueryBuilder
- QueryCallback
- QueryCallbackWithArgs
- QueryInterface
- Raw
- RawBinding
- RawBuilder
- RawQueryBuilder
- RedshiftConnectionConfig
- Ref
- RefBuilder
- ReferencingColumnBuilder
- RefMemberTag
- ResolveTableType
- SchemaBuilder
- Seed
- Seeder
- SeederConfig
- SeedSource
- Select
- SocketConnectionConfig
- Sql
- Sqlite3ConnectionConfig
- SqlLiteColumnBuilder
- SqlNative
- StaticConnectionConfig
- storageEngineIndexType
- StringTagSupport
- SyncConnectionConfigProvider
- Table
- TableBuilder
- TableDescriptor
- TableInterfaceScope
- TableNames
- TableType
- Transaction
- TransactionConfig
- TransactionProvider
- TypePreservingAggregation
- Union
- Using
- Value
- ValueDict
- ViewBuilder
- Where
- WhereBetween
- WhereExists
- WhereIn
- WhereJsonObject
- WhereJsonPath
- WhereNull
- WhereRaw
- WhereWrapped
- With
- WithRaw
- WithSchema
- WithWrapped
knex.knex.Knex
- AliasDict
- AliasQueryBuilder
- AlterColumnBuilder
- AlterColumnView
- AlterTableBuilder
- AlterViewBuilder
- AnalyticFunction
- As
- AsymmetricAggregation
- AsyncConnectionConfigProvider
- BatchInsertBuilder
- BetterSqlite3ConnectionConfig
- ChainableInterface
- ClearStatements
- Client
- ColumnBuilder
- ColumnDescriptor
- ColumnInfo
- ColumnNameQueryBuilder
- Comment
- CompositeTableType
- Config
- ConnectionConfig
- ConnectionConfigProvider
- CreateTableBuilder
- DbColumn
- DbRecord
- DbRecordArr
- DefaultToOptions
- deferrableType
- Distinct
- DistinctOn
- EnumOptions
- Except
- ExposedPromiseKeys
- ForeignConstraintBuilder
- FunctionHelper
- GroupBy
- Having
- HavingNull
- HavingRange
- HintComment
- InferrableColumnDescriptor
- Intersect
- IntersectAliases
- IsolationLevels
- Join
- JoinCallback
- JoinClause
- JoinRaw
- JsonExtract
- JsonExtraction
- JsonInsert
- JsonRemove
- JsonSet
- lengthOperator
- LogFn
- Logger
- Lookup
- MariaSqlConnectionConfig
- MariaSslConfiguration
- MaybeRawColumn
- MaybeRawRecord
- Migration
- MigrationSource
- Migrator
- MigratorConfig
- MsSqlAuthenticationTypeOptions
- MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
- MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
- MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
- MsSqlColumnBuilder
- MsSqlConnectionConfig
- MsSqlConnectionConfigBase
- MsSqlDefaultAuthenticationConfig
- MsSqlNtlmAuthenticationConfig
- MultikeyForeignConstraintBuilder
- MySql2ConnectionConfig
- MySqlAlterColumnBuilder
- MySqlColumnBuilder
- MySqlConnectionConfig
- OnConflictQueryBuilder
- OracleDbConnectionConfig
- OrderBy
- PartitionBy
- PgConnectionConfig
- PgCustomTypesConfig
- PgGetTypeParser
- PoolConfig
- PostgreSqlColumnBuilder
- QueryBuilder
- QueryCallback
- QueryCallbackWithArgs
- QueryInterface
- Raw
- RawBinding
- RawBuilder
- RawQueryBuilder
- RedshiftConnectionConfig
- Ref
- RefBuilder
- ReferencingColumnBuilder
- RefMemberTag
- ResolveTableType
- SchemaBuilder
- Seed
- Seeder
- SeederConfig
- SeedSource
- Select
- SocketConnectionConfig
- Sql
- Sqlite3ConnectionConfig
- SqlLiteColumnBuilder
- SqlNative
- StaticConnectionConfig
- storageEngineIndexType
- StringTagSupport
- SyncConnectionConfigProvider
- Table
- TableBuilder
- TableDescriptor
- TableInterfaceScope
- TableNames
- TableType
- Transaction
- TransactionConfig
- TransactionProvider
- TypePreservingAggregation
- Union
- Using
- Value
- ValueDict
- ViewBuilder
- Where
- WhereBetween
- WhereExists
- WhereIn
- WhereJsonObject
- WhereJsonPath
- WhereNull
- WhereRaw
- WhereWrapped
- With
- WithRaw
- WithSchema
- WithWrapped
knex.knex.knex.Knex
- AliasDict
- AliasQueryBuilder
- AlterColumnBuilder
- AlterColumnView
- AlterTableBuilder
- AlterViewBuilder
- AnalyticFunction
- As
- AsymmetricAggregation
- AsyncConnectionConfigProvider
- BatchInsertBuilder
- BetterSqlite3ConnectionConfig
- ChainableInterface
- ClearStatements
- Client
- ColumnBuilder
- ColumnDescriptor
- ColumnInfo
- ColumnNameQueryBuilder
- Comment
- CompositeTableType
- Config
- ConnectionConfig
- ConnectionConfigProvider
- CreateTableBuilder
- DbColumn
- DbRecord
- DbRecordArr
- DefaultToOptions
- deferrableType
- Distinct
- DistinctOn
- EnumOptions
- Except
- ExposedPromiseKeys
- ForeignConstraintBuilder
- FunctionHelper
- GroupBy
- Having
- HavingNull
- HavingRange
- HintComment
- InferrableColumnDescriptor
- Intersect
- IntersectAliases
- IsolationLevels
- Join
- JoinCallback
- JoinClause
- JoinRaw
- JsonExtract
- JsonExtraction
- JsonInsert
- JsonRemove
- JsonSet
- lengthOperator
- LogFn
- Logger
- Lookup
- MariaSqlConnectionConfig
- MariaSslConfiguration
- MaybeRawColumn
- MaybeRawRecord
- Migration
- MigrationSource
- Migrator
- MigratorConfig
- MsSqlAuthenticationTypeOptions
- MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
- MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
- MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
- MsSqlColumnBuilder
- MsSqlConnectionConfig
- MsSqlConnectionConfigBase
- MsSqlDefaultAuthenticationConfig
- MsSqlNtlmAuthenticationConfig
- MultikeyForeignConstraintBuilder
- MySql2ConnectionConfig
- MySqlAlterColumnBuilder
- MySqlColumnBuilder
- MySqlConnectionConfig
- OnConflictQueryBuilder
- OracleDbConnectionConfig
- OrderBy
- PartitionBy
- PgConnectionConfig
- PgCustomTypesConfig
- PgGetTypeParser
- PoolConfig
- PostgreSqlColumnBuilder
- QueryBuilder
- QueryCallback
- QueryCallbackWithArgs
- QueryInterface
- Raw
- RawBinding
- RawBuilder
- RawQueryBuilder
- RedshiftConnectionConfig
- Ref
- RefBuilder
- ReferencingColumnBuilder
- RefMemberTag
- ResolveTableType
- SchemaBuilder
- Seed
- Seeder
- SeederConfig
- SeedSource
- Select
- SocketConnectionConfig
- Sql
- Sqlite3ConnectionConfig
- SqlLiteColumnBuilder
- SqlNative
- StaticConnectionConfig
- storageEngineIndexType
- StringTagSupport
- SyncConnectionConfigProvider
- Table
- TableBuilder
- TableDescriptor
- TableInterfaceScope
- TableNames
- TableType
- Transaction
- TransactionConfig
- TransactionProvider
- TypePreservingAggregation
- Union
- Using
- Value
- ValueDict
- ViewBuilder
- Where
- WhereBetween
- WhereExists
- WhereIn
- WhereJsonObject
- WhereJsonPath
- WhereNull
- WhereRaw
- WhereWrapped
- With
- WithRaw
- WithSchema
- WithWrapped
knex.knex.knex.knex.Knex
- AliasDict
- AliasQueryBuilder
- AlterColumnBuilder
- AlterColumnView
- AlterTableBuilder
- AlterViewBuilder
- AnalyticFunction
- As
- AsymmetricAggregation
- AsyncConnectionConfigProvider
- BatchInsertBuilder
- BetterSqlite3ConnectionConfig
- ChainableInterface
- ClearStatements
- Client
- ColumnBuilder
- ColumnDescriptor
- ColumnInfo
- ColumnNameQueryBuilder
- Comment
- CompositeTableType
- Config
- ConnectionConfig
- ConnectionConfigProvider
- CreateTableBuilder
- DbColumn
- DbRecord
- DbRecordArr
- DefaultToOptions
- deferrableType
- Distinct
- DistinctOn
- EnumOptions
- Except
- ExposedPromiseKeys
- ForeignConstraintBuilder
- FunctionHelper
- GroupBy
- Having
- HavingNull
- HavingRange
- HintComment
- InferrableColumnDescriptor
- Intersect
- IntersectAliases
- IsolationLevels
- Join
- JoinCallback
- JoinClause
- JoinRaw
- JsonExtract
- JsonExtraction
- JsonInsert
- JsonRemove
- JsonSet
- lengthOperator
- LogFn
- Logger
- Lookup
- MariaSqlConnectionConfig
- MariaSslConfiguration
- MaybeRawColumn
- MaybeRawRecord
- Migration
- MigrationSource
- Migrator
- MigratorConfig
- MsSqlAuthenticationTypeOptions
- MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
- MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
- MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
- MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
- MsSqlColumnBuilder
- MsSqlConnectionConfig
- MsSqlConnectionConfigBase
- MsSqlDefaultAuthenticationConfig
- MsSqlNtlmAuthenticationConfig
- MultikeyForeignConstraintBuilder
- MySql2ConnectionConfig
- MySqlAlterColumnBuilder
- MySqlColumnBuilder
- MySqlConnectionConfig
- OnConflictQueryBuilder
- OracleDbConnectionConfig
- OrderBy
- PartitionBy
- PgConnectionConfig
- PgCustomTypesConfig
- PgGetTypeParser
- PoolConfig
- PostgreSqlColumnBuilder
- QueryBuilder
- QueryCallback
- QueryCallbackWithArgs
- QueryInterface
- Raw
- RawBinding
- RawBuilder
- RawQueryBuilder
- RedshiftConnectionConfig
- Ref
- RefBuilder
- ReferencingColumnBuilder
- RefMemberTag
- ResolveTableType
- SchemaBuilder
- Seed
- Seeder
- SeederConfig
- SeedSource
- Select
- SocketConnectionConfig
- Sql
- Sqlite3ConnectionConfig
- SqlLiteColumnBuilder
- SqlNative
- StaticConnectionConfig
- storageEngineIndexType
- StringTagSupport
- SyncConnectionConfigProvider
- Table
- TableBuilder
- TableDescriptor
- TableInterfaceScope
- TableNames
- TableType
- Transaction
- TransactionConfig
- TransactionProvider
- TypePreservingAggregation
- Union
- Using
- Value
- ValueDict
- ViewBuilder
- Where
- WhereBetween
- WhereExists
- WhereIn
- WhereJsonObject
- WhereJsonPath
- WhereNull
- WhereRaw
- WhereWrapped
- With
- WithRaw
- WithSchema
- WithWrapped
Variables
variable Client
const Client: typeof Knex.Client;
Functions
function knex
knex: typeof knex;
Classes
class ColumnBuilder
class ColumnBuilder {}
method extend
static extend: <T = Knex.ColumnBuilder, B = Knex.ColumnBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class KnexTimeoutError
class KnexTimeoutError extends Error {}
class QueryBuilder
class QueryBuilder {}
method extend
static extend: ( methodName: string, fn: <TRecord extends {} = any, TResult extends {} = unknown[]>( this: Knex.QueryBuilder<TRecord, TResult>, ...args: any[] ) => | Knex.QueryBuilder<TRecord, TResult> | Promise< | Knex.QueryBuilder<TRecord | TResult, any> | DeferredKeySelection.Resolve<TResult> >) => void;
class SchemaBuilder
class SchemaBuilder {}
method extend
static extend: <T = Knex.SchemaBuilder, B = Knex.SchemaBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class TableBuilder
class TableBuilder {}
method extend
static extend: <T = Knex.TableBuilder, B = Knex.TableBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class ViewBuilder
class ViewBuilder {}
method extend
static extend: <T = Knex.ViewBuilder<any, any>, B = Knex.ViewBuilder<any, any>>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
Interfaces
interface Knex
interface Knex<TRecord extends {} = any, TResult = any[]> extends Knex.QueryInterface<TRecord, TResult>, events.EventEmitter {}
property client
client: any;
property fn
fn: Knex.FunctionHelper;
property isTransaction
isTransaction?: boolean;
property migrate
migrate: Knex.Migrator;
property raw
raw: Knex.RawBuilder<TRecord>;
property ref
ref: Knex.RefBuilder;
property schema
schema: Knex.SchemaBuilder;
property seed
seed: Knex.Seeder;
property userParams
userParams: Record<string, any>;
property VERSION
VERSION: string;
method batchInsert
batchInsert: <TRecord2 extends {} = TRecord, TResult2 = number[]>( tableName: Knex.TableDescriptor, data: TRecord2 extends Knex.CompositeTableType<unknown> ? ReadonlyArray<Knex.ResolveTableType<TRecord2, 'insert'>> : ReadonlyArray<Knex.DbRecordArr<TRecord2>>, chunkSize?: number) => Knex.BatchInsertBuilder<TRecord2, TResult2>;
method destroy
destroy: { (callback: Function): void; (): Promise<void> };
method initialize
initialize: (config?: Knex.Config) => void;
method queryBuilder
queryBuilder: < TRecord2 extends {} = TRecord, TResult2 = TResult>() => Knex.QueryBuilder<TRecord2, TResult2>;
method transaction
transaction: { (config?: Knex.TransactionConfig): Promise<Knex.Transaction>; (transactionScope?: null, config?: Knex.TransactionConfig): Promise< Knex.Transaction<any, any[]> >; <T>( transactionScope: ( trx: Knex.Transaction<any, any[]> ) => void | Promise<T>, config?: Knex.TransactionConfig ): Promise<T>;};
method transactionProvider
transactionProvider: ( config?: Knex.TransactionConfig) => Knex.TransactionProvider;
method withUserParams
withUserParams: (params: Record<string, any>) => Knex;
call signature
<TTable extends Knex.TableNames>( tableName: TTable, options?: TableOptions): Knex.QueryBuilder< Knex.TableType<TTable>, DeferredKeySelection<Knex.ResolveTableType<Knex.TableType<TTable>>, never>[]>;
call signature
< TRecord2 extends {} = TRecord, TResult2 = DeferredKeySelection<TRecord2, never>[]>( tableName?: Knex.TableDescriptor | Knex.AliasDict, options?: TableOptions): Knex.QueryBuilder<TRecord2, TResult2>;
Namespaces
namespace DeferredKeySelection
namespace DeferredKeySelection {}
type AddAliases
type AddAliases<TSelection, T extends {}> = TSelection extends DeferredKeySelection< infer TBase, infer TKeys, infer THasSelect, infer TAliasMapping, infer TSingle, infer TIntersectProps, infer TUnionProps> ? DeferredKeySelection< TBase, TKeys, THasSelect, TAliasMapping & T, TSingle, TIntersectProps, TUnionProps > : DeferredKeySelection<unknown, never, false, T>;
type AddKey
type AddKey< TSelection, TKey extends string> = TSelection extends DeferredKeySelection< infer TBase, infer TKeys, any, infer TAliasMapping, infer TSingle, infer TIntersectProps, infer TUnionProps> ? DeferredKeySelection< TBase, TKeys | TKey, true, TAliasMapping, TSingle, TIntersectProps, TUnionProps > : DeferredKeySelection<unknown, TKey, true>;
type AddUnionMember
type AddUnionMember<TSelection, T> = TSelection extends DeferredKeySelection< infer TBase, infer TKeys, infer THasSelect, infer TAliasMapping, infer TSingle, infer TIntersectProps, infer TUnionProps> ? DeferredKeySelection< TBase, TKeys, THasSelect, TAliasMapping, TSingle, TIntersectProps, TUnionProps | T > : DeferredKeySelection<TSelection, never, false, {}, false, {}, T>;
type Any
type Any = DeferredKeySelection<any, any, any, any, any, any, any>;
type Augment
type Augment< T, TBase, TKey extends string, TAliasMapping extends {} = {}> = AddAliases<AddKey<SetBase<T, TBase>, TKey>, TAliasMapping>;
type ReplaceBase
type ReplaceBase<TSelection, TBase> = UnwrapArrayMember<TSelection> extends DeferredKeySelection.Any ? ArrayIfAlready< TSelection, DeferredKeySelection.SetBase<UnwrapArrayMember<TSelection>, TBase> > : unknown extends UnwrapArrayMember<TSelection> ? ArrayIfAlready<TSelection, DeferredKeySelection.SetBase<unknown, TBase>> : TSelection;
type Resolve
type Resolve<TSelection> = TSelection extends DeferredKeySelection.Any ? Knex.ResolveTableType<ResolveOne<TSelection>> : TSelection extends DeferredKeySelection.Any[] ? Knex.ResolveTableType<ResolveOne<TSelection[0]>>[] : TSelection extends (infer I)[] ? UnknownOrCurlyCurlyToAny<Knex.ResolveTableType<I>>[] : UnknownOrCurlyCurlyToAny<Knex.ResolveTableType<TSelection>>;
type ResolveOne
type ResolveOne<TSelection> = TSelection extends DeferredKeySelection< infer TBase, infer TKeys, infer THasSelect, infer TAliasMapping, infer TSingle, infer TIntersectProps, infer TUnionProps> ? UnknownOrCurlyCurlyToAny< // ^ We convert final result to any if it is unknown for backward compatibility. // Historically knex typings have been liberal with returning any and changing // default return type to unknown would be a major breaking change for users. // // So we compromise on type safety here and return any. | AugmentParams< AnyToUnknown<TBase> extends {} ? // ^ Conversion of any -> unknown is needed here to prevent distribution // of any over the conditional TSingle extends true ? TKeys extends keyof TBase ? TBase[TKeys] : any : AugmentParams< true extends THasSelect ? PartialOrAny<TBase, TKeys> : TBase, MappedAliasType<TBase, TAliasMapping> > : unknown, TIntersectProps > | TUnionProps > : TSelection;
type SetBase
type SetBase<TSelection, TBase> = TSelection extends DeferredKeySelection< any, infer TKeys, infer THasSelect, infer TAliasMapping, infer TSingle, infer TIntersectProps, infer TUnionProps> ? DeferredKeySelection< TBase, TKeys, THasSelect, TAliasMapping, TSingle, TIntersectProps, TUnionProps > : DeferredKeySelection<TBase, never>;
type SetSingle
type SetSingle< TSelection, TSingle extends boolean> = TSelection extends DeferredKeySelection< infer TBase, infer TKeys, infer THasSelect, infer TAliasMapping, any, infer TIntersectProps, infer TUnionProps> ? DeferredKeySelection< TBase, TKeys, THasSelect, TAliasMapping, TSingle, TIntersectProps, TUnionProps > : never;
namespace knex
namespace knex {}
variable Client
const Client: typeof Knex.Client;
function knex
knex: typeof knex;
class ColumnBuilder
class ColumnBuilder {}
method extend
static extend: <T = Knex.ColumnBuilder, B = Knex.ColumnBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class KnexTimeoutError
class KnexTimeoutError extends Error {}
class QueryBuilder
class QueryBuilder {}
method extend
static extend: ( methodName: string, fn: <TRecord extends {} = any, TResult extends {} = unknown[]>( this: Knex.QueryBuilder<TRecord, TResult>, ...args: any[] ) => | Knex.QueryBuilder<TRecord, TResult> | Promise< | Knex.QueryBuilder<TRecord | TResult, any> | DeferredKeySelection.Resolve<TResult> >) => void;
class SchemaBuilder
class SchemaBuilder {}
method extend
static extend: <T = Knex.SchemaBuilder, B = Knex.SchemaBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class TableBuilder
class TableBuilder {}
method extend
static extend: <T = Knex.TableBuilder, B = Knex.TableBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class ViewBuilder
class ViewBuilder {}
method extend
static extend: <T = Knex.ViewBuilder<any, any>, B = Knex.ViewBuilder<any, any>>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
interface Knex
interface Knex<TRecord extends {} = any, TResult = any[]> extends Knex.QueryInterface<TRecord, TResult>, events.EventEmitter {}
property client
client: any;
property fn
fn: Knex.FunctionHelper;
property isTransaction
isTransaction?: boolean;
property migrate
migrate: Knex.Migrator;
property raw
raw: Knex.RawBuilder<TRecord>;
property ref
ref: Knex.RefBuilder;
property schema
schema: Knex.SchemaBuilder;
property seed
seed: Knex.Seeder;
property userParams
userParams: Record<string, any>;
property VERSION
VERSION: string;
method batchInsert
batchInsert: <TRecord2 extends {} = TRecord, TResult2 = number[]>( tableName: Knex.TableDescriptor, data: TRecord2 extends Knex.CompositeTableType<unknown> ? ReadonlyArray<Knex.ResolveTableType<TRecord2, 'insert'>> : ReadonlyArray<Knex.DbRecordArr<TRecord2>>, chunkSize?: number) => Knex.BatchInsertBuilder<TRecord2, TResult2>;
method destroy
destroy: { (callback: Function): void; (): Promise<void> };
method initialize
initialize: (config?: Knex.Config) => void;
method queryBuilder
queryBuilder: < TRecord2 extends {} = TRecord, TResult2 = TResult>() => Knex.QueryBuilder<TRecord2, TResult2>;
method transaction
transaction: { (config?: Knex.TransactionConfig): Promise<Knex.Transaction>; (transactionScope?: null, config?: Knex.TransactionConfig): Promise< Knex.Transaction<any, any[]> >; <T>( transactionScope: ( trx: Knex.Transaction<any, any[]> ) => void | Promise<T>, config?: Knex.TransactionConfig ): Promise<T>;};
method transactionProvider
transactionProvider: ( config?: Knex.TransactionConfig) => Knex.TransactionProvider;
method withUserParams
withUserParams: (params: Record<string, any>) => Knex;
call signature
<TTable extends Knex.TableNames>( tableName: TTable, options?: TableOptions): Knex.QueryBuilder< Knex.TableType<TTable>, DeferredKeySelection<Knex.ResolveTableType<Knex.TableType<TTable>>, never>[]>;
call signature
< TRecord2 extends {} = TRecord, TResult2 = DeferredKeySelection<TRecord2, never>[]>( tableName?: Knex.TableDescriptor | Knex.AliasDict, options?: TableOptions): Knex.QueryBuilder<TRecord2, TResult2>;
namespace Knex
namespace Knex {}
variable RefMemberTag
const RefMemberTag: Symbol;
class Client
class Client extends events.EventEmitter {}
constructor
constructor(config: Config<any>);
property canCancelQuery
canCancelQuery: boolean;
property config
config: Config<any>;
property connectionConfigExpirationChecker
connectionConfigExpirationChecker: () => boolean;
property connectionConfigProvider
connectionConfigProvider: any;
property connectionSettings
connectionSettings: {};
property dialect
dialect: string;
property driver
driver: any;
property driverName
driverName: string;
property logger
logger: Logger;
property pool
pool: any;
property valueForUndefined
valueForUndefined: any;
property version
version?: string;
method acquireConnection
acquireConnection: () => any;
method acquireRawConnection
acquireRawConnection: () => Promise<any>;
method assertCanCancelQuery
assertCanCancelQuery: () => void;
method cancelQuery
cancelQuery: () => void;
method columnBuilder
columnBuilder: (tableBuilder: any, type: any, args: any) => ColumnBuilder;
method columnCompiler
columnCompiler: (tableBuilder: any, columnBuilder: any) => any;
method customWrapIdentifier
customWrapIdentifier: (value: any, origImpl: any, queryContext: any) => any;
method database
database: () => any;
method destroy
destroy: (callback: any) => any;
method destroyRawConnection
destroyRawConnection: (connection: any) => Promise<void>;
method formatter
formatter: (builder: any) => any;
method getPoolSettings
getPoolSettings: (poolConfig: any) => any;
method initializeDriver
initializeDriver: () => void;
method initializePool
initializePool: (config?: {}) => void;
method poolDefaults
poolDefaults: () => { min: number; max: number; propagateCreateError: boolean };
method positionBindings
positionBindings: (sql: any) => any;
method postProcessResponse
postProcessResponse: (resp: any, queryContext: any) => any;
method prepBindings
prepBindings: (bindings: any) => any;
method query
query: (connection: any, obj: any) => any;
method queryBuilder
queryBuilder: () => QueryBuilder;
method queryCompiler
queryCompiler: (builder: any) => any;
method raw
raw: (...args: any[]) => any;
method ref
ref: (...args: any[]) => Ref<any, any>;
method releaseConnection
releaseConnection: (connection: any) => any;
method runner
runner: (builder: any) => any;
method schemaBuilder
schemaBuilder: () => SchemaBuilder;
method schemaCompiler
schemaCompiler: (builder: SchemaBuilder) => any;
method stream
stream: (connection: any, obj: any, stream: any, options: any) => any;
method tableBuilder
tableBuilder: ( type: any, tableName: any, tableNameLike: any, fn: any) => TableBuilder;
method tableCompiler
tableCompiler: (tableBuilder: any) => any;
method transaction
transaction: (container: any, config: any, outerTx: any) => Transaction;
method validateConnection
validateConnection: (connection: any) => Promise<boolean>;
method wrapIdentifier
wrapIdentifier: (value: any, queryContext: any) => any;
method wrapIdentifierImpl
wrapIdentifierImpl: (value: any) => string;
class Seeder
class Seeder {}
constructor
constructor(knex: Knex<any, any[]>);
method make
make: (name: string, config?: SeederConfig) => Promise<string>;
method run
run: (config?: SeederConfig) => Promise<[string[]]>;
method setConfig
setConfig: (config: SeederConfig) => SeederConfig;
interface AliasDict
interface AliasDict extends Dict<string> {}
interface AliasQueryBuilder
interface AliasQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( ...aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends (Dict | string)[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( ...aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends (Dict | string)[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, TRecord, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
interface AlterColumnBuilder
interface AlterColumnBuilder extends ColumnBuilder {}
interface AlterColumnView
interface AlterColumnView extends ViewBuilder {}
interface AlterTableBuilder
interface AlterTableBuilder extends TableBuilder {}
interface AlterViewBuilder
interface AlterViewBuilder extends ViewBuilder {}
method column
column: (column: string) => AlterColumnView;
interface AnalyticFunction
interface AnalyticFunction<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< TAlias extends string, TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>>( alias: TAlias, raw: Raw | QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult2>;
call signature
< TAlias extends string, TKey extends keyof ResolveTableType<TRecord>, TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>>( alias: TAlias, orderBy: | TKey | TKey[] | { column: TKey; order?: 'asc' | 'desc'; nulls?: 'first' | 'last'; }, partitionBy?: TKey | TKey[] | { column: TKey; order?: 'asc' | 'desc' }): QueryBuilder<TRecord, TResult2>;
interface As
interface As<TRecord extends {}, TResult> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface AsymmetricAggregation
interface AsymmetricAggregation< TRecord extends {} = any, TResult = unknown[], TValue = any> {}
call signature
< TOptions extends { as: string }, TResult2 = AggregationQueryResult<TResult, { [k in TOptions['as']]: TValue }>>( columnName: Readonly<keyof ResolveTableType<TRecord>>, options: Readonly<TOptions>): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: readonly (keyof ResolveTableType<TRecord>)[]): QueryBuilder<TRecord, TResult2>;
call signature
< TAliases extends {} = Record<string, string | string[] | Knex.Raw>, TResult2 = AggregationQueryResult< TResult, { [k in keyof TAliases]?: TValue } >>( aliases: TAliases): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: ReadonlyArray< | Readonly<Record<string, string | string[] | Knex.Raw>> | Knex.Raw | string >): QueryBuilder<TRecord, TResult2>;
interface BatchInsertBuilder
interface BatchInsertBuilder<TRecord extends {} = any, TResult = number[]> extends Promise<ResolveResult<TResult>> {}
method returning
returning: { (column: '*'): BatchInsertBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( column: TKey ): BatchInsertBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.SetSingle< DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >, false >[] >( columns: readonly TKey[] ): BatchInsertBuilder<TRecord, TResult2>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( column: unknown extends TRecord ? string | Raw<any> | readonly (string | Raw<any>)[] : never ): BatchInsertBuilder<TRecord, TResult2>;};
method transacting
transacting: (trx: Transaction) => this;
interface BetterSqlite3ConnectionConfig
interface BetterSqlite3ConnectionConfig {}
Used with
better-sqlite3
adapter
interface ChainableInterface
interface ChainableInterface<T = any> extends Pick<Promise<T>, keyof Promise<T> & ExposedPromiseKeys>, StringTagSupport {}
method asCallback
asCallback: (callback: Function) => Promise<T>;
method connection
connection: (connection: any) => this;
method debug
debug: (enabled: boolean) => this;
method generateDdlCommands
generateDdlCommands: () => Promise<{ pre: string[]; sql: string[]; check: string | null; post: string[];}>;
method options
options: (options: Readonly<{ [key: string]: any }>) => this;
method pipe
pipe: <T extends NodeJS.WritableStream>( writable: T, options?: Readonly<{ [key: string]: any }>) => stream.PassThrough;
method stream
stream: { (handler: (readable: stream.PassThrough) => any): Promise<any>; ( options: Readonly<{ [key: string]: any }>, handler: (readable: stream.PassThrough) => any ): Promise<any>; (options?: Readonly<{ [key: string]: any }>): any;};
method toQuery
toQuery: () => string;
method transacting
transacting: (trx: Transaction) => this;
interface ColumnBuilder
interface ColumnBuilder {}
method after
after: (columnName: string) => ColumnBuilder;
method alter
alter: ( options?: Readonly<{ alterNullable?: boolean; alterType?: boolean }>) => ColumnBuilder;
method checkBetween
checkBetween: ( values: any[] | any[][], constraintName?: string) => ColumnBuilder;
method checkIn
checkIn: (values: string[], constraintName?: string) => ColumnBuilder;
method checkLength
checkLength: ( operator: lengthOperator, length: number, constraintName?: string) => ColumnBuilder;
method checkNegative
checkNegative: (constraintName?: string) => ColumnBuilder;
method checkNotIn
checkNotIn: (values: string[], constraintName?: string) => ColumnBuilder;
method checkPositive
checkPositive: (constraintName?: string) => ColumnBuilder;
method checkRegex
checkRegex: (regex: string, constraintName?: string) => ColumnBuilder;
method collate
collate: (collation: string) => ColumnBuilder;
method comment
comment: (value: string) => ColumnBuilder;
method defaultTo
defaultTo: (value: Value | null, options?: DefaultToOptions) => ColumnBuilder;
method first
first: () => ColumnBuilder;
method index
index: (indexName?: string) => ColumnBuilder;
method notNullable
notNullable: () => ColumnBuilder;
method nullable
nullable: () => ColumnBuilder;
method primary
primary: { ( options?: Readonly<{ constraintName?: string; deferrable?: deferrableType; }> ): ColumnBuilder; (constraintName?: string): ColumnBuilder;};
Deprecated
method queryContext
queryContext: (context: any) => ColumnBuilder;
method references
references: (columnName: string) => ReferencingColumnBuilder;
method unique
unique: { ( options?: Readonly<{ indexName?: string; deferrable?: deferrableType }> ): ColumnBuilder; (indexName?: string): ColumnBuilder;};
Deprecated
method unsigned
unsigned: () => ColumnBuilder;
interface ColumnInfo
interface ColumnInfo {}
property defaultValue
defaultValue: Value;
property maxLength
maxLength: number;
property nullable
nullable: boolean;
property type
type: string;
interface ColumnNameQueryBuilder
interface ColumnNameQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: '*'): QueryBuilder< TRecord, ArrayIfAlready<TResult, DeferredKeySelection<TRecord, string>>>;
call signature
< ColNameUT extends keyof ResolveTableType<TRecord>, TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, ColNameUT & string >[]>( ...columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult2>;
call signature
< ColNameUT extends keyof ResolveTableType<TRecord>, TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, ColNameUT & string >[]>( columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, SafePartial<TRecord>, keyof TRecord & string >[]>( ...columnNames: readonly ColumnDescriptor<TRecord, TResult>[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, SafePartial<TRecord>, keyof TRecord & string >[]>( columnNames: readonly ColumnDescriptor<TRecord, TResult>[]): QueryBuilder<TRecord, TResult2>;
interface Comment
interface Comment<TRecord extends {} = any, TResult = any> {}
call signature
(comment: string): QueryBuilder<TRecord, TResult>;
interface Config
interface Config<SV extends {} = any> {}
property acquireConnectionTimeout
acquireConnectionTimeout?: number;
property asyncStackTraces
asyncStackTraces?: boolean;
property client
client?: string | typeof Client;
property compileSqlOnError
compileSqlOnError?: boolean;
property connection
connection?: string | StaticConnectionConfig | ConnectionConfigProvider;
property debug
debug?: boolean;
property dialect
dialect?: string;
property fetchAsString
fetchAsString?: string[];
property jsonbSupport
jsonbSupport?: boolean;
property log
log?: Logger;
property migrations
migrations?: MigratorConfig;
property pool
pool?: PoolConfig;
property postProcessResponse
postProcessResponse?: (result: any, queryContext: any) => any;
property searchPath
searchPath?: string | readonly string[];
property seeds
seeds?: SeederConfig<SV>;
property useNullAsDefault
useNullAsDefault?: boolean;
property version
version?: string;
property wrapIdentifier
wrapIdentifier?: ( value: string, origImpl: (value: string) => string, queryContext: any) => string;
interface ConnectionConfig
interface ConnectionConfig {}
property database
database: string;
property debug
debug?: boolean;
property domain
domain?: string;
property host
host: string;
property instanceName
instanceName?: string;
property password
password: string;
property requestTimeout
requestTimeout?: number;
property user
user: string;
interface CreateTableBuilder
interface CreateTableBuilder extends TableBuilder {}
interface DefaultToOptions
interface DefaultToOptions {}
property constraintName
constraintName?: string;
interface Distinct
interface Distinct<TRecord extends {}, TResult = {}[]> extends ColumnNameQueryBuilder<TRecord, TResult> {}
interface DistinctOn
interface DistinctOn<TRecord extends {}, TResult = {}[]> {}
call signature
<ColNameUT extends keyof TRecord>( ...columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult>;
call signature
<ColNameUT extends keyof TRecord>( columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult>;
call signature
(...columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
call signature
(columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
interface EnumOptions
interface EnumOptions {}
property enumName
enumName: string;
property existingType
existingType?: boolean;
property schemaName
schemaName?: string;
property useNative
useNative: boolean;
interface Except
interface Except<TRecord extends {} = any, TResult = unknown[]> extends Intersect<TRecord, TResult> {}
interface ForeignConstraintBuilder
interface ForeignConstraintBuilder {}
method references
references: (columnName: string) => ReferencingColumnBuilder;
interface FunctionHelper
interface FunctionHelper {}
interface GroupBy
interface GroupBy<TRecord extends {} = any, TResult = unknown[]> extends RawQueryBuilder<TRecord, TResult>, ColumnNameQueryBuilder<TRecord, TResult> {}
interface Having
interface Having<TRecord extends {} = any, TResult = unknown[]> extends WhereWrapped<TRecord, TResult> {}
call signature
<K extends keyof TRecord>( column: K, operator: ComparisonOperator, value: DbColumn<TRecord[K]>): QueryBuilder<TRecord, TResult>;
call signature
( column: string | Raw, operator: string, value: Value | QueryBuilder | null): QueryBuilder<TRecord, TResult>;
call signature
(raw: Raw): QueryBuilder<TRecord, TResult>;
interface HavingNull
interface HavingNull<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface HavingRange
interface HavingRange<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<K extends keyof TRecord>( columnName: K, values: readonly DbColumn<TRecord[K]>[]): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, values: readonly Value[]): QueryBuilder<TRecord, TResult>;
interface HintComment
interface HintComment<TRecord extends {} = any, TResult = any> {}
call signature
(hint: string): QueryBuilder<TRecord, TResult>;
call signature
(hints: readonly string[]): QueryBuilder<TRecord, TResult>;
interface Intersect
interface Intersect<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( callback: MaybeArray<QueryCallback | QueryBuilder<TRecord> | Raw>, wrap?: boolean): QueryBuilder<TRecord, TResult>;
call signature
( ...callbacks: readonly (QueryCallback | Raw | QueryBuilder<TRecord>)[]): QueryBuilder<TRecord, TResult>;
interface Join
interface Join<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable extends TableNames, TRecord2 extends {} = ResolveTableType<TRecord> & ResolveTableType<TableType<TTable>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable, clause: JoinCallback): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable2}.${TKey2}`, operator: string, column2: `${TTable1}.${TKey1}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, operator: string, column2: string): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, clause: JoinCallback): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, columns: { [key: string]: string | number | boolean | Raw }): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable1}.${TKey1}`, column2: `${TTable2}.${TKey2}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable2}.${TKey2}`, column2: `${TTable1}.${TKey1}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, column2: string): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable1}.${TKey1}`, operator: string, column2: `${TTable2}.${TKey2}`): QueryBuilder<TRecord2, TResult2>;
interface JoinCallback
interface JoinCallback {}
call signature
(this: JoinClause, join: JoinClause): void;
interface JoinClause
interface JoinClause {}
method andOn
andOn: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method andOnBetween
andOnBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method andOnExists
andOnExists: (callback: QueryCallback) => JoinClause;
method andOnIn
andOnIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method andOnNotBetween
andOnNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method andOnNotExists
andOnNotExists: (callback: QueryCallback) => JoinClause;
method andOnNotIn
andOnNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method andOnNotNull
andOnNotNull: (column1: string) => JoinClause;
method andOnNull
andOnNull: (column1: string) => JoinClause;
method andOnVal
andOnVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method on
on: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method onBetween
onBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method onExists
onExists: (callback: QueryCallback) => JoinClause;
method onIn
onIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method onJsonPathEquals
onJsonPathEquals: ( columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string) => JoinClause;
method onNotBetween
onNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method onNotExists
onNotExists: (callback: QueryCallback) => JoinClause;
method onNotIn
onNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method onNotNull
onNotNull: (column1: string) => JoinClause;
method onNull
onNull: (column1: string) => JoinClause;
method onVal
onVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method orOn
orOn: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method orOnBetween
orOnBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method orOnExists
orOnExists: (callback: QueryCallback) => JoinClause;
method orOnIn
orOnIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method orOnJsonPathEquals
orOnJsonPathEquals: ( columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string) => JoinClause;
method orOnNotBetween
orOnNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method orOnNotExists
orOnNotExists: (callback: QueryCallback) => JoinClause;
method orOnNotIn
orOnNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method orOnNotNull
orOnNotNull: (column1: string) => JoinClause;
method orOnNull
orOnNull: (column1: string) => JoinClause;
method orOnVal
orOnVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method type
type: (type: string) => JoinClause;
method using
using: ( column: | string | readonly string[] | Raw<any> | { [key: string]: string | Raw<any> }) => JoinClause;
interface JoinRaw
interface JoinRaw<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(tableName: string, binding?: Value | Value[] | ValueDict): QueryBuilder< TRecord, TResult>;
interface JsonExtract
interface JsonExtract<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, alias?: string, singleValue?: boolean): QueryBuilder<TRecord, TResult>;
call signature
(column: JsonExtraction[] | any[][], singleValue?: boolean): QueryBuilder< TRecord, TResult>;
interface JsonExtraction
interface JsonExtraction {}
property alias
alias?: string;
property column
column: string | Raw | QueryBuilder;
property path
path: string;
property singleValue
singleValue?: boolean;
interface JsonInsert
interface JsonInsert<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
interface JsonRemove
interface JsonRemove<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, alias?: string): QueryBuilder<TRecord, TResult>;
interface JsonSet
interface JsonSet<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
interface Logger
interface Logger {}
property debug
debug?: LogFn;
property deprecate
deprecate?: (method: string, alternative: string) => void;
property enableColors
enableColors?: boolean;
property error
error?: LogFn;
property inspectionDepth
inspectionDepth?: number;
property warn
warn?: LogFn;
interface MariaSqlConnectionConfig
interface MariaSqlConnectionConfig {}
property charset
charset?: string;
property compress
compress?: boolean;
property connTimeout
connTimeout?: number;
property db
db?: string;
property host
host?: string;
property keepQueries
keepQueries?: boolean;
property local_infile
local_infile?: boolean;
property multiStatements
multiStatements?: boolean;
property password
password?: string;
property pingInterval
pingInterval?: number;
property port
port?: number;
property protocol
protocol?: string;
property read_default_file
read_default_file?: string;
property read_default_group
read_default_group?: string;
property secureAuth
secureAuth?: boolean;
property ssl
ssl?: boolean | MariaSslConfiguration;
property streamHWM
streamHWM?: number;
property unixSocket
unixSocket?: string;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface MariaSslConfiguration
interface MariaSslConfiguration {}
property ca
ca?: string;
property capath
capath?: string;
property cert
cert?: string;
property cipher
cipher?: string;
property key
key?: string;
property rejectUnauthorized
rejectUnauthorized?: boolean;
method expirationChecker
expirationChecker: () => boolean;
interface Migration
interface Migration {}
interface MigrationSource
interface MigrationSource<TMigrationSpec> {}
method getMigration
getMigration: (migration: TMigrationSpec) => Promise<Migration>;
method getMigrationName
getMigrationName: (migration: TMigrationSpec) => string;
method getMigrations
getMigrations: (loadExtensions: readonly string[]) => Promise<TMigrationSpec[]>;
interface Migrator
interface Migrator {}
method currentVersion
currentVersion: (config?: MigratorConfig) => Promise<string>;
method down
down: (config?: MigratorConfig) => Promise<any>;
method forceFreeMigrationsLock
forceFreeMigrationsLock: (config?: MigratorConfig) => Promise<any>;
method latest
latest: (config?: MigratorConfig) => Promise<any>;
method list
list: (config?: MigratorConfig) => Promise<any>;
method make
make: (name: string, config?: MigratorConfig) => Promise<string>;
method rollback
rollback: (config?: MigratorConfig, all?: boolean) => Promise<any>;
method status
status: (config?: MigratorConfig) => Promise<number>;
method up
up: (config?: MigratorConfig) => Promise<any>;
interface MigratorConfig
interface MigratorConfig {}
property database
database?: string;
property directory
directory?: string | readonly string[];
property disableMigrationsListValidation
disableMigrationsListValidation?: boolean;
property disableTransactions
disableTransactions?: boolean;
property extension
extension?: string;
property loadExtensions
loadExtensions?: readonly string[];
property migrationSource
migrationSource?: MigrationSource<unknown>;
property name
name?: string;
property schemaName
schemaName?: string;
property sortDirsSeparately
sortDirsSeparately?: boolean;
property stub
stub?: string;
property tableName
tableName?: string;
interface MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
interface MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
interface MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId?: string;
If you user want to connect to an Azure app service using a specific client account they need to provide
clientId
asscoiate to their created idnetity.This is optional for retrieve token from azure web app service
property msiEndpoint
msiEndpoint?: string;
A msi app service environment need to provide
msiEndpoint
for retriving the accesstoken.
property msiSecret
msiSecret?: string;
A msi app service environment need to provide
msiSecret
for retriving the accesstoken.
property type
type: 'azure-active-directory-msi-app-service';
interface MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
interface MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId?: string;
If you user want to connect to an Azure app service using a specific client account they need to provide
clientId
asscoiate to their created idnetity.This is optional for retrieve token from azure web app service
property msiEndpoint
msiEndpoint?: string;
A user need to provide
msiEndpoint
for retriving the accesstoken.
property type
type: 'azure-active-directory-msi-vm';
interface MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
interface MsSqlAzureActiveDirectoryPasswordAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
interface MsSqlAzureActiveDirectoryServicePrincipalSecretConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId: string;
Application (
client
) ID from your registered Azure application
property clientSecret
clientSecret: string;
The created
client secret
for this registered Azure application
property tenantId
tenantId: string;
Directory (
tenant
) ID from your registered Azure application
property type
type: 'azure-active-directory-service-principal-secret';
interface MsSqlColumnBuilder
interface MsSqlColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ predicate?: QueryBuilder }>) => ColumnBuilder;
interface MsSqlConnectionConfigBase
interface MsSqlConnectionConfigBase {}
property connectionTimeout
connectionTimeout?: number;
property database
database: string;
property domain
domain?: string;
property driver
driver?: string;
property options
options?: Readonly<{ encrypt?: boolean; instanceName?: string; useUTC?: boolean; tdsVersion?: string; appName?: string; abortTransactionOnError?: boolean; trustedConnection?: boolean; enableArithAbort?: boolean; isolationLevel?: | 'READ_UNCOMMITTED' | 'READ_COMMITTED' | 'REPEATABLE_READ' | 'SERIALIZABLE' | 'SNAPSHOT'; maxRetriesOnTransientErrors?: number; multiSubnetFailover?: boolean; packetSize?: number; trustServerCertificate?: boolean; mapBinding?: (value: any) => { value: any; type: any } | undefined;}>;
property parseJSON
parseJSON?: boolean;
property password
password?: string;
property pool
pool?: Readonly<{ min?: number; max?: number; idleTimeoutMillis?: number; maxWaitingClients?: number; testOnBorrow?: boolean; acquireTimeoutMillis?: number; fifo?: boolean; priorityRange?: number; autostart?: boolean; evictionRunIntervalMillis?: number; numTestsPerRun?: number; softIdleTimeoutMillis?: number; Promise?: any;}>;
property port
port?: number;
property requestTimeout
requestTimeout?: number;
property server
server: string;
property stream
stream?: boolean;
property type
type?: MsSqlAuthenticationTypeOptions;
property userName
userName?: string;
method expirationChecker
expirationChecker: () => boolean;
interface MsSqlDefaultAuthenticationConfig
interface MsSqlDefaultAuthenticationConfig extends MsSqlConnectionConfigBase {}
property type
type?: 'default' | never;
interface MsSqlNtlmAuthenticationConfig
interface MsSqlNtlmAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MultikeyForeignConstraintBuilder
interface MultikeyForeignConstraintBuilder {}
method references
references: (columnNames: readonly string[]) => ReferencingColumnBuilder;
interface MySql2ConnectionConfig
interface MySql2ConnectionConfig extends MySqlConnectionConfig {}
property authPlugins
authPlugins?: { [pluginName: string]: (pluginMetadata: any) => (pluginData: any) => any;};
property authSwitchHandler
authSwitchHandler?: (data: any, callback: () => void) => any;
property charsetNumber
charsetNumber?: number;
property compress
compress?: boolean;
property connectAttributes
connectAttributes?: { [attrNames: string]: any };
property enableKeepAlive
enableKeepAlive?: boolean;
property keepAliveInitialDelay
keepAliveInitialDelay?: number;
property maxPreparedStatements
maxPreparedStatements?: number;
property namedPlaceholders
namedPlaceholders?: boolean;
property nestTables
nestTables?: boolean | string;
property passwordSha1
passwordSha1?: string;
property rowsAsArray
rowsAsArray?: boolean;
property stream
stream?: boolean | ((opts: any) => Stream) | Stream;
property uri
uri?: string;
interface MySqlAlterColumnBuilder
interface MySqlAlterColumnBuilder extends AlterColumnBuilder {}
interface MySqlColumnBuilder
interface MySqlColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ indexType?: string; storageEngineIndexType?: storageEngineIndexType; }>) => ColumnBuilder;
interface MySqlConnectionConfig
interface MySqlConnectionConfig {}
property bigNumberStrings
bigNumberStrings?: boolean;
property charset
charset?: string;
property connectTimeout
connectTimeout?: number;
property database
database?: string;
property dateStrings
dateStrings?: boolean;
property debug
debug?: boolean;
property decimalNumbers
decimalNumbers?: boolean;
property flags
flags?: string;
property host
host?: string;
property insecureAuth
insecureAuth?: boolean;
property localAddress
localAddress?: string;
property multipleStatements
multipleStatements?: boolean;
property password
password?: string;
property port
port?: number;
property queryFormat
queryFormat?: (query: string, values: any) => string;
property socketPath
socketPath?: string;
property ssl
ssl?: string | MariaSslConfiguration;
property stringifyObjects
stringifyObjects?: boolean;
property supportBigNumbers
supportBigNumbers?: boolean;
property timezone
timezone?: string;
property trace
trace?: boolean;
property typeCast
typeCast?: any;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface OnConflictQueryBuilder
interface OnConflictQueryBuilder<TRecord extends {}, TResult> {}
method ignore
ignore: () => QueryBuilder<TRecord, TResult>;
method merge
merge: { (mergeColumns?: (keyof ResolveTableType<TRecord, 'update'>)[]): QueryBuilder< TRecord, TResult >; ( data?: Extract< Readonly< Partial< AnyOrUnknownToOther< MaybeRawRecord<ResolveTableType<TRecord, 'update'>>, {} > > >, object > ): QueryBuilder<TRecord, TResult>;};
interface OracleDbConnectionConfig
interface OracleDbConnectionConfig {}
property connectString
connectString?: string;
property database
database?: string;
property debug
debug?: boolean;
property domain
domain?: string;
property host
host: string;
property instanceName
instanceName?: string;
property password
password?: string;
property requestTimeout
requestTimeout?: number;
property user
user: string;
method expirationChecker
expirationChecker: () => boolean;
interface OrderBy
interface OrderBy<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( columnName: keyof TRecord | QueryBuilder, order?: 'asc' | 'desc', nulls?: 'first' | 'last'): QueryBuilder<TRecord, TResult>;
call signature
( columnName: string | QueryBuilder, order?: string, nulls?: string): QueryBuilder<TRecord, TResult>;
call signature
( columnDefs: Array< | keyof TRecord | Readonly<{ column: keyof TRecord | QueryBuilder; order?: 'asc' | 'desc'; nulls?: 'first' | 'last'; }> >): QueryBuilder<TRecord, TResult>;
call signature
( columnDefs: Array< | string | Readonly<{ column: string | QueryBuilder; order?: string; nulls?: string; }> >): QueryBuilder<TRecord, TResult>;
interface PartitionBy
interface PartitionBy<TRecord extends {} = any, TResult = unknown[]> extends OrderBy<TRecord, TResult> {}
interface PgConnectionConfig
interface PgConnectionConfig {}
property application_name
application_name?: string;
property connectionString
connectionString?: string;
property connectionTimeoutMillis
connectionTimeoutMillis?: number;
property database
database?: string;
property host
host?: string;
property idle_in_transaction_session_timeout
idle_in_transaction_session_timeout?: number;
property keepAlive
keepAlive?: boolean;
property keepAliveInitialDelayMillis
keepAliveInitialDelayMillis?: number;
property options
options?: string;
property parseInputDatesAsUTC
parseInputDatesAsUTC?: boolean;
property password
password?: string | (() => string | Promise<string>);
property port
port?: number;
property query_timeout
query_timeout?: number;
property ssl
ssl?: boolean | ConnectionOptions;
property statement_timeout
statement_timeout?: false | number;
property stream
stream?: () => stream.Duplex | stream.Duplex | undefined;
property types
types?: PgCustomTypesConfig;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface PgCustomTypesConfig
interface PgCustomTypesConfig {}
property getTypeParser
getTypeParser: PgGetTypeParser;
interface PoolConfig
interface PoolConfig {}
property acquireTimeoutMillis
acquireTimeoutMillis?: number;
property afterCreate
afterCreate?: Function;
property createRetryIntervalMillis
createRetryIntervalMillis?: number;
property createTimeoutMillis
createTimeoutMillis?: number;
property destroyTimeoutMillis
destroyTimeoutMillis?: number;
property idleTimeoutMillis
idleTimeoutMillis?: number;
property log
log?: (message: string, logLevel: string) => void;
property max
max?: number;
property min
min?: number;
property name
name?: string;
property priorityRange
priorityRange?: number;
property propagateCreateError
propagateCreateError?: boolean;
property reapIntervalMillis
reapIntervalMillis?: number;
property refreshIdle
refreshIdle?: boolean;
property returnToHead
returnToHead?: boolean;
interface PostgreSqlColumnBuilder
interface PostgreSqlColumnBuilder extends ColumnBuilder {}
method index
index: { ( indexName?: string, options?: Readonly<{ indexType?: string; predicate?: QueryBuilder }> ): ColumnBuilder; (indexName?: string, indexType?: string): ColumnBuilder;};
interface QueryBuilder
interface QueryBuilder<TRecord extends {} = any, TResult = any> extends QueryInterface<TRecord, TResult>, ChainableInterface<ResolveResult<TResult>> {}
property and
and: QueryBuilder<TRecord, TResult>;
property client
client: Client;
property not
not: QueryBuilder<TRecord, TResult>;
property or
or: QueryBuilder<TRecord, TResult>;
method clone
clone: () => QueryBuilder<TRecord, TResult>;
method columnInfo
columnInfo: { (column: keyof DeferredKeySelection.Resolve<TRecord>): Promise<ColumnInfo>; (): Promise<Record<keyof DeferredKeySelection.Resolve<TRecord>, ColumnInfo>>;};
method forKeyShare
forKeyShare: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forNoKeyUpdate
forNoKeyUpdate: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forShare
forShare: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forUpdate
forUpdate: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method noWait
noWait: () => QueryBuilder<TRecord, TResult>;
method on
on: (event: string, callback: Function) => QueryBuilder<TRecord, TResult>;
method queryContext
queryContext: { (context: any): QueryBuilder<TRecord, TResult>; (): any };
method skipLocked
skipLocked: () => QueryBuilder<TRecord, TResult>;
method timeout
timeout: ( ms: number, options?: { cancel?: boolean }) => QueryBuilder<TRecord, TResult>;
method toSQL
toSQL: () => Sql;
interface QueryInterface
interface QueryInterface<TRecord extends {} = any, TResult = any> {}
property andHaving
andHaving: Having<TRecord, TResult>;
property andHavingNotIn
andHavingNotIn: HavingRange<TRecord, TResult>;
property andWhere
andWhere: Where<TRecord, TResult>;
property andWhereBetween
andWhereBetween: WhereBetween<TRecord, TResult>;
property andWhereILike
andWhereILike: Where<TRecord, TResult>;
property andWhereJsonNotSubsetOf
andWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonNotSupersetOf
andWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonObject
andWhereJsonObject: WhereJsonObject<TRecord, TResult>;
property andWhereJsonPath
andWhereJsonPath: WhereJsonPath<TRecord, TResult>;
property andWhereJsonSubsetOf
andWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonSupersetOf
andWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
property andWhereLike
andWhereLike: Where<TRecord, TResult>;
property andWhereNot
andWhereNot: Where<TRecord, TResult>;
property andWhereNotBetween
andWhereNotBetween: WhereBetween<TRecord, TResult>;
property andWhereNotJsonObject
andWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
property andWhereRaw
andWhereRaw: WhereRaw<TRecord, TResult>;
property as
as: As<TRecord, TResult>;
property avg
avg: TypePreservingAggregation<TRecord, TResult>;
property avgDistinct
avgDistinct: TypePreservingAggregation<TRecord, TResult>;
property column
column: Select<TRecord, TResult>;
property columns
columns: Select<TRecord, TResult>;
property comment
comment: Comment<TRecord, TResult>;
property count
count: AsymmetricAggregation< TRecord, TResult, Lookup<ResultTypes.Registry, 'Count', number | string>>;
property countDistinct
countDistinct: AsymmetricAggregation< TRecord, TResult, Lookup<ResultTypes.Registry, 'Count', number | string>>;
property crossJoin
crossJoin: Join<TRecord, TResult>;
property denseRank
denseRank: AnalyticFunction<TRecord, TResult>;
property distinct
distinct: Distinct<TRecord, TResult>;
property distinctOn
distinctOn: DistinctOn<TRecord, TResult>;
property except
except: Except<TRecord, TResult>;
property first
first: Select< TRecord, DeferredKeySelection.AddUnionMember<UnwrapArrayMember<TResult>, undefined>>;
property from
from: Table<TRecord, TResult>;
property fromRaw
fromRaw: Table<TRecord, TResult>;
property fullOuterJoin
fullOuterJoin: Join<TRecord, TResult>;
property groupBy
groupBy: GroupBy<TRecord, TResult>;
property groupByRaw
groupByRaw: RawQueryBuilder<TRecord, TResult>;
property having
having: Having<TRecord, TResult>;
property havingBetween
havingBetween: HavingRange<TRecord, TResult>;
property havingIn
havingIn: HavingRange<TRecord, TResult>;
property havingNotBetween
havingNotBetween: HavingRange<TRecord, TResult>;
property havingNotIn
havingNotIn: HavingRange<TRecord, TResult>;
property havingNotNull
havingNotNull: HavingNull<TRecord, TResult>;
property havingNull
havingNull: HavingNull<TRecord, TResult>;
property havingRaw
havingRaw: RawQueryBuilder<TRecord, TResult>;
property havingWrapped
havingWrapped: WhereWrapped<TRecord, TResult>;
property hintComment
hintComment: HintComment<TRecord, TResult>;
property innerJoin
innerJoin: Join<TRecord, TResult>;
property intersect
intersect: Intersect<TRecord, TResult>;
property into
into: Table<TRecord, TResult>;
property join
join: Join<TRecord, TResult>;
property joinRaw
joinRaw: JoinRaw<TRecord, TResult>;
property jsonExtract
jsonExtract: JsonExtract<TRecord, TResult>;
property jsonInsert
jsonInsert: JsonInsert<TRecord, TResult>;
property jsonRemove
jsonRemove: JsonRemove<TRecord, TResult>;
property jsonSet
jsonSet: JsonSet<TRecord, TResult>;
property leftJoin
leftJoin: Join<TRecord, TResult>;
property leftOuterJoin
leftOuterJoin: Join<TRecord, TResult>;
property max
max: TypePreservingAggregation<TRecord, TResult>;
property min
min: TypePreservingAggregation<TRecord, TResult>;
property orderBy
orderBy: OrderBy<TRecord, TResult>;
property orderByRaw
orderByRaw: RawQueryBuilder<TRecord, TResult>;
property orHaving
orHaving: Having<TRecord, TResult>;
property orHavingBetween
orHavingBetween: HavingRange<TRecord, TResult>;
property orHavingNotBetween
orHavingNotBetween: HavingRange<TRecord, TResult>;
property orHavingNotIn
orHavingNotIn: HavingRange<TRecord, TResult>;
property orHavingNotNull
orHavingNotNull: HavingNull<TRecord, TResult>;
property orHavingNull
orHavingNull: HavingNull<TRecord, TResult>;
property orHavingRaw
orHavingRaw: RawQueryBuilder<TRecord, TResult>;
property orWhere
orWhere: Where<TRecord, TResult>;
property orWhereBetween
orWhereBetween: WhereBetween<TRecord, TResult>;
property orWhereExists
orWhereExists: WhereExists<TRecord, TResult>;
property orWhereILike
orWhereILike: Where<TRecord, TResult>;
property orWhereIn
orWhereIn: WhereIn<TRecord, TResult>;
property orWhereJsonNotSubsetOf
orWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
property orWhereJsonNotSupersetOf
orWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
property orWhereJsonObject
orWhereJsonObject: WhereJsonObject<TRecord, TResult>;
property orWhereJsonPath
orWhereJsonPath: WhereJsonPath<TRecord, TResult>;
property orWhereJsonSubsetOf
orWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
property orWhereJsonSupersetOf
orWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
property orWhereLike
orWhereLike: Where<TRecord, TResult>;
property orWhereNot
orWhereNot: Where<TRecord, TResult>;
property orWhereNotBetween
orWhereNotBetween: WhereBetween<TRecord, TResult>;
property orWhereNotExists
orWhereNotExists: WhereExists<TRecord, TResult>;
property orWhereNotIn
orWhereNotIn: WhereIn<TRecord, TResult>;
property orWhereNotJsonObject
orWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
property orWhereNotNull
orWhereNotNull: WhereNull<TRecord, TResult>;
property orWhereNull
orWhereNull: WhereNull<TRecord, TResult>;
property orWhereRaw
orWhereRaw: WhereRaw<TRecord, TResult>;
property outerJoin
outerJoin: Join<TRecord, TResult>;
property partitionBy
partitionBy: PartitionBy<TRecord, TResult>;
property rank
rank: AnalyticFunction<TRecord, TResult>;
property rightJoin
rightJoin: Join<TRecord, TResult>;
property rightOuterJoin
rightOuterJoin: Join<TRecord, TResult>;
property rowNumber
rowNumber: AnalyticFunction<TRecord, TResult>;
property select
select: Select<TRecord, TResult>;
property sum
sum: TypePreservingAggregation<TRecord, TResult>;
property sumDistinct
sumDistinct: TypePreservingAggregation<TRecord, TResult>;
property table
table: Table<TRecord, TResult>;
property union
union: Union<TRecord, TResult>;
property unionAll
unionAll: Union<TRecord, TResult>;
property updateFrom
updateFrom: Table<TRecord, TResult>;
property using
using: Using<TRecord, TResult>;
property where
where: Where<TRecord, TResult>;
property whereBetween
whereBetween: WhereBetween<TRecord, TResult>;
property whereExists
whereExists: WhereExists<TRecord, TResult>;
property whereILike
whereILike: Where<TRecord, TResult>;
property whereIn
whereIn: WhereIn<TRecord, TResult>;
property whereJsonNotSubsetOf
whereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
property whereJsonNotSupersetOf
whereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
property whereJsonObject
whereJsonObject: WhereJsonObject<TRecord, TResult>;
property whereJsonPath
whereJsonPath: WhereJsonPath<TRecord, TResult>;
property whereJsonSubsetOf
whereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
property whereJsonSupersetOf
whereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
property whereLike
whereLike: Where<TRecord, TResult>;
property whereNot
whereNot: Where<TRecord, TResult>;
property whereNotBetween
whereNotBetween: WhereBetween<TRecord, TResult>;
property whereNotExists
whereNotExists: WhereExists<TRecord, TResult>;
property whereNotIn
whereNotIn: WhereIn<TRecord, TResult>;
property whereNotJsonObject
whereNotJsonObject: WhereJsonObject<TRecord, TResult>;
property whereNotNull
whereNotNull: WhereNull<TRecord, TResult>;
property whereNull
whereNull: WhereNull<TRecord, TResult>;
property whereRaw
whereRaw: WhereRaw<TRecord, TResult>;
property whereWrapped
whereWrapped: WhereWrapped<TRecord, TResult>;
property with
with: With<TRecord, TResult>;
property withMaterialized
withMaterialized: With<TRecord, TResult>;
property withNotMaterialized
withNotMaterialized: With<TRecord, TResult>;
property withRaw
withRaw: WithRaw<TRecord, TResult>;
property withRecursive
withRecursive: With<TRecord, TResult>;
property withSchema
withSchema: WithSchema<TRecord, TResult>;
property withWrapped
withWrapped: WithWrapped<TRecord, TResult>;
method clear
clear: (statement: ClearStatements) => QueryBuilder<TRecord, TResult>;
method clearCounters
clearCounters: () => QueryBuilder<TRecord, TResult>;
method clearGroup
clearGroup: () => QueryBuilder<TRecord, TResult>;
method clearHaving
clearHaving: () => QueryBuilder<TRecord, TResult>;
method clearOrder
clearOrder: () => QueryBuilder<TRecord, TResult>;
method clearSelect
clearSelect: () => QueryBuilder< TRecord, UnwrapArrayMember<TResult> extends DeferredKeySelection< infer TBase, infer TKeys extends string, true, any, any, any, any > ? DeferredKeySelection<TBase, never, false, {}, false, {}, never>[] : TResult>;
method clearWhere
clearWhere: () => QueryBuilder<TRecord, TResult>;
method decrement
decrement: { (columnName: keyof TRecord, amount?: number): QueryBuilder<TRecord, number>; (columnName: string, amount?: number): QueryBuilder<TRecord, number>; (columns: { [column in keyof TRecord]: number }): QueryBuilder< TRecord, number >;};
method del
del: { (returning: '*', options?: DMLOptions): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<TRecord>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<TRecord>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2[]>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( returning: string | readonly string[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>(): QueryBuilder<TRecord, TResult2>;};
method delete
delete: { (returning: '*', options?: DMLOptions): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<TRecord>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = any>( returning: string | Raw<any> | readonly (string | Raw<any>)[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>(): QueryBuilder<TRecord, TResult2>;};
method increment
increment: { (columnName: keyof TRecord, amount?: number): QueryBuilder<TRecord, number>; (columnName: string, amount?: number): QueryBuilder<TRecord, number>; (columns: { [column in keyof TRecord]: number }): QueryBuilder< TRecord, number >;};
method insert
insert: { ( data: TRecord extends CompositeTableType<unknown> ? | ResolveTableType<TRecord, 'insert'> | ReadonlyArray<ResolveTableType<TRecord, 'insert'>> : DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>, returning: '*', options?: DMLOptions ): QueryBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number[]>( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[] ): QueryBuilder<TRecord, TResult2>;};
method limit
limit: ( limit: number, options?: string | Readonly<{ skipBinding?: boolean }>) => QueryBuilder<TRecord, TResult>;
method modify
modify: <TRecord2 extends {} = any, TResult2 extends {} = any>( callback: QueryCallbackWithArgs<TRecord, any>, ...args: any[]) => QueryBuilder<TRecord2, TResult2>;
method offset
offset: ( offset: number, options?: boolean | Readonly<{ skipBinding?: boolean }>) => QueryBuilder<TRecord, TResult>;
method onConflict
onConflict: { <TKey extends StrKey<ResolveTableType<TRecord, 'base'>>>( column: TKey ): OnConflictQueryBuilder<TRecord, TResult>; <TKey extends StrKey<ResolveTableType<TRecord, 'base'>>>( columns: readonly TKey[] ): OnConflictQueryBuilder<TRecord, TResult>; (columns: string): OnConflictQueryBuilder<TRecord, TResult>; (columns: string[]): OnConflictQueryBuilder<TRecord, TResult>; (raw: Raw<any>): OnConflictQueryBuilder<TRecord, TResult>; (): OnConflictQueryBuilder<TRecord, TResult>;};
method pluck
pluck: { <K extends keyof TRecord>(column: K): QueryBuilder<TRecord, TRecord[K][]>; <TResult2 extends {}>(column: string): QueryBuilder<TRecord, TResult2>;};
method returning
returning: { (column: '*', options?: DMLOptions): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( column: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.SetSingle< DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >, false >[] >( columns: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( column: string | Raw<any> | readonly (string | Raw<any>)[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>;};
method truncate
truncate: () => QueryBuilder<TRecord, void>;
method update
update: { < K1 extends StrKey<ResolveTableType<TRecord, 'update'>>, K2 extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, K2 >, {} >[] >( columnName: K1, value: DbColumn<ResolveTableType<TRecord, 'update'>[K1]>, returning: K2, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < K1 extends StrKey<ResolveTableType<TRecord, 'update'>>, K2 extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, K2 >, {} >[] >( columnName: K1, value: DbColumn<ResolveTableType<TRecord, 'update'>[K1]>, returning: readonly K2[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <K extends keyof TRecord>( columnName: K, value: DbColumn<TRecord[K]> ): QueryBuilder<TRecord, number>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( columnName: string, value: any, returning: string | readonly string[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; ( data: DbRecordArr<TRecord>, returning: '*', options?: DMLOptions ): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never, false, {}, false, {}, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string = string, TResult2 extends {}[] = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: TKey | readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 extends {}[] = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord> ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>(columnName: string, value: any): QueryBuilder< TRecord, TResult2 >;};
method upsert
upsert: { ( data: TRecord extends CompositeTableType<unknown> ? | ResolveTableType<TRecord, 'upsert'> | ReadonlyArray<ResolveTableType<TRecord, 'upsert'>> : DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>, returning: '*', options?: DMLOptions ): QueryBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number[]>( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[] ): QueryBuilder<TRecord, TResult2>;};
interface Raw
interface Raw<TResult = any> extends events.EventEmitter, ChainableInterface<ResolveResult<TResult>> {}
method queryContext
queryContext: { (context: any): Raw<TResult>; (): any };
method timeout
timeout: (ms: number, options?: { cancel?: boolean }) => Raw<TResult>;
method toSQL
toSQL: () => Sql;
method wrap
wrap: <TResult2 = TResult>(before: string, after: string) => Raw<TResult>;
interface RawBuilder
interface RawBuilder<TRecord extends {} = any, TResult = any> {}
call signature
<TResult2 = TResult>(value: Value): Raw<TResult2>;
call signature
<TResult2 = TResult>(sql: string, binding: RawBinding): Raw<TResult2>;
call signature
<TResult2 = TResult>( sql: string, bindings: readonly RawBinding[] | ValueDict): Raw<TResult2>;
interface RawQueryBuilder
interface RawQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<TResult2 = TResult>( sql: string, bindings?: readonly RawBinding[] | ValueDict | RawBinding): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = TResult>(raw: Raw<TResult2>): QueryBuilder<TRecord, TResult2>;
interface Ref
interface Ref<TSrc extends string, TMapping extends {}> extends Raw<string> {}
property [RefMemberTag]
[RefMemberTag]: { src: TSrc; mapping: TMapping;};
method as
as: <TAlias extends string>(alias: TAlias) => Ref<TSrc, { [K in TAlias]: TSrc }>;
method withSchema
withSchema: (schema: string) => this;
interface RefBuilder
interface RefBuilder {}
call signature
<TSrc extends string>(src: TSrc): Ref<TSrc, { [K in TSrc]: TSrc }>;
interface SchemaBuilder
interface SchemaBuilder extends ChainableInterface<void> {}
method alterTable
alterTable: ( tableName: string, callback: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method alterView
alterView: ( viewName: string, callback: (tableBuilder: AlterViewBuilder) => any) => SchemaBuilder;
method createMaterializedView
createMaterializedView: ( viewName: string, callback: (viewBuilder: ViewBuilder) => any) => SchemaBuilder;
method createSchema
createSchema: (schemaName: string) => SchemaBuilder;
method createSchemaIfNotExists
createSchemaIfNotExists: (schemaName: string) => SchemaBuilder;
method createTable
createTable: ( tableName: string, callback: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method createTableIfNotExists
createTableIfNotExists: ( tableName: string, callback: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method createTableLike
createTableLike: ( tableName: string, tableNameLike: string, callback?: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method createView
createView: ( viewName: string, callback: (viewBuilder: ViewBuilder) => any) => SchemaBuilder;
method createViewOrReplace
createViewOrReplace: ( viewName: string, callback: (viewBuilder: ViewBuilder) => any) => SchemaBuilder;
method dropMaterializedView
dropMaterializedView: (viewName: string) => SchemaBuilder;
method dropMaterializedViewIfExists
dropMaterializedViewIfExists: (viewName: string) => SchemaBuilder;
method dropSchema
dropSchema: (schemaName: string, cascade?: boolean) => SchemaBuilder;
method dropSchemaIfExists
dropSchemaIfExists: (schemaName: string, cascade?: boolean) => SchemaBuilder;
method dropTable
dropTable: (tableName: string) => SchemaBuilder;
method dropTableIfExists
dropTableIfExists: (tableName: string) => SchemaBuilder;
method dropView
dropView: (viewName: string) => SchemaBuilder;
method dropViewIfExists
dropViewIfExists: (viewName: string) => SchemaBuilder;
method hasColumn
hasColumn: (tableName: string, columnName: string) => Promise<boolean>;
method hasTable
hasTable: (tableName: string) => Promise<boolean>;
method queryContext
queryContext: (context: any) => SchemaBuilder;
method raw
raw: (statement: string) => SchemaBuilder;
method refreshMaterializedView
refreshMaterializedView: ( viewName: string, concurrently?: boolean) => SchemaBuilder;
method renameTable
renameTable: (oldTableName: string, newTableName: string) => Promise<void>;
method renameView
renameView: (oldViewName: string, newViewName: string) => SchemaBuilder;
method table
table: ( tableName: string, callback: (tableBuilder: AlterTableBuilder) => any) => SchemaBuilder;
method toSQL
toSQL: () => Sql[];
method toString
toString: () => string;
method view
view: ( viewName: string, callback: (viewBuilder: AlterViewBuilder) => any) => SchemaBuilder;
method withSchema
withSchema: (schemaName: string) => SchemaBuilder;
interface SeederConfig
interface SeederConfig<V extends {} = any> {}
property directory
directory?: string | readonly string[];
property extension
extension?: string;
property loadExtensions
loadExtensions?: readonly string[];
property recursive
recursive?: boolean;
property seedSource
seedSource?: SeedSource<unknown>;
property sortDirsSeparately
sortDirsSeparately?: boolean;
property specific
specific?: string;
property stub
stub?: string;
property timestampFilenamePrefix
timestampFilenamePrefix?: boolean;
property variables
variables?: V;
interface SeedSource
interface SeedSource<TSeedSpec> {}
interface Select
interface Select<TRecord extends {} = any, TResult = unknown[]> extends AliasQueryBuilder<TRecord, TResult>, ColumnNameQueryBuilder<TRecord, TResult> {}
call signature
(): QueryBuilder<TRecord, TResult>;
call signature
< TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends {} = any, TInnerResult = any>( ...subQueryBuilders: readonly QueryBuilder<TInnerRecord, TInnerResult>[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends {} = any, TInnerResult = any>( subQueryBuilders: readonly QueryBuilder<TInnerRecord, TInnerResult>[]): QueryBuilder<TRecord, TResult2>;
interface SocketConnectionConfig
interface SocketConnectionConfig {}
property database
database: string;
property debug
debug?: boolean;
property password
password: string;
property socketPath
socketPath: string;
property user
user: string;
method expirationChecker
expirationChecker: () => boolean;
interface Sql
interface Sql {}
interface Sqlite3ConnectionConfig
interface Sqlite3ConnectionConfig {}
Used with SQLite3 adapter
property debug
debug?: boolean;
property filename
filename: string;
property flags
flags?: string[];
method expirationChecker
expirationChecker: () => boolean;
interface SqlLiteColumnBuilder
interface SqlLiteColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ predicate?: QueryBuilder }>) => ColumnBuilder;
interface SqlNative
interface SqlNative {}
interface StringTagSupport
interface StringTagSupport {}
property [Symbol.toStringTag]
readonly [Symbol.toStringTag]: string;
interface Table
interface Table<TRecord extends {} = any, TResult = any> {}
call signature
< TTable extends TableNames, TRecord2 extends {} = TableType<TTable>, TResult2 = DeferredKeySelection.ReplaceBase< TResult, ResolveTableType<TRecord2> >>( tableName: TTable, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
call signature
< TRecord2 extends {} = {}, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
call signature
< TRecord2 extends {} = {}, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( callback: Function, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
call signature
< TRecord2 extends {} = {}, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( raw: Raw, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
interface TableBuilder
interface TableBuilder {}
method bigIncrements
bigIncrements: ( columnName?: string, options?: { primaryKey?: boolean }) => ColumnBuilder;
method bigint
bigint: (columnName: string) => ColumnBuilder;
method bigInteger
bigInteger: (columnName: string) => ColumnBuilder;
method binary
binary: (columnName: string, length?: number) => ColumnBuilder;
method boolean
boolean: (columnName: string) => ColumnBuilder;
method check
check: ( checkPredicate: string, bindings?: Record<string, any>, constraintName?: string) => TableBuilder;
method comment
comment: (val: string) => void;
method date
date: (columnName: string) => ColumnBuilder;
method datetime
datetime: ( columnName: string, options?: Readonly<{ useTz?: boolean; precision?: number }>) => ColumnBuilder;
method dateTime
dateTime: ( columnName: string, options?: Readonly<{ useTz?: boolean; precision?: number }>) => ColumnBuilder;
method decimal
decimal: ( columnName: string, precision?: number | null, scale?: number) => ColumnBuilder;
method double
double: ( columnName: string, precision?: number, scale?: number) => ColumnBuilder;
method dropChecks
dropChecks: (checkConstraintNames: string | string[]) => TableBuilder;
method dropColumn
dropColumn: (columnName: string) => TableBuilder;
method dropColumns
dropColumns: (...columnNames: string[]) => TableBuilder;
method dropForeign
dropForeign: ( columnNames: string | readonly string[], foreignKeyName?: string) => TableBuilder;
method dropIndex
dropIndex: ( columnNames: string | readonly (string | Raw)[], indexName?: string) => TableBuilder;
method dropNullable
dropNullable: (column: string) => TableBuilder;
method dropPrimary
dropPrimary: (constraintName?: string) => TableBuilder;
method dropTimestamps
dropTimestamps: (useCamelCase?: boolean) => TableBuilder;
method dropUnique
dropUnique: ( columnNames: readonly (string | Raw)[], indexName?: string) => TableBuilder;
method enu
enu: ( columnName: string, values: readonly Value[] | null, options?: EnumOptions) => ColumnBuilder;
method enum
enum: ( columnName: string, values: readonly Value[] | null, options?: EnumOptions) => ColumnBuilder;
method float
float: (columnName: string, precision?: number, scale?: number) => ColumnBuilder;
method foreign
foreign: { (column: string, foreignKeyName?: string): ForeignConstraintBuilder; ( columns: readonly string[], foreignKeyName?: string ): MultikeyForeignConstraintBuilder;};
method geography
geography: (columnName: string) => ColumnBuilder;
method geometry
geometry: (columnName: string) => ColumnBuilder;
method increments
increments: ( columnName?: string, options?: { primaryKey?: boolean }) => ColumnBuilder;
method index
index: { ( columnNames: string | readonly (string | Raw)[], indexName?: string, indexType?: string ): TableBuilder; ( columnNames: string | readonly (string | Raw<any>)[], indexName?: string, options?: Readonly<{ indexType?: string; storageEngineIndexType?: storageEngineIndexType; predicate?: QueryBuilder<any, any>; }> ): TableBuilder;};
method integer
integer: (columnName: string, length?: number) => ColumnBuilder;
method json
json: (columnName: string) => ColumnBuilder;
method jsonb
jsonb: (columnName: string) => ColumnBuilder;
method mediumint
mediumint: (columnName: string) => ColumnBuilder;
method point
point: (columnName: string) => ColumnBuilder;
method primary
primary: { ( columnNames: readonly string[], options?: Readonly<{ constraintName?: string; deferrable?: deferrableType; }> ): TableBuilder; (columnNames: readonly string[], constraintName?: string): TableBuilder;};
Deprecated
method queryContext
queryContext: (context: any) => TableBuilder;
method renameColumn
renameColumn: (from: string, to: string) => TableBuilder;
method setNullable
setNullable: (column: string) => TableBuilder;
method smallint
smallint: (columnName: string) => ColumnBuilder;
method specificType
specificType: (columnName: string, type: string) => ColumnBuilder;
method string
string: (columnName: string, length?: number) => ColumnBuilder;
method text
text: (columnName: string, textType?: string) => ColumnBuilder;
method time
time: (columnName: string) => ColumnBuilder;
method timestamp
timestamp: { ( columnName: string, options?: Readonly<{ useTz?: boolean; precision?: number }> ): ColumnBuilder; (columnName: string, withoutTz?: boolean, precision?: number): ColumnBuilder;};
Deprecated
method timestamps
timestamps: { ( useTimestamps?: boolean, defaultToNow?: boolean, useCamelCase?: boolean ): ColumnBuilder; ( options?: Readonly<{ useTimestamps?: boolean; defaultToNow?: boolean; useCamelCase?: boolean; }> ): void;};
method tinyint
tinyint: (columnName: string, length?: number) => ColumnBuilder;
method unique
unique: { ( columnNames: string | readonly (string | Raw)[], options?: Readonly<{ indexName?: string; storageEngineIndexType?: string; deferrable?: deferrableType; useConstraint?: boolean; predicate?: QueryBuilder; }> ): TableBuilder; ( columnNames: string | readonly (string | Raw<any>)[], indexName?: string ): TableBuilder;};
Deprecated
method uuid
uuid: ( columnName: string, options?: Readonly<{ useBinaryUuid?: boolean; primaryKey?: boolean }>) => ColumnBuilder;
interface Transaction
interface Transaction<TRecord extends {} = any, TResult = any[]> extends Knex<TRecord, TResult> {}
property executionPromise
executionPromise: Promise<TResult>;
property isCompleted
isCompleted: () => boolean;
property parentTransaction
parentTransaction?: Transaction;
method commit
commit: (value?: any) => QueryBuilder<TRecord, TResult>;
method query
query: <TRecord extends {} = any, TResult = void>( conn: any, sql: any, status: any, value: any) => QueryBuilder<TRecord, TResult>;
method rollback
rollback: (error?: any) => QueryBuilder<TRecord, TResult>;
method savepoint
savepoint: <T = any>(transactionScope: (trx: Transaction) => any) => Promise<T>;
interface TransactionConfig
interface TransactionConfig {}
property connection
connection?: any;
property doNotRejectOnRollback
doNotRejectOnRollback?: boolean;
property isolationLevel
isolationLevel?: IsolationLevels;
property readOnly
readOnly?: boolean;
property userParams
userParams?: Record<string, any>;
interface TypePreservingAggregation
interface TypePreservingAggregation< TRecord extends {} = any, TResult = unknown[], TValue = any> {}
call signature
< TKey extends keyof ResolveTableType<TRecord>, TOptions extends { as: string }, TResult2 = AggregationQueryResult< TResult, { [k in TOptions['as']]: ResolveTableType<TRecord>[TKey]; } >>( columnName: TKey, options: Readonly<TOptions>): QueryBuilder<TRecord, TResult2>;
call signature
< TKey extends keyof ResolveTableType<TRecord>, TResult2 = AggregationQueryResult< TResult, Dict<ResolveTableType<TRecord>[TKey]> >>( ...columnNames: readonly TKey[]): QueryBuilder<TRecord, TResult2>;
call signature
< TAliases extends {} = Readonly<Record<string, string | string[] | Knex.Raw>>, TResult2 = AggregationQueryResult< TResult, { // We have optional here because in most dialects aggregating by multiple keys simultaneously // causes rest of the keys to be dropped and only first to be considered [K in keyof TAliases]?: K extends keyof TRecord ? TRecord[K] : TValue; } >>( aliases: TAliases): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: ReadonlyArray< | Readonly<Record<string, string | readonly string[] | Knex.Raw>> | Knex.Raw | string >): QueryBuilder<TRecord, TResult2>;
interface Union
interface Union<TRecord extends {} = any, TResult = unknown[]> extends Intersect<TRecord, TResult> {}
interface Using
interface Using<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(tables: string[]): QueryBuilder<TRecord, TResult>;
interface ValueDict
interface ValueDict extends Dict<Value | Knex.QueryBuilder> {}
interface ViewBuilder
interface ViewBuilder<TRecord extends {} = any, TResult = any> {}
method as
as: (selectQuery: QueryBuilder) => ViewBuilder;
method cascadedCheckOption
cascadedCheckOption: () => Promise<void>;
method checkOption
checkOption: () => Promise<void>;
method columns
columns: (columns: any) => ViewBuilder;
method localCheckOption
localCheckOption: () => Promise<void>;
method queryContext
queryContext: (context: any) => ViewBuilder;
interface Where
interface Where<TRecord extends {} = any, TResult = unknown> extends WhereRaw<TRecord, TResult>, WhereWrapped<TRecord, TResult>, WhereNull<TRecord, TResult> {}
call signature
(raw: Raw): QueryBuilder<TRecord, TResult>;
call signature
(callback: QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult>;
call signature
(left: Raw, operator: string, right: Value | null): QueryBuilder< TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( left: Raw, operator: string, right: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
call signature
(object: DbRecord<ResolveTableType<TRecord>>): QueryBuilder<TRecord, TResult>;
call signature
(object: Readonly<Object>): QueryBuilder<TRecord, TResult>;
call signature
<T extends keyof ResolveTableType<TRecord>>( columnName: T, value: DbColumn<ResolveTableType<TRecord>[T]> | null): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, value: Value | null): QueryBuilder<TRecord, TResult>;
call signature
<T extends keyof ResolveTableType<TRecord>>( columnName: T, operator: ComparisonOperator, value: DbColumn<ResolveTableType<TRecord>[T]> | null): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, operator: string, value: Value | null): QueryBuilder< TRecord, TResult>;
call signature
< T extends keyof ResolveTableType<TRecord>, TRecordInner extends {}, TResultInner>( columnName: T, operator: ComparisonOperator, value: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( columnName: string, operator: string, value: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
interface WhereBetween
interface WhereBetween<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<K extends keyof TRecord>( columnName: K, range: readonly [DbColumn<TRecord[K]>, DbColumn<TRecord[K]>]): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, range: readonly [Value, Value]): QueryBuilder< TRecord, TResult>;
interface WhereExists
interface WhereExists<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(callback: QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( query: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
interface WhereIn
interface WhereIn<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<K extends keyof ResolveTableType<TRecord>>( columnName: K, values: readonly DbColumn<ResolveTableType<TRecord>[K]>[] | QueryCallback): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, values: readonly Value[] | QueryCallback): QueryBuilder< TRecord, TResult>;
call signature
<K extends keyof ResolveTableType<TRecord>>( columnNames: readonly K[], values: | readonly (readonly DbColumn<ResolveTableType<TRecord>[K]>[])[] | QueryCallback): QueryBuilder<TRecord, TResult>;
call signature
( columnNames: readonly string[], values: readonly Value[][] | QueryCallback): QueryBuilder<TRecord, TResult>;
call signature
<K extends keyof TRecord, TRecordInner extends {}, TResultInner>( columnName: K, values: QueryBuilder<TRecordInner, TRecord[K]>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( columnName: string, values: Value[] | QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
call signature
<K extends keyof TRecord, TRecordInner extends {}, TResultInner>( columnNames: readonly K[], values: QueryBuilder<TRecordInner, TRecord[K]>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( columnNames: readonly string[], values: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
interface WhereJsonObject
interface WhereJsonObject<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: keyof ResolveTableType<TRecord>, value: any): QueryBuilder< TRecord, TResult>;
interface WhereJsonPath
interface WhereJsonPath<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( columnName: keyof ResolveTableType<TRecord>, jsonPath: string, operator: string, value: any): QueryBuilder<TRecord, TResult>;
interface WhereNull
interface WhereNull<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface WhereRaw
interface WhereRaw<TRecord extends {} = any, TResult = unknown[]> extends RawQueryBuilder<TRecord, TResult> {}
call signature
(condition: boolean): QueryBuilder<TRecord, TResult>;
interface WhereWrapped
interface WhereWrapped<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(callback: QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult>;
interface With
interface With<TRecord extends {} = any, TResult = unknown[]> extends WithRaw<TRecord, TResult>, WithWrapped<TRecord, TResult> {}
interface WithRaw
interface WithRaw<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(alias: string, raw: Raw | QueryBuilder): QueryBuilder<TRecord, TResult>;
call signature
(alias: string, sql: string, bindings?: readonly Value[] | Object): QueryBuilder< TRecord, TResult>;
call signature
(alias: string, columnList: string[], raw: Raw | QueryBuilder): QueryBuilder< TRecord, TResult>;
call signature
( alias: string, columnList: string[], sql: string, bindings?: readonly Value[] | Object): QueryBuilder<TRecord, TResult>;
interface WithSchema
interface WithSchema<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(schema: string): QueryBuilder<TRecord, TResult>;
interface WithWrapped
interface WithWrapped<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(alias: string, queryBuilder: QueryBuilder): QueryBuilder<TRecord, TResult>;
call signature
(alias: string, callback: (queryBuilder: QueryBuilder) => any): QueryBuilder< TRecord, TResult>;
call signature
(alias: string, columnList: string[], queryBuilder: QueryBuilder): QueryBuilder< TRecord, TResult>;
call signature
( alias: string, columnList: string[], callback: (queryBuilder: QueryBuilder) => any): QueryBuilder<TRecord, TResult>;
type AsyncConnectionConfigProvider
type AsyncConnectionConfigProvider = () => Promise<StaticConnectionConfig>;
type ClearStatements
type ClearStatements = | 'with' | 'select' | 'columns' | 'hintComments' | 'where' | 'union' | 'using' | 'join' | 'group' | 'order' | 'having' | 'limit' | 'offset' | 'counter' | 'counters';
type ColumnDescriptor
type ColumnDescriptor<TRecord extends {}, TResult> = | string | Knex.Raw | Knex.QueryBuilder<TRecord, TResult> | Dict<string>;
type CompositeTableType
type CompositeTableType< TBase, TInsert = TBase, TUpdate = Partial<TInsert>, TUpsert = Partial<TInsert>> = { base: TBase; insert: TInsert; update: TUpdate; upsert: TUpsert;};
type ConnectionConfigProvider
type ConnectionConfigProvider = | SyncConnectionConfigProvider | AsyncConnectionConfigProvider;
type DbColumn
type DbColumn<TColumn> = Readonly<MaybeRawColumn<TColumn>>;
type DbRecord
type DbRecord<TRecord> = Readonly<SafePartial<MaybeRawRecord<TRecord>>>;
type DbRecordArr
type DbRecordArr<TRecord> = Readonly<MaybeArray<DbRecord<TRecord>>>;
type deferrableType
type deferrableType = 'not deferrable' | 'immediate' | 'deferred';
type ExposedPromiseKeys
type ExposedPromiseKeys = 'then' | 'catch' | 'finally';
type InferrableColumnDescriptor
type InferrableColumnDescriptor<TRecord extends {}> = | keyof TRecord | Knex.Ref<any, any> | Dict<keyof TRecord>;
type IntersectAliases
type IntersectAliases<AliasUT> = UnionToIntersection< IncompatibleToAlt< AliasUT extends (infer I)[] ? I extends Ref<any, infer TMapping> ? TMapping : I : never, Dict, {} >> & {};
type IsolationLevels
type IsolationLevels = | 'read uncommitted' | 'read committed' | 'snapshot' | 'repeatable read' | 'serializable';
type lengthOperator
type lengthOperator = '>' | '<' | '<=' | '>=' | '!=' | '=';
type LogFn
type LogFn = (message: any) => void;
type Lookup
type Lookup< TRegistry extends {}, TKey extends string, TDefault = never> = TKey extends keyof TRegistry ? TRegistry[TKey] : TDefault;
type MaybeRawColumn
type MaybeRawColumn<TColumn> = TColumn | Raw<TColumn>;
type MaybeRawRecord
type MaybeRawRecord<TRecord> = { [K in keyof TRecord]: MaybeRawColumn<TRecord[K]>;};
type MsSqlAuthenticationTypeOptions
type MsSqlAuthenticationTypeOptions = | 'default' | 'ntlm' | 'azure-active-directory-password' | 'azure-active-directory-access-token' | 'azure-active-directory-msi-vm' | 'azure-active-directory-msi-app-service' | 'azure-active-directory-service-principal-secret';
type MsSqlConnectionConfig
type MsSqlConnectionConfig = | MsSqlDefaultAuthenticationConfig | MsSqlNtlmAuthenticationConfig | MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig | MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig | MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig | MsSqlAzureActiveDirectoryPasswordAuthenticationConfig | MsSqlAzureActiveDirectoryServicePrincipalSecretConfig;
type PgGetTypeParser
type PgGetTypeParser = (oid: number, format: string) => any;
type QueryCallback
type QueryCallback<TRecord extends {} = any, TResult = unknown[]> = ( this: QueryBuilder<TRecord, TResult>, builder: QueryBuilder<TRecord, TResult>) => void;
type QueryCallbackWithArgs
type QueryCallbackWithArgs<TRecord extends {} = any, TResult = unknown[]> = ( this: QueryBuilder<TRecord, TResult>, builder: QueryBuilder<TRecord, TResult>, ...args: any[]) => void;
type RawBinding
type RawBinding = Value | QueryBuilder;
type RedshiftConnectionConfig
type RedshiftConnectionConfig = PgConnectionConfig;
type ReferencingColumnBuilder
type ReferencingColumnBuilder = { [K in keyof ColumnBuilder]: ( ...args: Parameters<ColumnBuilder[K]> ) => ReferencingColumnBuilder;} & { inTable(tableName: string): ReferencingColumnBuilder; deferrable(type: deferrableType): ReferencingColumnBuilder; withKeyName(keyName: string): ReferencingColumnBuilder; onDelete(command: string): ReferencingColumnBuilder; onUpdate(command: string): ReferencingColumnBuilder;};
type ResolveTableType
type ResolveTableType< TCompositeTableType, TScope extends TableInterfaceScope = 'base'> = TCompositeTableType extends CompositeTableType<{}> ? TCompositeTableType[TScope] : TCompositeTableType;
type StaticConnectionConfig
type StaticConnectionConfig = | ConnectionConfig | MariaSqlConnectionConfig | MySqlConnectionConfig | MySql2ConnectionConfig | MsSqlConnectionConfig | OracleDbConnectionConfig | PgConnectionConfig | RedshiftConnectionConfig | Sqlite3ConnectionConfig | BetterSqlite3ConnectionConfig | SocketConnectionConfig;
type storageEngineIndexType
type storageEngineIndexType = 'hash' | 'btree';
type SyncConnectionConfigProvider
type SyncConnectionConfigProvider = () => StaticConnectionConfig;
type TableDescriptor
type TableDescriptor = string | Knex.Raw | Knex.QueryBuilder;
type TableInterfaceScope
type TableInterfaceScope = keyof CompositeTableType<unknown>;
type TableNames
type TableNames = keyof Tables;
type TableType
type TableType<TTable extends keyof Tables> = Tables[TTable];
type TransactionProvider
type TransactionProvider = () => Promise<Transaction>;
type Value
type Value = | string | number | boolean | null | Date | Array<string> | Array<number> | Array<Date> | Array<boolean> | Buffer | object | Knex.Raw;
namespace knex.knex
namespace knex.knex {}
variable Client
const Client: typeof Knex.Client;
function knex
knex: typeof knex;
class ColumnBuilder
class ColumnBuilder {}
method extend
static extend: <T = Knex.ColumnBuilder, B = Knex.ColumnBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class KnexTimeoutError
class KnexTimeoutError extends Error {}
class QueryBuilder
class QueryBuilder {}
method extend
static extend: ( methodName: string, fn: <TRecord extends {} = any, TResult extends {} = unknown[]>( this: Knex.QueryBuilder<TRecord, TResult>, ...args: any[] ) => | Knex.QueryBuilder<TRecord, TResult> | Promise< | Knex.QueryBuilder<TRecord | TResult, any> | DeferredKeySelection.Resolve<TResult> >) => void;
class SchemaBuilder
class SchemaBuilder {}
method extend
static extend: <T = Knex.SchemaBuilder, B = Knex.SchemaBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class TableBuilder
class TableBuilder {}
method extend
static extend: <T = Knex.TableBuilder, B = Knex.TableBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class ViewBuilder
class ViewBuilder {}
method extend
static extend: <T = Knex.ViewBuilder<any, any>, B = Knex.ViewBuilder<any, any>>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
interface Knex
interface Knex<TRecord extends {} = any, TResult = any[]> extends Knex.QueryInterface<TRecord, TResult>, events.EventEmitter {}
property client
client: any;
property fn
fn: Knex.FunctionHelper;
property isTransaction
isTransaction?: boolean;
property migrate
migrate: Knex.Migrator;
property raw
raw: Knex.RawBuilder<TRecord>;
property ref
ref: Knex.RefBuilder;
property schema
schema: Knex.SchemaBuilder;
property seed
seed: Knex.Seeder;
property userParams
userParams: Record<string, any>;
property VERSION
VERSION: string;
method batchInsert
batchInsert: <TRecord2 extends {} = TRecord, TResult2 = number[]>( tableName: Knex.TableDescriptor, data: TRecord2 extends Knex.CompositeTableType<unknown> ? ReadonlyArray<Knex.ResolveTableType<TRecord2, 'insert'>> : ReadonlyArray<Knex.DbRecordArr<TRecord2>>, chunkSize?: number) => Knex.BatchInsertBuilder<TRecord2, TResult2>;
method destroy
destroy: { (callback: Function): void; (): Promise<void> };
method initialize
initialize: (config?: Knex.Config) => void;
method queryBuilder
queryBuilder: < TRecord2 extends {} = TRecord, TResult2 = TResult>() => Knex.QueryBuilder<TRecord2, TResult2>;
method transaction
transaction: { (config?: Knex.TransactionConfig): Promise<Knex.Transaction>; (transactionScope?: null, config?: Knex.TransactionConfig): Promise< Knex.Transaction<any, any[]> >; <T>( transactionScope: ( trx: Knex.Transaction<any, any[]> ) => void | Promise<T>, config?: Knex.TransactionConfig ): Promise<T>;};
method transactionProvider
transactionProvider: ( config?: Knex.TransactionConfig) => Knex.TransactionProvider;
method withUserParams
withUserParams: (params: Record<string, any>) => Knex;
call signature
<TTable extends Knex.TableNames>( tableName: TTable, options?: TableOptions): Knex.QueryBuilder< Knex.TableType<TTable>, DeferredKeySelection<Knex.ResolveTableType<Knex.TableType<TTable>>, never>[]>;
call signature
< TRecord2 extends {} = TRecord, TResult2 = DeferredKeySelection<TRecord2, never>[]>( tableName?: Knex.TableDescriptor | Knex.AliasDict, options?: TableOptions): Knex.QueryBuilder<TRecord2, TResult2>;
namespace knex.Knex
namespace knex.Knex {}
variable RefMemberTag
const RefMemberTag: Symbol;
class Client
class Client extends events.EventEmitter {}
constructor
constructor(config: Config<any>);
property canCancelQuery
canCancelQuery: boolean;
property config
config: Config<any>;
property connectionConfigExpirationChecker
connectionConfigExpirationChecker: () => boolean;
property connectionConfigProvider
connectionConfigProvider: any;
property connectionSettings
connectionSettings: {};
property dialect
dialect: string;
property driver
driver: any;
property driverName
driverName: string;
property logger
logger: Logger;
property pool
pool: any;
property valueForUndefined
valueForUndefined: any;
property version
version?: string;
method acquireConnection
acquireConnection: () => any;
method acquireRawConnection
acquireRawConnection: () => Promise<any>;
method assertCanCancelQuery
assertCanCancelQuery: () => void;
method cancelQuery
cancelQuery: () => void;
method columnBuilder
columnBuilder: (tableBuilder: any, type: any, args: any) => ColumnBuilder;
method columnCompiler
columnCompiler: (tableBuilder: any, columnBuilder: any) => any;
method customWrapIdentifier
customWrapIdentifier: (value: any, origImpl: any, queryContext: any) => any;
method database
database: () => any;
method destroy
destroy: (callback: any) => any;
method destroyRawConnection
destroyRawConnection: (connection: any) => Promise<void>;
method formatter
formatter: (builder: any) => any;
method getPoolSettings
getPoolSettings: (poolConfig: any) => any;
method initializeDriver
initializeDriver: () => void;
method initializePool
initializePool: (config?: {}) => void;
method poolDefaults
poolDefaults: () => { min: number; max: number; propagateCreateError: boolean };
method positionBindings
positionBindings: (sql: any) => any;
method postProcessResponse
postProcessResponse: (resp: any, queryContext: any) => any;
method prepBindings
prepBindings: (bindings: any) => any;
method query
query: (connection: any, obj: any) => any;
method queryBuilder
queryBuilder: () => QueryBuilder;
method queryCompiler
queryCompiler: (builder: any) => any;
method raw
raw: (...args: any[]) => any;
method ref
ref: (...args: any[]) => Ref<any, any>;
method releaseConnection
releaseConnection: (connection: any) => any;
method runner
runner: (builder: any) => any;
method schemaBuilder
schemaBuilder: () => SchemaBuilder;
method schemaCompiler
schemaCompiler: (builder: SchemaBuilder) => any;
method stream
stream: (connection: any, obj: any, stream: any, options: any) => any;
method tableBuilder
tableBuilder: ( type: any, tableName: any, tableNameLike: any, fn: any) => TableBuilder;
method tableCompiler
tableCompiler: (tableBuilder: any) => any;
method transaction
transaction: (container: any, config: any, outerTx: any) => Transaction;
method validateConnection
validateConnection: (connection: any) => Promise<boolean>;
method wrapIdentifier
wrapIdentifier: (value: any, queryContext: any) => any;
method wrapIdentifierImpl
wrapIdentifierImpl: (value: any) => string;
class Seeder
class Seeder {}
constructor
constructor(knex: Knex<any, any[]>);
method make
make: (name: string, config?: SeederConfig) => Promise<string>;
method run
run: (config?: SeederConfig) => Promise<[string[]]>;
method setConfig
setConfig: (config: SeederConfig) => SeederConfig;
interface AliasDict
interface AliasDict extends Dict<string> {}
interface AliasQueryBuilder
interface AliasQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( ...aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends (Dict | string)[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( ...aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends (Dict | string)[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, TRecord, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
interface AlterColumnBuilder
interface AlterColumnBuilder extends ColumnBuilder {}
interface AlterColumnView
interface AlterColumnView extends ViewBuilder {}
interface AlterTableBuilder
interface AlterTableBuilder extends TableBuilder {}
interface AlterViewBuilder
interface AlterViewBuilder extends ViewBuilder {}
method column
column: (column: string) => AlterColumnView;
interface AnalyticFunction
interface AnalyticFunction<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< TAlias extends string, TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>>( alias: TAlias, raw: Raw | QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult2>;
call signature
< TAlias extends string, TKey extends keyof ResolveTableType<TRecord>, TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>>( alias: TAlias, orderBy: | TKey | TKey[] | { column: TKey; order?: 'asc' | 'desc'; nulls?: 'first' | 'last'; }, partitionBy?: TKey | TKey[] | { column: TKey; order?: 'asc' | 'desc' }): QueryBuilder<TRecord, TResult2>;
interface As
interface As<TRecord extends {}, TResult> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface AsymmetricAggregation
interface AsymmetricAggregation< TRecord extends {} = any, TResult = unknown[], TValue = any> {}
call signature
< TOptions extends { as: string }, TResult2 = AggregationQueryResult<TResult, { [k in TOptions['as']]: TValue }>>( columnName: Readonly<keyof ResolveTableType<TRecord>>, options: Readonly<TOptions>): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: readonly (keyof ResolveTableType<TRecord>)[]): QueryBuilder<TRecord, TResult2>;
call signature
< TAliases extends {} = Record<string, string | string[] | Knex.Raw>, TResult2 = AggregationQueryResult< TResult, { [k in keyof TAliases]?: TValue } >>( aliases: TAliases): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: ReadonlyArray< | Readonly<Record<string, string | string[] | Knex.Raw>> | Knex.Raw | string >): QueryBuilder<TRecord, TResult2>;
interface BatchInsertBuilder
interface BatchInsertBuilder<TRecord extends {} = any, TResult = number[]> extends Promise<ResolveResult<TResult>> {}
method returning
returning: { (column: '*'): BatchInsertBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( column: TKey ): BatchInsertBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.SetSingle< DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >, false >[] >( columns: readonly TKey[] ): BatchInsertBuilder<TRecord, TResult2>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( column: unknown extends TRecord ? string | Raw<any> | readonly (string | Raw<any>)[] : never ): BatchInsertBuilder<TRecord, TResult2>;};
method transacting
transacting: (trx: Transaction) => this;
interface BetterSqlite3ConnectionConfig
interface BetterSqlite3ConnectionConfig {}
Used with
better-sqlite3
adapter
interface ChainableInterface
interface ChainableInterface<T = any> extends Pick<Promise<T>, keyof Promise<T> & ExposedPromiseKeys>, StringTagSupport {}
method asCallback
asCallback: (callback: Function) => Promise<T>;
method connection
connection: (connection: any) => this;
method debug
debug: (enabled: boolean) => this;
method generateDdlCommands
generateDdlCommands: () => Promise<{ pre: string[]; sql: string[]; check: string | null; post: string[];}>;
method options
options: (options: Readonly<{ [key: string]: any }>) => this;
method pipe
pipe: <T extends NodeJS.WritableStream>( writable: T, options?: Readonly<{ [key: string]: any }>) => stream.PassThrough;
method stream
stream: { (handler: (readable: stream.PassThrough) => any): Promise<any>; ( options: Readonly<{ [key: string]: any }>, handler: (readable: stream.PassThrough) => any ): Promise<any>; (options?: Readonly<{ [key: string]: any }>): any;};
method toQuery
toQuery: () => string;
method transacting
transacting: (trx: Transaction) => this;
interface ColumnBuilder
interface ColumnBuilder {}
method after
after: (columnName: string) => ColumnBuilder;
method alter
alter: ( options?: Readonly<{ alterNullable?: boolean; alterType?: boolean }>) => ColumnBuilder;
method checkBetween
checkBetween: ( values: any[] | any[][], constraintName?: string) => ColumnBuilder;
method checkIn
checkIn: (values: string[], constraintName?: string) => ColumnBuilder;
method checkLength
checkLength: ( operator: lengthOperator, length: number, constraintName?: string) => ColumnBuilder;
method checkNegative
checkNegative: (constraintName?: string) => ColumnBuilder;
method checkNotIn
checkNotIn: (values: string[], constraintName?: string) => ColumnBuilder;
method checkPositive
checkPositive: (constraintName?: string) => ColumnBuilder;
method checkRegex
checkRegex: (regex: string, constraintName?: string) => ColumnBuilder;
method collate
collate: (collation: string) => ColumnBuilder;
method comment
comment: (value: string) => ColumnBuilder;
method defaultTo
defaultTo: (value: Value | null, options?: DefaultToOptions) => ColumnBuilder;
method first
first: () => ColumnBuilder;
method index
index: (indexName?: string) => ColumnBuilder;
method notNullable
notNullable: () => ColumnBuilder;
method nullable
nullable: () => ColumnBuilder;
method primary
primary: { ( options?: Readonly<{ constraintName?: string; deferrable?: deferrableType; }> ): ColumnBuilder; (constraintName?: string): ColumnBuilder;};
Deprecated
method queryContext
queryContext: (context: any) => ColumnBuilder;
method references
references: (columnName: string) => ReferencingColumnBuilder;
method unique
unique: { ( options?: Readonly<{ indexName?: string; deferrable?: deferrableType }> ): ColumnBuilder; (indexName?: string): ColumnBuilder;};
Deprecated
method unsigned
unsigned: () => ColumnBuilder;
interface ColumnInfo
interface ColumnInfo {}
property defaultValue
defaultValue: Value;
property maxLength
maxLength: number;
property nullable
nullable: boolean;
property type
type: string;
interface ColumnNameQueryBuilder
interface ColumnNameQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: '*'): QueryBuilder< TRecord, ArrayIfAlready<TResult, DeferredKeySelection<TRecord, string>>>;
call signature
< ColNameUT extends keyof ResolveTableType<TRecord>, TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, ColNameUT & string >[]>( ...columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult2>;
call signature
< ColNameUT extends keyof ResolveTableType<TRecord>, TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, ColNameUT & string >[]>( columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, SafePartial<TRecord>, keyof TRecord & string >[]>( ...columnNames: readonly ColumnDescriptor<TRecord, TResult>[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, SafePartial<TRecord>, keyof TRecord & string >[]>( columnNames: readonly ColumnDescriptor<TRecord, TResult>[]): QueryBuilder<TRecord, TResult2>;
interface Comment
interface Comment<TRecord extends {} = any, TResult = any> {}
call signature
(comment: string): QueryBuilder<TRecord, TResult>;
interface Config
interface Config<SV extends {} = any> {}
property acquireConnectionTimeout
acquireConnectionTimeout?: number;
property asyncStackTraces
asyncStackTraces?: boolean;
property client
client?: string | typeof Client;
property compileSqlOnError
compileSqlOnError?: boolean;
property connection
connection?: string | StaticConnectionConfig | ConnectionConfigProvider;
property debug
debug?: boolean;
property dialect
dialect?: string;
property fetchAsString
fetchAsString?: string[];
property jsonbSupport
jsonbSupport?: boolean;
property log
log?: Logger;
property migrations
migrations?: MigratorConfig;
property pool
pool?: PoolConfig;
property postProcessResponse
postProcessResponse?: (result: any, queryContext: any) => any;
property searchPath
searchPath?: string | readonly string[];
property seeds
seeds?: SeederConfig<SV>;
property useNullAsDefault
useNullAsDefault?: boolean;
property version
version?: string;
property wrapIdentifier
wrapIdentifier?: ( value: string, origImpl: (value: string) => string, queryContext: any) => string;
interface ConnectionConfig
interface ConnectionConfig {}
property database
database: string;
property debug
debug?: boolean;
property domain
domain?: string;
property host
host: string;
property instanceName
instanceName?: string;
property password
password: string;
property requestTimeout
requestTimeout?: number;
property user
user: string;
interface CreateTableBuilder
interface CreateTableBuilder extends TableBuilder {}
interface DefaultToOptions
interface DefaultToOptions {}
property constraintName
constraintName?: string;
interface Distinct
interface Distinct<TRecord extends {}, TResult = {}[]> extends ColumnNameQueryBuilder<TRecord, TResult> {}
interface DistinctOn
interface DistinctOn<TRecord extends {}, TResult = {}[]> {}
call signature
<ColNameUT extends keyof TRecord>( ...columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult>;
call signature
<ColNameUT extends keyof TRecord>( columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult>;
call signature
(...columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
call signature
(columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
interface EnumOptions
interface EnumOptions {}
property enumName
enumName: string;
property existingType
existingType?: boolean;
property schemaName
schemaName?: string;
property useNative
useNative: boolean;
interface Except
interface Except<TRecord extends {} = any, TResult = unknown[]> extends Intersect<TRecord, TResult> {}
interface ForeignConstraintBuilder
interface ForeignConstraintBuilder {}
method references
references: (columnName: string) => ReferencingColumnBuilder;
interface FunctionHelper
interface FunctionHelper {}
interface GroupBy
interface GroupBy<TRecord extends {} = any, TResult = unknown[]> extends RawQueryBuilder<TRecord, TResult>, ColumnNameQueryBuilder<TRecord, TResult> {}
interface Having
interface Having<TRecord extends {} = any, TResult = unknown[]> extends WhereWrapped<TRecord, TResult> {}
call signature
<K extends keyof TRecord>( column: K, operator: ComparisonOperator, value: DbColumn<TRecord[K]>): QueryBuilder<TRecord, TResult>;
call signature
( column: string | Raw, operator: string, value: Value | QueryBuilder | null): QueryBuilder<TRecord, TResult>;
call signature
(raw: Raw): QueryBuilder<TRecord, TResult>;
interface HavingNull
interface HavingNull<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface HavingRange
interface HavingRange<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<K extends keyof TRecord>( columnName: K, values: readonly DbColumn<TRecord[K]>[]): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, values: readonly Value[]): QueryBuilder<TRecord, TResult>;
interface HintComment
interface HintComment<TRecord extends {} = any, TResult = any> {}
call signature
(hint: string): QueryBuilder<TRecord, TResult>;
call signature
(hints: readonly string[]): QueryBuilder<TRecord, TResult>;
interface Intersect
interface Intersect<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( callback: MaybeArray<QueryCallback | QueryBuilder<TRecord> | Raw>, wrap?: boolean): QueryBuilder<TRecord, TResult>;
call signature
( ...callbacks: readonly (QueryCallback | Raw | QueryBuilder<TRecord>)[]): QueryBuilder<TRecord, TResult>;
interface Join
interface Join<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable extends TableNames, TRecord2 extends {} = ResolveTableType<TRecord> & ResolveTableType<TableType<TTable>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable, clause: JoinCallback): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable2}.${TKey2}`, operator: string, column2: `${TTable1}.${TKey1}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, operator: string, column2: string): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, clause: JoinCallback): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, columns: { [key: string]: string | number | boolean | Raw }): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable1}.${TKey1}`, column2: `${TTable2}.${TKey2}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable2}.${TKey2}`, column2: `${TTable1}.${TKey1}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, column2: string): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable1}.${TKey1}`, operator: string, column2: `${TTable2}.${TKey2}`): QueryBuilder<TRecord2, TResult2>;
interface JoinCallback
interface JoinCallback {}
call signature
(this: JoinClause, join: JoinClause): void;
interface JoinClause
interface JoinClause {}
method andOn
andOn: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method andOnBetween
andOnBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method andOnExists
andOnExists: (callback: QueryCallback) => JoinClause;
method andOnIn
andOnIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method andOnNotBetween
andOnNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method andOnNotExists
andOnNotExists: (callback: QueryCallback) => JoinClause;
method andOnNotIn
andOnNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method andOnNotNull
andOnNotNull: (column1: string) => JoinClause;
method andOnNull
andOnNull: (column1: string) => JoinClause;
method andOnVal
andOnVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method on
on: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method onBetween
onBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method onExists
onExists: (callback: QueryCallback) => JoinClause;
method onIn
onIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method onJsonPathEquals
onJsonPathEquals: ( columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string) => JoinClause;
method onNotBetween
onNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method onNotExists
onNotExists: (callback: QueryCallback) => JoinClause;
method onNotIn
onNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method onNotNull
onNotNull: (column1: string) => JoinClause;
method onNull
onNull: (column1: string) => JoinClause;
method onVal
onVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method orOn
orOn: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method orOnBetween
orOnBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method orOnExists
orOnExists: (callback: QueryCallback) => JoinClause;
method orOnIn
orOnIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method orOnJsonPathEquals
orOnJsonPathEquals: ( columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string) => JoinClause;
method orOnNotBetween
orOnNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method orOnNotExists
orOnNotExists: (callback: QueryCallback) => JoinClause;
method orOnNotIn
orOnNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method orOnNotNull
orOnNotNull: (column1: string) => JoinClause;
method orOnNull
orOnNull: (column1: string) => JoinClause;
method orOnVal
orOnVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method type
type: (type: string) => JoinClause;
method using
using: ( column: | string | readonly string[] | Raw<any> | { [key: string]: string | Raw<any> }) => JoinClause;
interface JoinRaw
interface JoinRaw<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(tableName: string, binding?: Value | Value[] | ValueDict): QueryBuilder< TRecord, TResult>;
interface JsonExtract
interface JsonExtract<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, alias?: string, singleValue?: boolean): QueryBuilder<TRecord, TResult>;
call signature
(column: JsonExtraction[] | any[][], singleValue?: boolean): QueryBuilder< TRecord, TResult>;
interface JsonExtraction
interface JsonExtraction {}
property alias
alias?: string;
property column
column: string | Raw | QueryBuilder;
property path
path: string;
property singleValue
singleValue?: boolean;
interface JsonInsert
interface JsonInsert<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
interface JsonRemove
interface JsonRemove<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, alias?: string): QueryBuilder<TRecord, TResult>;
interface JsonSet
interface JsonSet<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
interface Logger
interface Logger {}
property debug
debug?: LogFn;
property deprecate
deprecate?: (method: string, alternative: string) => void;
property enableColors
enableColors?: boolean;
property error
error?: LogFn;
property inspectionDepth
inspectionDepth?: number;
property warn
warn?: LogFn;
interface MariaSqlConnectionConfig
interface MariaSqlConnectionConfig {}
property charset
charset?: string;
property compress
compress?: boolean;
property connTimeout
connTimeout?: number;
property db
db?: string;
property host
host?: string;
property keepQueries
keepQueries?: boolean;
property local_infile
local_infile?: boolean;
property multiStatements
multiStatements?: boolean;
property password
password?: string;
property pingInterval
pingInterval?: number;
property port
port?: number;
property protocol
protocol?: string;
property read_default_file
read_default_file?: string;
property read_default_group
read_default_group?: string;
property secureAuth
secureAuth?: boolean;
property ssl
ssl?: boolean | MariaSslConfiguration;
property streamHWM
streamHWM?: number;
property unixSocket
unixSocket?: string;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface MariaSslConfiguration
interface MariaSslConfiguration {}
property ca
ca?: string;
property capath
capath?: string;
property cert
cert?: string;
property cipher
cipher?: string;
property key
key?: string;
property rejectUnauthorized
rejectUnauthorized?: boolean;
method expirationChecker
expirationChecker: () => boolean;
interface Migration
interface Migration {}
interface MigrationSource
interface MigrationSource<TMigrationSpec> {}
method getMigration
getMigration: (migration: TMigrationSpec) => Promise<Migration>;
method getMigrationName
getMigrationName: (migration: TMigrationSpec) => string;
method getMigrations
getMigrations: (loadExtensions: readonly string[]) => Promise<TMigrationSpec[]>;
interface Migrator
interface Migrator {}
method currentVersion
currentVersion: (config?: MigratorConfig) => Promise<string>;
method down
down: (config?: MigratorConfig) => Promise<any>;
method forceFreeMigrationsLock
forceFreeMigrationsLock: (config?: MigratorConfig) => Promise<any>;
method latest
latest: (config?: MigratorConfig) => Promise<any>;
method list
list: (config?: MigratorConfig) => Promise<any>;
method make
make: (name: string, config?: MigratorConfig) => Promise<string>;
method rollback
rollback: (config?: MigratorConfig, all?: boolean) => Promise<any>;
method status
status: (config?: MigratorConfig) => Promise<number>;
method up
up: (config?: MigratorConfig) => Promise<any>;
interface MigratorConfig
interface MigratorConfig {}
property database
database?: string;
property directory
directory?: string | readonly string[];
property disableMigrationsListValidation
disableMigrationsListValidation?: boolean;
property disableTransactions
disableTransactions?: boolean;
property extension
extension?: string;
property loadExtensions
loadExtensions?: readonly string[];
property migrationSource
migrationSource?: MigrationSource<unknown>;
property name
name?: string;
property schemaName
schemaName?: string;
property sortDirsSeparately
sortDirsSeparately?: boolean;
property stub
stub?: string;
property tableName
tableName?: string;
interface MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
interface MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
interface MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId?: string;
If you user want to connect to an Azure app service using a specific client account they need to provide
clientId
asscoiate to their created idnetity.This is optional for retrieve token from azure web app service
property msiEndpoint
msiEndpoint?: string;
A msi app service environment need to provide
msiEndpoint
for retriving the accesstoken.
property msiSecret
msiSecret?: string;
A msi app service environment need to provide
msiSecret
for retriving the accesstoken.
property type
type: 'azure-active-directory-msi-app-service';
interface MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
interface MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId?: string;
If you user want to connect to an Azure app service using a specific client account they need to provide
clientId
asscoiate to their created idnetity.This is optional for retrieve token from azure web app service
property msiEndpoint
msiEndpoint?: string;
A user need to provide
msiEndpoint
for retriving the accesstoken.
property type
type: 'azure-active-directory-msi-vm';
interface MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
interface MsSqlAzureActiveDirectoryPasswordAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
interface MsSqlAzureActiveDirectoryServicePrincipalSecretConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId: string;
Application (
client
) ID from your registered Azure application
property clientSecret
clientSecret: string;
The created
client secret
for this registered Azure application
property tenantId
tenantId: string;
Directory (
tenant
) ID from your registered Azure application
property type
type: 'azure-active-directory-service-principal-secret';
interface MsSqlColumnBuilder
interface MsSqlColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ predicate?: QueryBuilder }>) => ColumnBuilder;
interface MsSqlConnectionConfigBase
interface MsSqlConnectionConfigBase {}
property connectionTimeout
connectionTimeout?: number;
property database
database: string;
property domain
domain?: string;
property driver
driver?: string;
property options
options?: Readonly<{ encrypt?: boolean; instanceName?: string; useUTC?: boolean; tdsVersion?: string; appName?: string; abortTransactionOnError?: boolean; trustedConnection?: boolean; enableArithAbort?: boolean; isolationLevel?: | 'READ_UNCOMMITTED' | 'READ_COMMITTED' | 'REPEATABLE_READ' | 'SERIALIZABLE' | 'SNAPSHOT'; maxRetriesOnTransientErrors?: number; multiSubnetFailover?: boolean; packetSize?: number; trustServerCertificate?: boolean; mapBinding?: (value: any) => { value: any; type: any } | undefined;}>;
property parseJSON
parseJSON?: boolean;
property password
password?: string;
property pool
pool?: Readonly<{ min?: number; max?: number; idleTimeoutMillis?: number; maxWaitingClients?: number; testOnBorrow?: boolean; acquireTimeoutMillis?: number; fifo?: boolean; priorityRange?: number; autostart?: boolean; evictionRunIntervalMillis?: number; numTestsPerRun?: number; softIdleTimeoutMillis?: number; Promise?: any;}>;
property port
port?: number;
property requestTimeout
requestTimeout?: number;
property server
server: string;
property stream
stream?: boolean;
property type
type?: MsSqlAuthenticationTypeOptions;
property userName
userName?: string;
method expirationChecker
expirationChecker: () => boolean;
interface MsSqlDefaultAuthenticationConfig
interface MsSqlDefaultAuthenticationConfig extends MsSqlConnectionConfigBase {}
property type
type?: 'default' | never;
interface MsSqlNtlmAuthenticationConfig
interface MsSqlNtlmAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MultikeyForeignConstraintBuilder
interface MultikeyForeignConstraintBuilder {}
method references
references: (columnNames: readonly string[]) => ReferencingColumnBuilder;
interface MySql2ConnectionConfig
interface MySql2ConnectionConfig extends MySqlConnectionConfig {}
property authPlugins
authPlugins?: { [pluginName: string]: (pluginMetadata: any) => (pluginData: any) => any;};
property authSwitchHandler
authSwitchHandler?: (data: any, callback: () => void) => any;
property charsetNumber
charsetNumber?: number;
property compress
compress?: boolean;
property connectAttributes
connectAttributes?: { [attrNames: string]: any };
property enableKeepAlive
enableKeepAlive?: boolean;
property keepAliveInitialDelay
keepAliveInitialDelay?: number;
property maxPreparedStatements
maxPreparedStatements?: number;
property namedPlaceholders
namedPlaceholders?: boolean;
property nestTables
nestTables?: boolean | string;
property passwordSha1
passwordSha1?: string;
property rowsAsArray
rowsAsArray?: boolean;
property stream
stream?: boolean | ((opts: any) => Stream) | Stream;
property uri
uri?: string;
interface MySqlAlterColumnBuilder
interface MySqlAlterColumnBuilder extends AlterColumnBuilder {}
interface MySqlColumnBuilder
interface MySqlColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ indexType?: string; storageEngineIndexType?: storageEngineIndexType; }>) => ColumnBuilder;
interface MySqlConnectionConfig
interface MySqlConnectionConfig {}
property bigNumberStrings
bigNumberStrings?: boolean;
property charset
charset?: string;
property connectTimeout
connectTimeout?: number;
property database
database?: string;
property dateStrings
dateStrings?: boolean;
property debug
debug?: boolean;
property decimalNumbers
decimalNumbers?: boolean;
property flags
flags?: string;
property host
host?: string;
property insecureAuth
insecureAuth?: boolean;
property localAddress
localAddress?: string;
property multipleStatements
multipleStatements?: boolean;
property password
password?: string;
property port
port?: number;
property queryFormat
queryFormat?: (query: string, values: any) => string;
property socketPath
socketPath?: string;
property ssl
ssl?: string | MariaSslConfiguration;
property stringifyObjects
stringifyObjects?: boolean;
property supportBigNumbers
supportBigNumbers?: boolean;
property timezone
timezone?: string;
property trace
trace?: boolean;
property typeCast
typeCast?: any;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface OnConflictQueryBuilder
interface OnConflictQueryBuilder<TRecord extends {}, TResult> {}
method ignore
ignore: () => QueryBuilder<TRecord, TResult>;
method merge
merge: { (mergeColumns?: (keyof ResolveTableType<TRecord, 'update'>)[]): QueryBuilder< TRecord, TResult >; ( data?: Extract< Readonly< Partial< AnyOrUnknownToOther< MaybeRawRecord<ResolveTableType<TRecord, 'update'>>, {} > > >, object > ): QueryBuilder<TRecord, TResult>;};
interface OracleDbConnectionConfig
interface OracleDbConnectionConfig {}
property connectString
connectString?: string;
property database
database?: string;
property debug
debug?: boolean;
property domain
domain?: string;
property host
host: string;
property instanceName
instanceName?: string;
property password
password?: string;
property requestTimeout
requestTimeout?: number;
property user
user: string;
method expirationChecker
expirationChecker: () => boolean;
interface OrderBy
interface OrderBy<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( columnName: keyof TRecord | QueryBuilder, order?: 'asc' | 'desc', nulls?: 'first' | 'last'): QueryBuilder<TRecord, TResult>;
call signature
( columnName: string | QueryBuilder, order?: string, nulls?: string): QueryBuilder<TRecord, TResult>;
call signature
( columnDefs: Array< | keyof TRecord | Readonly<{ column: keyof TRecord | QueryBuilder; order?: 'asc' | 'desc'; nulls?: 'first' | 'last'; }> >): QueryBuilder<TRecord, TResult>;
call signature
( columnDefs: Array< | string | Readonly<{ column: string | QueryBuilder; order?: string; nulls?: string; }> >): QueryBuilder<TRecord, TResult>;
interface PartitionBy
interface PartitionBy<TRecord extends {} = any, TResult = unknown[]> extends OrderBy<TRecord, TResult> {}
interface PgConnectionConfig
interface PgConnectionConfig {}
property application_name
application_name?: string;
property connectionString
connectionString?: string;
property connectionTimeoutMillis
connectionTimeoutMillis?: number;
property database
database?: string;
property host
host?: string;
property idle_in_transaction_session_timeout
idle_in_transaction_session_timeout?: number;
property keepAlive
keepAlive?: boolean;
property keepAliveInitialDelayMillis
keepAliveInitialDelayMillis?: number;
property options
options?: string;
property parseInputDatesAsUTC
parseInputDatesAsUTC?: boolean;
property password
password?: string | (() => string | Promise<string>);
property port
port?: number;
property query_timeout
query_timeout?: number;
property ssl
ssl?: boolean | ConnectionOptions;
property statement_timeout
statement_timeout?: false | number;
property stream
stream?: () => stream.Duplex | stream.Duplex | undefined;
property types
types?: PgCustomTypesConfig;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface PgCustomTypesConfig
interface PgCustomTypesConfig {}
property getTypeParser
getTypeParser: PgGetTypeParser;
interface PoolConfig
interface PoolConfig {}
property acquireTimeoutMillis
acquireTimeoutMillis?: number;
property afterCreate
afterCreate?: Function;
property createRetryIntervalMillis
createRetryIntervalMillis?: number;
property createTimeoutMillis
createTimeoutMillis?: number;
property destroyTimeoutMillis
destroyTimeoutMillis?: number;
property idleTimeoutMillis
idleTimeoutMillis?: number;
property log
log?: (message: string, logLevel: string) => void;
property max
max?: number;
property min
min?: number;
property name
name?: string;
property priorityRange
priorityRange?: number;
property propagateCreateError
propagateCreateError?: boolean;
property reapIntervalMillis
reapIntervalMillis?: number;
property refreshIdle
refreshIdle?: boolean;
property returnToHead
returnToHead?: boolean;
interface PostgreSqlColumnBuilder
interface PostgreSqlColumnBuilder extends ColumnBuilder {}
method index
index: { ( indexName?: string, options?: Readonly<{ indexType?: string; predicate?: QueryBuilder }> ): ColumnBuilder; (indexName?: string, indexType?: string): ColumnBuilder;};
interface QueryBuilder
interface QueryBuilder<TRecord extends {} = any, TResult = any> extends QueryInterface<TRecord, TResult>, ChainableInterface<ResolveResult<TResult>> {}
property and
and: QueryBuilder<TRecord, TResult>;
property client
client: Client;
property not
not: QueryBuilder<TRecord, TResult>;
property or
or: QueryBuilder<TRecord, TResult>;
method clone
clone: () => QueryBuilder<TRecord, TResult>;
method columnInfo
columnInfo: { (column: keyof DeferredKeySelection.Resolve<TRecord>): Promise<ColumnInfo>; (): Promise<Record<keyof DeferredKeySelection.Resolve<TRecord>, ColumnInfo>>;};
method forKeyShare
forKeyShare: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forNoKeyUpdate
forNoKeyUpdate: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forShare
forShare: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forUpdate
forUpdate: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method noWait
noWait: () => QueryBuilder<TRecord, TResult>;
method on
on: (event: string, callback: Function) => QueryBuilder<TRecord, TResult>;
method queryContext
queryContext: { (context: any): QueryBuilder<TRecord, TResult>; (): any };
method skipLocked
skipLocked: () => QueryBuilder<TRecord, TResult>;
method timeout
timeout: ( ms: number, options?: { cancel?: boolean }) => QueryBuilder<TRecord, TResult>;
method toSQL
toSQL: () => Sql;
interface QueryInterface
interface QueryInterface<TRecord extends {} = any, TResult = any> {}
property andHaving
andHaving: Having<TRecord, TResult>;
property andHavingNotIn
andHavingNotIn: HavingRange<TRecord, TResult>;
property andWhere
andWhere: Where<TRecord, TResult>;
property andWhereBetween
andWhereBetween: WhereBetween<TRecord, TResult>;
property andWhereILike
andWhereILike: Where<TRecord, TResult>;
property andWhereJsonNotSubsetOf
andWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonNotSupersetOf
andWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonObject
andWhereJsonObject: WhereJsonObject<TRecord, TResult>;
property andWhereJsonPath
andWhereJsonPath: WhereJsonPath<TRecord, TResult>;
property andWhereJsonSubsetOf
andWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonSupersetOf
andWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
property andWhereLike
andWhereLike: Where<TRecord, TResult>;
property andWhereNot
andWhereNot: Where<TRecord, TResult>;
property andWhereNotBetween
andWhereNotBetween: WhereBetween<TRecord, TResult>;
property andWhereNotJsonObject
andWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
property andWhereRaw
andWhereRaw: WhereRaw<TRecord, TResult>;
property as
as: As<TRecord, TResult>;
property avg
avg: TypePreservingAggregation<TRecord, TResult>;
property avgDistinct
avgDistinct: TypePreservingAggregation<TRecord, TResult>;
property column
column: Select<TRecord, TResult>;
property columns
columns: Select<TRecord, TResult>;
property comment
comment: Comment<TRecord, TResult>;
property count
count: AsymmetricAggregation< TRecord, TResult, Lookup<ResultTypes.Registry, 'Count', number | string>>;
property countDistinct
countDistinct: AsymmetricAggregation< TRecord, TResult, Lookup<ResultTypes.Registry, 'Count', number | string>>;
property crossJoin
crossJoin: Join<TRecord, TResult>;
property denseRank
denseRank: AnalyticFunction<TRecord, TResult>;
property distinct
distinct: Distinct<TRecord, TResult>;
property distinctOn
distinctOn: DistinctOn<TRecord, TResult>;
property except
except: Except<TRecord, TResult>;
property first
first: Select< TRecord, DeferredKeySelection.AddUnionMember<UnwrapArrayMember<TResult>, undefined>>;
property from
from: Table<TRecord, TResult>;
property fromRaw
fromRaw: Table<TRecord, TResult>;
property fullOuterJoin
fullOuterJoin: Join<TRecord, TResult>;
property groupBy
groupBy: GroupBy<TRecord, TResult>;
property groupByRaw
groupByRaw: RawQueryBuilder<TRecord, TResult>;
property having
having: Having<TRecord, TResult>;
property havingBetween
havingBetween: HavingRange<TRecord, TResult>;
property havingIn
havingIn: HavingRange<TRecord, TResult>;
property havingNotBetween
havingNotBetween: HavingRange<TRecord, TResult>;
property havingNotIn
havingNotIn: HavingRange<TRecord, TResult>;
property havingNotNull
havingNotNull: HavingNull<TRecord, TResult>;
property havingNull
havingNull: HavingNull<TRecord, TResult>;
property havingRaw
havingRaw: RawQueryBuilder<TRecord, TResult>;
property havingWrapped
havingWrapped: WhereWrapped<TRecord, TResult>;
property hintComment
hintComment: HintComment<TRecord, TResult>;
property innerJoin
innerJoin: Join<TRecord, TResult>;
property intersect
intersect: Intersect<TRecord, TResult>;
property into
into: Table<TRecord, TResult>;
property join
join: Join<TRecord, TResult>;
property joinRaw
joinRaw: JoinRaw<TRecord, TResult>;
property jsonExtract
jsonExtract: JsonExtract<TRecord, TResult>;
property jsonInsert
jsonInsert: JsonInsert<TRecord, TResult>;
property jsonRemove
jsonRemove: JsonRemove<TRecord, TResult>;
property jsonSet
jsonSet: JsonSet<TRecord, TResult>;
property leftJoin
leftJoin: Join<TRecord, TResult>;
property leftOuterJoin
leftOuterJoin: Join<TRecord, TResult>;
property max
max: TypePreservingAggregation<TRecord, TResult>;
property min
min: TypePreservingAggregation<TRecord, TResult>;
property orderBy
orderBy: OrderBy<TRecord, TResult>;
property orderByRaw
orderByRaw: RawQueryBuilder<TRecord, TResult>;
property orHaving
orHaving: Having<TRecord, TResult>;
property orHavingBetween
orHavingBetween: HavingRange<TRecord, TResult>;
property orHavingNotBetween
orHavingNotBetween: HavingRange<TRecord, TResult>;
property orHavingNotIn
orHavingNotIn: HavingRange<TRecord, TResult>;
property orHavingNotNull
orHavingNotNull: HavingNull<TRecord, TResult>;
property orHavingNull
orHavingNull: HavingNull<TRecord, TResult>;
property orHavingRaw
orHavingRaw: RawQueryBuilder<TRecord, TResult>;
property orWhere
orWhere: Where<TRecord, TResult>;
property orWhereBetween
orWhereBetween: WhereBetween<TRecord, TResult>;
property orWhereExists
orWhereExists: WhereExists<TRecord, TResult>;
property orWhereILike
orWhereILike: Where<TRecord, TResult>;
property orWhereIn
orWhereIn: WhereIn<TRecord, TResult>;
property orWhereJsonNotSubsetOf
orWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
property orWhereJsonNotSupersetOf
orWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
property orWhereJsonObject
orWhereJsonObject: WhereJsonObject<TRecord, TResult>;
property orWhereJsonPath
orWhereJsonPath: WhereJsonPath<TRecord, TResult>;
property orWhereJsonSubsetOf
orWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
property orWhereJsonSupersetOf
orWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
property orWhereLike
orWhereLike: Where<TRecord, TResult>;
property orWhereNot
orWhereNot: Where<TRecord, TResult>;
property orWhereNotBetween
orWhereNotBetween: WhereBetween<TRecord, TResult>;
property orWhereNotExists
orWhereNotExists: WhereExists<TRecord, TResult>;
property orWhereNotIn
orWhereNotIn: WhereIn<TRecord, TResult>;
property orWhereNotJsonObject
orWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
property orWhereNotNull
orWhereNotNull: WhereNull<TRecord, TResult>;
property orWhereNull
orWhereNull: WhereNull<TRecord, TResult>;
property orWhereRaw
orWhereRaw: WhereRaw<TRecord, TResult>;
property outerJoin
outerJoin: Join<TRecord, TResult>;
property partitionBy
partitionBy: PartitionBy<TRecord, TResult>;
property rank
rank: AnalyticFunction<TRecord, TResult>;
property rightJoin
rightJoin: Join<TRecord, TResult>;
property rightOuterJoin
rightOuterJoin: Join<TRecord, TResult>;
property rowNumber
rowNumber: AnalyticFunction<TRecord, TResult>;
property select
select: Select<TRecord, TResult>;
property sum
sum: TypePreservingAggregation<TRecord, TResult>;
property sumDistinct
sumDistinct: TypePreservingAggregation<TRecord, TResult>;
property table
table: Table<TRecord, TResult>;
property union
union: Union<TRecord, TResult>;
property unionAll
unionAll: Union<TRecord, TResult>;
property updateFrom
updateFrom: Table<TRecord, TResult>;
property using
using: Using<TRecord, TResult>;
property where
where: Where<TRecord, TResult>;
property whereBetween
whereBetween: WhereBetween<TRecord, TResult>;
property whereExists
whereExists: WhereExists<TRecord, TResult>;
property whereILike
whereILike: Where<TRecord, TResult>;
property whereIn
whereIn: WhereIn<TRecord, TResult>;
property whereJsonNotSubsetOf
whereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
property whereJsonNotSupersetOf
whereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
property whereJsonObject
whereJsonObject: WhereJsonObject<TRecord, TResult>;
property whereJsonPath
whereJsonPath: WhereJsonPath<TRecord, TResult>;
property whereJsonSubsetOf
whereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
property whereJsonSupersetOf
whereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
property whereLike
whereLike: Where<TRecord, TResult>;
property whereNot
whereNot: Where<TRecord, TResult>;
property whereNotBetween
whereNotBetween: WhereBetween<TRecord, TResult>;
property whereNotExists
whereNotExists: WhereExists<TRecord, TResult>;
property whereNotIn
whereNotIn: WhereIn<TRecord, TResult>;
property whereNotJsonObject
whereNotJsonObject: WhereJsonObject<TRecord, TResult>;
property whereNotNull
whereNotNull: WhereNull<TRecord, TResult>;
property whereNull
whereNull: WhereNull<TRecord, TResult>;
property whereRaw
whereRaw: WhereRaw<TRecord, TResult>;
property whereWrapped
whereWrapped: WhereWrapped<TRecord, TResult>;
property with
with: With<TRecord, TResult>;
property withMaterialized
withMaterialized: With<TRecord, TResult>;
property withNotMaterialized
withNotMaterialized: With<TRecord, TResult>;
property withRaw
withRaw: WithRaw<TRecord, TResult>;
property withRecursive
withRecursive: With<TRecord, TResult>;
property withSchema
withSchema: WithSchema<TRecord, TResult>;
property withWrapped
withWrapped: WithWrapped<TRecord, TResult>;
method clear
clear: (statement: ClearStatements) => QueryBuilder<TRecord, TResult>;
method clearCounters
clearCounters: () => QueryBuilder<TRecord, TResult>;
method clearGroup
clearGroup: () => QueryBuilder<TRecord, TResult>;
method clearHaving
clearHaving: () => QueryBuilder<TRecord, TResult>;
method clearOrder
clearOrder: () => QueryBuilder<TRecord, TResult>;
method clearSelect
clearSelect: () => QueryBuilder< TRecord, UnwrapArrayMember<TResult> extends DeferredKeySelection< infer TBase, infer TKeys extends string, true, any, any, any, any > ? DeferredKeySelection<TBase, never, false, {}, false, {}, never>[] : TResult>;
method clearWhere
clearWhere: () => QueryBuilder<TRecord, TResult>;
method decrement
decrement: { (columnName: keyof TRecord, amount?: number): QueryBuilder<TRecord, number>; (columnName: string, amount?: number): QueryBuilder<TRecord, number>; (columns: { [column in keyof TRecord]: number }): QueryBuilder< TRecord, number >;};
method del
del: { (returning: '*', options?: DMLOptions): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<TRecord>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<TRecord>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2[]>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( returning: string | readonly string[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>(): QueryBuilder<TRecord, TResult2>;};
method delete
delete: { (returning: '*', options?: DMLOptions): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<TRecord>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = any>( returning: string | Raw<any> | readonly (string | Raw<any>)[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>(): QueryBuilder<TRecord, TResult2>;};
method increment
increment: { (columnName: keyof TRecord, amount?: number): QueryBuilder<TRecord, number>; (columnName: string, amount?: number): QueryBuilder<TRecord, number>; (columns: { [column in keyof TRecord]: number }): QueryBuilder< TRecord, number >;};
method insert
insert: { ( data: TRecord extends CompositeTableType<unknown> ? | ResolveTableType<TRecord, 'insert'> | ReadonlyArray<ResolveTableType<TRecord, 'insert'>> : DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>, returning: '*', options?: DMLOptions ): QueryBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number[]>( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'insert'> | readonly ResolveTableType<TRecord, 'insert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[] ): QueryBuilder<TRecord, TResult2>;};
method limit
limit: ( limit: number, options?: string | Readonly<{ skipBinding?: boolean }>) => QueryBuilder<TRecord, TResult>;
method modify
modify: <TRecord2 extends {} = any, TResult2 extends {} = any>( callback: QueryCallbackWithArgs<TRecord, any>, ...args: any[]) => QueryBuilder<TRecord2, TResult2>;
method offset
offset: ( offset: number, options?: boolean | Readonly<{ skipBinding?: boolean }>) => QueryBuilder<TRecord, TResult>;
method onConflict
onConflict: { <TKey extends StrKey<ResolveTableType<TRecord, 'base'>>>( column: TKey ): OnConflictQueryBuilder<TRecord, TResult>; <TKey extends StrKey<ResolveTableType<TRecord, 'base'>>>( columns: readonly TKey[] ): OnConflictQueryBuilder<TRecord, TResult>; (columns: string): OnConflictQueryBuilder<TRecord, TResult>; (columns: string[]): OnConflictQueryBuilder<TRecord, TResult>; (raw: Raw<any>): OnConflictQueryBuilder<TRecord, TResult>; (): OnConflictQueryBuilder<TRecord, TResult>;};
method pluck
pluck: { <K extends keyof TRecord>(column: K): QueryBuilder<TRecord, TRecord[K][]>; <TResult2 extends {}>(column: string): QueryBuilder<TRecord, TResult2>;};
method returning
returning: { (column: '*', options?: DMLOptions): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( column: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.SetSingle< DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >, false >[] >( columns: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( column: string | Raw<any> | readonly (string | Raw<any>)[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>;};
method truncate
truncate: () => QueryBuilder<TRecord, void>;
method update
update: { < K1 extends StrKey<ResolveTableType<TRecord, 'update'>>, K2 extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, K2 >, {} >[] >( columnName: K1, value: DbColumn<ResolveTableType<TRecord, 'update'>[K1]>, returning: K2, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < K1 extends StrKey<ResolveTableType<TRecord, 'update'>>, K2 extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, K2 >, {} >[] >( columnName: K1, value: DbColumn<ResolveTableType<TRecord, 'update'>[K1]>, returning: readonly K2[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <K extends keyof TRecord>( columnName: K, value: DbColumn<TRecord[K]> ): QueryBuilder<TRecord, number>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( columnName: string, value: any, returning: string | readonly string[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; ( data: DbRecordArr<TRecord>, returning: '*', options?: DMLOptions ): QueryBuilder< TRecord, DeferredKeySelection<TRecord, never, false, {}, false, {}, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string = string, TResult2 extends {}[] = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: TKey | readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 extends {}[] = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord>, returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? ResolveTableType<TRecord, 'update'> : DbRecordArr<TRecord> ): QueryBuilder<TRecord, TResult2>; <TResult2 = number>(columnName: string, value: any): QueryBuilder< TRecord, TResult2 >;};
method upsert
upsert: { ( data: TRecord extends CompositeTableType<unknown> ? | ResolveTableType<TRecord, 'upsert'> | ReadonlyArray<ResolveTableType<TRecord, 'upsert'>> : DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>, returning: '*', options?: DMLOptions ): QueryBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: TKey, options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; < TKey extends string, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, TRecord >, TKey >, {} >[] >( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[], returning: readonly TKey[], options?: DMLOptions ): QueryBuilder<TRecord, TResult2>; <TResult2 = number[]>( data: TRecord extends CompositeTableType< unknown, unknown, Partial<unknown>, Partial<unknown> > ? | ResolveTableType<TRecord, 'upsert'> | readonly ResolveTableType<TRecord, 'upsert'>[] : DbRecordArr<TRecord> | readonly DbRecordArr<TRecord>[] ): QueryBuilder<TRecord, TResult2>;};
interface Raw
interface Raw<TResult = any> extends events.EventEmitter, ChainableInterface<ResolveResult<TResult>> {}
method queryContext
queryContext: { (context: any): Raw<TResult>; (): any };
method timeout
timeout: (ms: number, options?: { cancel?: boolean }) => Raw<TResult>;
method toSQL
toSQL: () => Sql;
method wrap
wrap: <TResult2 = TResult>(before: string, after: string) => Raw<TResult>;
interface RawBuilder
interface RawBuilder<TRecord extends {} = any, TResult = any> {}
call signature
<TResult2 = TResult>(value: Value): Raw<TResult2>;
call signature
<TResult2 = TResult>(sql: string, binding: RawBinding): Raw<TResult2>;
call signature
<TResult2 = TResult>( sql: string, bindings: readonly RawBinding[] | ValueDict): Raw<TResult2>;
interface RawQueryBuilder
interface RawQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<TResult2 = TResult>( sql: string, bindings?: readonly RawBinding[] | ValueDict | RawBinding): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = TResult>(raw: Raw<TResult2>): QueryBuilder<TRecord, TResult2>;
interface Ref
interface Ref<TSrc extends string, TMapping extends {}> extends Raw<string> {}
property [RefMemberTag]
[RefMemberTag]: { src: TSrc; mapping: TMapping;};
method as
as: <TAlias extends string>(alias: TAlias) => Ref<TSrc, { [K in TAlias]: TSrc }>;
method withSchema
withSchema: (schema: string) => this;
interface RefBuilder
interface RefBuilder {}
call signature
<TSrc extends string>(src: TSrc): Ref<TSrc, { [K in TSrc]: TSrc }>;
interface SchemaBuilder
interface SchemaBuilder extends ChainableInterface<void> {}
method alterTable
alterTable: ( tableName: string, callback: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method alterView
alterView: ( viewName: string, callback: (tableBuilder: AlterViewBuilder) => any) => SchemaBuilder;
method createMaterializedView
createMaterializedView: ( viewName: string, callback: (viewBuilder: ViewBuilder) => any) => SchemaBuilder;
method createSchema
createSchema: (schemaName: string) => SchemaBuilder;
method createSchemaIfNotExists
createSchemaIfNotExists: (schemaName: string) => SchemaBuilder;
method createTable
createTable: ( tableName: string, callback: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method createTableIfNotExists
createTableIfNotExists: ( tableName: string, callback: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method createTableLike
createTableLike: ( tableName: string, tableNameLike: string, callback?: (tableBuilder: CreateTableBuilder) => any) => SchemaBuilder;
method createView
createView: ( viewName: string, callback: (viewBuilder: ViewBuilder) => any) => SchemaBuilder;
method createViewOrReplace
createViewOrReplace: ( viewName: string, callback: (viewBuilder: ViewBuilder) => any) => SchemaBuilder;
method dropMaterializedView
dropMaterializedView: (viewName: string) => SchemaBuilder;
method dropMaterializedViewIfExists
dropMaterializedViewIfExists: (viewName: string) => SchemaBuilder;
method dropSchema
dropSchema: (schemaName: string, cascade?: boolean) => SchemaBuilder;
method dropSchemaIfExists
dropSchemaIfExists: (schemaName: string, cascade?: boolean) => SchemaBuilder;
method dropTable
dropTable: (tableName: string) => SchemaBuilder;
method dropTableIfExists
dropTableIfExists: (tableName: string) => SchemaBuilder;
method dropView
dropView: (viewName: string) => SchemaBuilder;
method dropViewIfExists
dropViewIfExists: (viewName: string) => SchemaBuilder;
method hasColumn
hasColumn: (tableName: string, columnName: string) => Promise<boolean>;
method hasTable
hasTable: (tableName: string) => Promise<boolean>;
method queryContext
queryContext: (context: any) => SchemaBuilder;
method raw
raw: (statement: string) => SchemaBuilder;
method refreshMaterializedView
refreshMaterializedView: ( viewName: string, concurrently?: boolean) => SchemaBuilder;
method renameTable
renameTable: (oldTableName: string, newTableName: string) => Promise<void>;
method renameView
renameView: (oldViewName: string, newViewName: string) => SchemaBuilder;
method table
table: ( tableName: string, callback: (tableBuilder: AlterTableBuilder) => any) => SchemaBuilder;
method toSQL
toSQL: () => Sql[];
method toString
toString: () => string;
method view
view: ( viewName: string, callback: (viewBuilder: AlterViewBuilder) => any) => SchemaBuilder;
method withSchema
withSchema: (schemaName: string) => SchemaBuilder;
interface SeederConfig
interface SeederConfig<V extends {} = any> {}
property directory
directory?: string | readonly string[];
property extension
extension?: string;
property loadExtensions
loadExtensions?: readonly string[];
property recursive
recursive?: boolean;
property seedSource
seedSource?: SeedSource<unknown>;
property sortDirsSeparately
sortDirsSeparately?: boolean;
property specific
specific?: string;
property stub
stub?: string;
property timestampFilenamePrefix
timestampFilenamePrefix?: boolean;
property variables
variables?: V;
interface SeedSource
interface SeedSource<TSeedSpec> {}
interface Select
interface Select<TRecord extends {} = any, TResult = unknown[]> extends AliasQueryBuilder<TRecord, TResult>, ColumnNameQueryBuilder<TRecord, TResult> {}
call signature
(): QueryBuilder<TRecord, TResult>;
call signature
< TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends {} = any, TInnerResult = any>( ...subQueryBuilders: readonly QueryBuilder<TInnerRecord, TInnerResult>[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = ArrayIfAlready<TResult, any>, TInnerRecord extends {} = any, TInnerResult = any>( subQueryBuilders: readonly QueryBuilder<TInnerRecord, TInnerResult>[]): QueryBuilder<TRecord, TResult2>;
interface SocketConnectionConfig
interface SocketConnectionConfig {}
property database
database: string;
property debug
debug?: boolean;
property password
password: string;
property socketPath
socketPath: string;
property user
user: string;
method expirationChecker
expirationChecker: () => boolean;
interface Sql
interface Sql {}
interface Sqlite3ConnectionConfig
interface Sqlite3ConnectionConfig {}
Used with SQLite3 adapter
property debug
debug?: boolean;
property filename
filename: string;
property flags
flags?: string[];
method expirationChecker
expirationChecker: () => boolean;
interface SqlLiteColumnBuilder
interface SqlLiteColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ predicate?: QueryBuilder }>) => ColumnBuilder;
interface SqlNative
interface SqlNative {}
interface StringTagSupport
interface StringTagSupport {}
property [Symbol.toStringTag]
readonly [Symbol.toStringTag]: string;
interface Table
interface Table<TRecord extends {} = any, TResult = any> {}
call signature
< TTable extends TableNames, TRecord2 extends {} = TableType<TTable>, TResult2 = DeferredKeySelection.ReplaceBase< TResult, ResolveTableType<TRecord2> >>( tableName: TTable, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
call signature
< TRecord2 extends {} = {}, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
call signature
< TRecord2 extends {} = {}, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( callback: Function, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
call signature
< TRecord2 extends {} = {}, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( raw: Raw, options?: TableOptions): QueryBuilder<TRecord2, TResult2>;
interface TableBuilder
interface TableBuilder {}
method bigIncrements
bigIncrements: ( columnName?: string, options?: { primaryKey?: boolean }) => ColumnBuilder;
method bigint
bigint: (columnName: string) => ColumnBuilder;
method bigInteger
bigInteger: (columnName: string) => ColumnBuilder;
method binary
binary: (columnName: string, length?: number) => ColumnBuilder;
method boolean
boolean: (columnName: string) => ColumnBuilder;
method check
check: ( checkPredicate: string, bindings?: Record<string, any>, constraintName?: string) => TableBuilder;
method comment
comment: (val: string) => void;
method date
date: (columnName: string) => ColumnBuilder;
method datetime
datetime: ( columnName: string, options?: Readonly<{ useTz?: boolean; precision?: number }>) => ColumnBuilder;
method dateTime
dateTime: ( columnName: string, options?: Readonly<{ useTz?: boolean; precision?: number }>) => ColumnBuilder;
method decimal
decimal: ( columnName: string, precision?: number | null, scale?: number) => ColumnBuilder;
method double
double: ( columnName: string, precision?: number, scale?: number) => ColumnBuilder;
method dropChecks
dropChecks: (checkConstraintNames: string | string[]) => TableBuilder;
method dropColumn
dropColumn: (columnName: string) => TableBuilder;
method dropColumns
dropColumns: (...columnNames: string[]) => TableBuilder;
method dropForeign
dropForeign: ( columnNames: string | readonly string[], foreignKeyName?: string) => TableBuilder;
method dropIndex
dropIndex: ( columnNames: string | readonly (string | Raw)[], indexName?: string) => TableBuilder;
method dropNullable
dropNullable: (column: string) => TableBuilder;
method dropPrimary
dropPrimary: (constraintName?: string) => TableBuilder;
method dropTimestamps
dropTimestamps: (useCamelCase?: boolean) => TableBuilder;
method dropUnique
dropUnique: ( columnNames: readonly (string | Raw)[], indexName?: string) => TableBuilder;
method enu
enu: ( columnName: string, values: readonly Value[] | null, options?: EnumOptions) => ColumnBuilder;
method enum
enum: ( columnName: string, values: readonly Value[] | null, options?: EnumOptions) => ColumnBuilder;
method float
float: (columnName: string, precision?: number, scale?: number) => ColumnBuilder;
method foreign
foreign: { (column: string, foreignKeyName?: string): ForeignConstraintBuilder; ( columns: readonly string[], foreignKeyName?: string ): MultikeyForeignConstraintBuilder;};
method geography
geography: (columnName: string) => ColumnBuilder;
method geometry
geometry: (columnName: string) => ColumnBuilder;
method increments
increments: ( columnName?: string, options?: { primaryKey?: boolean }) => ColumnBuilder;
method index
index: { ( columnNames: string | readonly (string | Raw)[], indexName?: string, indexType?: string ): TableBuilder; ( columnNames: string | readonly (string | Raw<any>)[], indexName?: string, options?: Readonly<{ indexType?: string; storageEngineIndexType?: storageEngineIndexType; predicate?: QueryBuilder<any, any>; }> ): TableBuilder;};
method integer
integer: (columnName: string, length?: number) => ColumnBuilder;
method json
json: (columnName: string) => ColumnBuilder;
method jsonb
jsonb: (columnName: string) => ColumnBuilder;
method mediumint
mediumint: (columnName: string) => ColumnBuilder;
method point
point: (columnName: string) => ColumnBuilder;
method primary
primary: { ( columnNames: readonly string[], options?: Readonly<{ constraintName?: string; deferrable?: deferrableType; }> ): TableBuilder; (columnNames: readonly string[], constraintName?: string): TableBuilder;};
Deprecated
method queryContext
queryContext: (context: any) => TableBuilder;
method renameColumn
renameColumn: (from: string, to: string) => TableBuilder;
method setNullable
setNullable: (column: string) => TableBuilder;
method smallint
smallint: (columnName: string) => ColumnBuilder;
method specificType
specificType: (columnName: string, type: string) => ColumnBuilder;
method string
string: (columnName: string, length?: number) => ColumnBuilder;
method text
text: (columnName: string, textType?: string) => ColumnBuilder;
method time
time: (columnName: string) => ColumnBuilder;
method timestamp
timestamp: { ( columnName: string, options?: Readonly<{ useTz?: boolean; precision?: number }> ): ColumnBuilder; (columnName: string, withoutTz?: boolean, precision?: number): ColumnBuilder;};
Deprecated
method timestamps
timestamps: { ( useTimestamps?: boolean, defaultToNow?: boolean, useCamelCase?: boolean ): ColumnBuilder; ( options?: Readonly<{ useTimestamps?: boolean; defaultToNow?: boolean; useCamelCase?: boolean; }> ): void;};
method tinyint
tinyint: (columnName: string, length?: number) => ColumnBuilder;
method unique
unique: { ( columnNames: string | readonly (string | Raw)[], options?: Readonly<{ indexName?: string; storageEngineIndexType?: string; deferrable?: deferrableType; useConstraint?: boolean; predicate?: QueryBuilder; }> ): TableBuilder; ( columnNames: string | readonly (string | Raw<any>)[], indexName?: string ): TableBuilder;};
Deprecated
method uuid
uuid: ( columnName: string, options?: Readonly<{ useBinaryUuid?: boolean; primaryKey?: boolean }>) => ColumnBuilder;
interface Transaction
interface Transaction<TRecord extends {} = any, TResult = any[]> extends Knex<TRecord, TResult> {}
property executionPromise
executionPromise: Promise<TResult>;
property isCompleted
isCompleted: () => boolean;
property parentTransaction
parentTransaction?: Transaction;
method commit
commit: (value?: any) => QueryBuilder<TRecord, TResult>;
method query
query: <TRecord extends {} = any, TResult = void>( conn: any, sql: any, status: any, value: any) => QueryBuilder<TRecord, TResult>;
method rollback
rollback: (error?: any) => QueryBuilder<TRecord, TResult>;
method savepoint
savepoint: <T = any>(transactionScope: (trx: Transaction) => any) => Promise<T>;
interface TransactionConfig
interface TransactionConfig {}
property connection
connection?: any;
property doNotRejectOnRollback
doNotRejectOnRollback?: boolean;
property isolationLevel
isolationLevel?: IsolationLevels;
property readOnly
readOnly?: boolean;
property userParams
userParams?: Record<string, any>;
interface TypePreservingAggregation
interface TypePreservingAggregation< TRecord extends {} = any, TResult = unknown[], TValue = any> {}
call signature
< TKey extends keyof ResolveTableType<TRecord>, TOptions extends { as: string }, TResult2 = AggregationQueryResult< TResult, { [k in TOptions['as']]: ResolveTableType<TRecord>[TKey]; } >>( columnName: TKey, options: Readonly<TOptions>): QueryBuilder<TRecord, TResult2>;
call signature
< TKey extends keyof ResolveTableType<TRecord>, TResult2 = AggregationQueryResult< TResult, Dict<ResolveTableType<TRecord>[TKey]> >>( ...columnNames: readonly TKey[]): QueryBuilder<TRecord, TResult2>;
call signature
< TAliases extends {} = Readonly<Record<string, string | string[] | Knex.Raw>>, TResult2 = AggregationQueryResult< TResult, { // We have optional here because in most dialects aggregating by multiple keys simultaneously // causes rest of the keys to be dropped and only first to be considered [K in keyof TAliases]?: K extends keyof TRecord ? TRecord[K] : TValue; } >>( aliases: TAliases): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: ReadonlyArray< | Readonly<Record<string, string | readonly string[] | Knex.Raw>> | Knex.Raw | string >): QueryBuilder<TRecord, TResult2>;
interface Union
interface Union<TRecord extends {} = any, TResult = unknown[]> extends Intersect<TRecord, TResult> {}
interface Using
interface Using<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(tables: string[]): QueryBuilder<TRecord, TResult>;
interface ValueDict
interface ValueDict extends Dict<Value | Knex.QueryBuilder> {}
interface ViewBuilder
interface ViewBuilder<TRecord extends {} = any, TResult = any> {}
method as
as: (selectQuery: QueryBuilder) => ViewBuilder;
method cascadedCheckOption
cascadedCheckOption: () => Promise<void>;
method checkOption
checkOption: () => Promise<void>;
method columns
columns: (columns: any) => ViewBuilder;
method localCheckOption
localCheckOption: () => Promise<void>;
method queryContext
queryContext: (context: any) => ViewBuilder;
interface Where
interface Where<TRecord extends {} = any, TResult = unknown> extends WhereRaw<TRecord, TResult>, WhereWrapped<TRecord, TResult>, WhereNull<TRecord, TResult> {}
call signature
(raw: Raw): QueryBuilder<TRecord, TResult>;
call signature
(callback: QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult>;
call signature
(left: Raw, operator: string, right: Value | null): QueryBuilder< TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( left: Raw, operator: string, right: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
call signature
(object: DbRecord<ResolveTableType<TRecord>>): QueryBuilder<TRecord, TResult>;
call signature
(object: Readonly<Object>): QueryBuilder<TRecord, TResult>;
call signature
<T extends keyof ResolveTableType<TRecord>>( columnName: T, value: DbColumn<ResolveTableType<TRecord>[T]> | null): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, value: Value | null): QueryBuilder<TRecord, TResult>;
call signature
<T extends keyof ResolveTableType<TRecord>>( columnName: T, operator: ComparisonOperator, value: DbColumn<ResolveTableType<TRecord>[T]> | null): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, operator: string, value: Value | null): QueryBuilder< TRecord, TResult>;
call signature
< T extends keyof ResolveTableType<TRecord>, TRecordInner extends {}, TResultInner>( columnName: T, operator: ComparisonOperator, value: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( columnName: string, operator: string, value: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
interface WhereBetween
interface WhereBetween<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<K extends keyof TRecord>( columnName: K, range: readonly [DbColumn<TRecord[K]>, DbColumn<TRecord[K]>]): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, range: readonly [Value, Value]): QueryBuilder< TRecord, TResult>;
interface WhereExists
interface WhereExists<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(callback: QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( query: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
interface WhereIn
interface WhereIn<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<K extends keyof ResolveTableType<TRecord>>( columnName: K, values: readonly DbColumn<ResolveTableType<TRecord>[K]>[] | QueryCallback): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, values: readonly Value[] | QueryCallback): QueryBuilder< TRecord, TResult>;
call signature
<K extends keyof ResolveTableType<TRecord>>( columnNames: readonly K[], values: | readonly (readonly DbColumn<ResolveTableType<TRecord>[K]>[])[] | QueryCallback): QueryBuilder<TRecord, TResult>;
call signature
( columnNames: readonly string[], values: readonly Value[][] | QueryCallback): QueryBuilder<TRecord, TResult>;
call signature
<K extends keyof TRecord, TRecordInner extends {}, TResultInner>( columnName: K, values: QueryBuilder<TRecordInner, TRecord[K]>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( columnName: string, values: Value[] | QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
call signature
<K extends keyof TRecord, TRecordInner extends {}, TResultInner>( columnNames: readonly K[], values: QueryBuilder<TRecordInner, TRecord[K]>): QueryBuilder<TRecord, TResult>;
call signature
<TRecordInner extends {}, TResultInner>( columnNames: readonly string[], values: QueryBuilder<TRecordInner, TResultInner>): QueryBuilder<TRecord, TResult>;
interface WhereJsonObject
interface WhereJsonObject<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: keyof ResolveTableType<TRecord>, value: any): QueryBuilder< TRecord, TResult>;
interface WhereJsonPath
interface WhereJsonPath<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( columnName: keyof ResolveTableType<TRecord>, jsonPath: string, operator: string, value: any): QueryBuilder<TRecord, TResult>;
interface WhereNull
interface WhereNull<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface WhereRaw
interface WhereRaw<TRecord extends {} = any, TResult = unknown[]> extends RawQueryBuilder<TRecord, TResult> {}
call signature
(condition: boolean): QueryBuilder<TRecord, TResult>;
interface WhereWrapped
interface WhereWrapped<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(callback: QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult>;
interface With
interface With<TRecord extends {} = any, TResult = unknown[]> extends WithRaw<TRecord, TResult>, WithWrapped<TRecord, TResult> {}
interface WithRaw
interface WithRaw<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(alias: string, raw: Raw | QueryBuilder): QueryBuilder<TRecord, TResult>;
call signature
(alias: string, sql: string, bindings?: readonly Value[] | Object): QueryBuilder< TRecord, TResult>;
call signature
(alias: string, columnList: string[], raw: Raw | QueryBuilder): QueryBuilder< TRecord, TResult>;
call signature
( alias: string, columnList: string[], sql: string, bindings?: readonly Value[] | Object): QueryBuilder<TRecord, TResult>;
interface WithSchema
interface WithSchema<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(schema: string): QueryBuilder<TRecord, TResult>;
interface WithWrapped
interface WithWrapped<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(alias: string, queryBuilder: QueryBuilder): QueryBuilder<TRecord, TResult>;
call signature
(alias: string, callback: (queryBuilder: QueryBuilder) => any): QueryBuilder< TRecord, TResult>;
call signature
(alias: string, columnList: string[], queryBuilder: QueryBuilder): QueryBuilder< TRecord, TResult>;
call signature
( alias: string, columnList: string[], callback: (queryBuilder: QueryBuilder) => any): QueryBuilder<TRecord, TResult>;
type AsyncConnectionConfigProvider
type AsyncConnectionConfigProvider = () => Promise<StaticConnectionConfig>;
type ClearStatements
type ClearStatements = | 'with' | 'select' | 'columns' | 'hintComments' | 'where' | 'union' | 'using' | 'join' | 'group' | 'order' | 'having' | 'limit' | 'offset' | 'counter' | 'counters';
type ColumnDescriptor
type ColumnDescriptor<TRecord extends {}, TResult> = | string | Knex.Raw | Knex.QueryBuilder<TRecord, TResult> | Dict<string>;
type CompositeTableType
type CompositeTableType< TBase, TInsert = TBase, TUpdate = Partial<TInsert>, TUpsert = Partial<TInsert>> = { base: TBase; insert: TInsert; update: TUpdate; upsert: TUpsert;};
type ConnectionConfigProvider
type ConnectionConfigProvider = | SyncConnectionConfigProvider | AsyncConnectionConfigProvider;
type DbColumn
type DbColumn<TColumn> = Readonly<MaybeRawColumn<TColumn>>;
type DbRecord
type DbRecord<TRecord> = Readonly<SafePartial<MaybeRawRecord<TRecord>>>;
type DbRecordArr
type DbRecordArr<TRecord> = Readonly<MaybeArray<DbRecord<TRecord>>>;
type deferrableType
type deferrableType = 'not deferrable' | 'immediate' | 'deferred';
type ExposedPromiseKeys
type ExposedPromiseKeys = 'then' | 'catch' | 'finally';
type InferrableColumnDescriptor
type InferrableColumnDescriptor<TRecord extends {}> = | keyof TRecord | Knex.Ref<any, any> | Dict<keyof TRecord>;
type IntersectAliases
type IntersectAliases<AliasUT> = UnionToIntersection< IncompatibleToAlt< AliasUT extends (infer I)[] ? I extends Ref<any, infer TMapping> ? TMapping : I : never, Dict, {} >> & {};
type IsolationLevels
type IsolationLevels = | 'read uncommitted' | 'read committed' | 'snapshot' | 'repeatable read' | 'serializable';
type lengthOperator
type lengthOperator = '>' | '<' | '<=' | '>=' | '!=' | '=';
type LogFn
type LogFn = (message: any) => void;
type Lookup
type Lookup< TRegistry extends {}, TKey extends string, TDefault = never> = TKey extends keyof TRegistry ? TRegistry[TKey] : TDefault;
type MaybeRawColumn
type MaybeRawColumn<TColumn> = TColumn | Raw<TColumn>;
type MaybeRawRecord
type MaybeRawRecord<TRecord> = { [K in keyof TRecord]: MaybeRawColumn<TRecord[K]>;};
type MsSqlAuthenticationTypeOptions
type MsSqlAuthenticationTypeOptions = | 'default' | 'ntlm' | 'azure-active-directory-password' | 'azure-active-directory-access-token' | 'azure-active-directory-msi-vm' | 'azure-active-directory-msi-app-service' | 'azure-active-directory-service-principal-secret';
type MsSqlConnectionConfig
type MsSqlConnectionConfig = | MsSqlDefaultAuthenticationConfig | MsSqlNtlmAuthenticationConfig | MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig | MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig | MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig | MsSqlAzureActiveDirectoryPasswordAuthenticationConfig | MsSqlAzureActiveDirectoryServicePrincipalSecretConfig;
type PgGetTypeParser
type PgGetTypeParser = (oid: number, format: string) => any;
type QueryCallback
type QueryCallback<TRecord extends {} = any, TResult = unknown[]> = ( this: QueryBuilder<TRecord, TResult>, builder: QueryBuilder<TRecord, TResult>) => void;
type QueryCallbackWithArgs
type QueryCallbackWithArgs<TRecord extends {} = any, TResult = unknown[]> = ( this: QueryBuilder<TRecord, TResult>, builder: QueryBuilder<TRecord, TResult>, ...args: any[]) => void;
type RawBinding
type RawBinding = Value | QueryBuilder;
type RedshiftConnectionConfig
type RedshiftConnectionConfig = PgConnectionConfig;
type ReferencingColumnBuilder
type ReferencingColumnBuilder = { [K in keyof ColumnBuilder]: ( ...args: Parameters<ColumnBuilder[K]> ) => ReferencingColumnBuilder;} & { inTable(tableName: string): ReferencingColumnBuilder; deferrable(type: deferrableType): ReferencingColumnBuilder; withKeyName(keyName: string): ReferencingColumnBuilder; onDelete(command: string): ReferencingColumnBuilder; onUpdate(command: string): ReferencingColumnBuilder;};
type ResolveTableType
type ResolveTableType< TCompositeTableType, TScope extends TableInterfaceScope = 'base'> = TCompositeTableType extends CompositeTableType<{}> ? TCompositeTableType[TScope] : TCompositeTableType;
type StaticConnectionConfig
type StaticConnectionConfig = | ConnectionConfig | MariaSqlConnectionConfig | MySqlConnectionConfig | MySql2ConnectionConfig | MsSqlConnectionConfig | OracleDbConnectionConfig | PgConnectionConfig | RedshiftConnectionConfig | Sqlite3ConnectionConfig | BetterSqlite3ConnectionConfig | SocketConnectionConfig;
type storageEngineIndexType
type storageEngineIndexType = 'hash' | 'btree';
type SyncConnectionConfigProvider
type SyncConnectionConfigProvider = () => StaticConnectionConfig;
type TableDescriptor
type TableDescriptor = string | Knex.Raw | Knex.QueryBuilder;
type TableInterfaceScope
type TableInterfaceScope = keyof CompositeTableType<unknown>;
type TableNames
type TableNames = keyof Tables;
type TableType
type TableType<TTable extends keyof Tables> = Tables[TTable];
type TransactionProvider
type TransactionProvider = () => Promise<Transaction>;
type Value
type Value = | string | number | boolean | null | Date | Array<string> | Array<number> | Array<Date> | Array<boolean> | Buffer | object | Knex.Raw;
namespace knex.knex.knex
namespace knex.knex.knex {}
variable Client
const Client: typeof Knex.Client;
function knex
knex: typeof knex;
class ColumnBuilder
class ColumnBuilder {}
method extend
static extend: <T = Knex.ColumnBuilder, B = Knex.ColumnBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class KnexTimeoutError
class KnexTimeoutError extends Error {}
class QueryBuilder
class QueryBuilder {}
method extend
static extend: ( methodName: string, fn: <TRecord extends {} = any, TResult extends {} = unknown[]>( this: Knex.QueryBuilder<TRecord, TResult>, ...args: any[] ) => | Knex.QueryBuilder<TRecord, TResult> | Promise< | Knex.QueryBuilder<TRecord | TResult, any> | DeferredKeySelection.Resolve<TResult> >) => void;
class SchemaBuilder
class SchemaBuilder {}
method extend
static extend: <T = Knex.SchemaBuilder, B = Knex.SchemaBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class TableBuilder
class TableBuilder {}
method extend
static extend: <T = Knex.TableBuilder, B = Knex.TableBuilder>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
class ViewBuilder
class ViewBuilder {}
method extend
static extend: <T = Knex.ViewBuilder<any, any>, B = Knex.ViewBuilder<any, any>>( methodName: string, fn: (this: T, ...args: any[]) => B) => void;
interface Knex
interface Knex<TRecord extends {} = any, TResult = any[]> extends Knex.QueryInterface<TRecord, TResult>, events.EventEmitter {}
property client
client: any;
property fn
fn: Knex.FunctionHelper;
property isTransaction
isTransaction?: boolean;
property migrate
migrate: Knex.Migrator;
property raw
raw: Knex.RawBuilder<TRecord>;
property ref
ref: Knex.RefBuilder;
property schema
schema: Knex.SchemaBuilder;
property seed
seed: Knex.Seeder;
property userParams
userParams: Record<string, any>;
property VERSION
VERSION: string;
method batchInsert
batchInsert: <TRecord2 extends {} = TRecord, TResult2 = number[]>( tableName: Knex.TableDescriptor, data: TRecord2 extends Knex.CompositeTableType<unknown> ? ReadonlyArray<Knex.ResolveTableType<TRecord2, 'insert'>> : ReadonlyArray<Knex.DbRecordArr<TRecord2>>, chunkSize?: number) => Knex.BatchInsertBuilder<TRecord2, TResult2>;
method destroy
destroy: { (callback: Function): void; (): Promise<void> };
method initialize
initialize: (config?: Knex.Config) => void;
method queryBuilder
queryBuilder: < TRecord2 extends {} = TRecord, TResult2 = TResult>() => Knex.QueryBuilder<TRecord2, TResult2>;
method transaction
transaction: { (config?: Knex.TransactionConfig): Promise<Knex.Transaction>; (transactionScope?: null, config?: Knex.TransactionConfig): Promise< Knex.Transaction<any, any[]> >; <T>( transactionScope: ( trx: Knex.Transaction<any, any[]> ) => void | Promise<T>, config?: Knex.TransactionConfig ): Promise<T>;};
method transactionProvider
transactionProvider: ( config?: Knex.TransactionConfig) => Knex.TransactionProvider;
method withUserParams
withUserParams: (params: Record<string, any>) => Knex;
call signature
<TTable extends Knex.TableNames>( tableName: TTable, options?: TableOptions): Knex.QueryBuilder< Knex.TableType<TTable>, DeferredKeySelection<Knex.ResolveTableType<Knex.TableType<TTable>>, never>[]>;
call signature
< TRecord2 extends {} = TRecord, TResult2 = DeferredKeySelection<TRecord2, never>[]>( tableName?: Knex.TableDescriptor | Knex.AliasDict, options?: TableOptions): Knex.QueryBuilder<TRecord2, TResult2>;
namespace knex.knex.Knex
namespace knex.knex.Knex {}
variable RefMemberTag
const RefMemberTag: Symbol;
class Client
class Client extends events.EventEmitter {}
constructor
constructor(config: Config<any>);
property canCancelQuery
canCancelQuery: boolean;
property config
config: Config<any>;
property connectionConfigExpirationChecker
connectionConfigExpirationChecker: () => boolean;
property connectionConfigProvider
connectionConfigProvider: any;
property connectionSettings
connectionSettings: {};
property dialect
dialect: string;
property driver
driver: any;
property driverName
driverName: string;
property logger
logger: Logger;
property pool
pool: any;
property valueForUndefined
valueForUndefined: any;
property version
version?: string;
method acquireConnection
acquireConnection: () => any;
method acquireRawConnection
acquireRawConnection: () => Promise<any>;
method assertCanCancelQuery
assertCanCancelQuery: () => void;
method cancelQuery
cancelQuery: () => void;
method columnBuilder
columnBuilder: (tableBuilder: any, type: any, args: any) => ColumnBuilder;
method columnCompiler
columnCompiler: (tableBuilder: any, columnBuilder: any) => any;
method customWrapIdentifier
customWrapIdentifier: (value: any, origImpl: any, queryContext: any) => any;
method database
database: () => any;
method destroy
destroy: (callback: any) => any;
method destroyRawConnection
destroyRawConnection: (connection: any) => Promise<void>;
method formatter
formatter: (builder: any) => any;
method getPoolSettings
getPoolSettings: (poolConfig: any) => any;
method initializeDriver
initializeDriver: () => void;
method initializePool
initializePool: (config?: {}) => void;
method poolDefaults
poolDefaults: () => { min: number; max: number; propagateCreateError: boolean };
method positionBindings
positionBindings: (sql: any) => any;
method postProcessResponse
postProcessResponse: (resp: any, queryContext: any) => any;
method prepBindings
prepBindings: (bindings: any) => any;
method query
query: (connection: any, obj: any) => any;
method queryBuilder
queryBuilder: () => QueryBuilder;
method queryCompiler
queryCompiler: (builder: any) => any;
method raw
raw: (...args: any[]) => any;
method ref
ref: (...args: any[]) => Ref<any, any>;
method releaseConnection
releaseConnection: (connection: any) => any;
method runner
runner: (builder: any) => any;
method schemaBuilder
schemaBuilder: () => SchemaBuilder;
method schemaCompiler
schemaCompiler: (builder: SchemaBuilder) => any;
method stream
stream: (connection: any, obj: any, stream: any, options: any) => any;
method tableBuilder
tableBuilder: ( type: any, tableName: any, tableNameLike: any, fn: any) => TableBuilder;
method tableCompiler
tableCompiler: (tableBuilder: any) => any;
method transaction
transaction: (container: any, config: any, outerTx: any) => Transaction;
method validateConnection
validateConnection: (connection: any) => Promise<boolean>;
method wrapIdentifier
wrapIdentifier: (value: any, queryContext: any) => any;
method wrapIdentifierImpl
wrapIdentifierImpl: (value: any) => string;
class Seeder
class Seeder {}
constructor
constructor(knex: Knex<any, any[]>);
method make
make: (name: string, config?: SeederConfig) => Promise<string>;
method run
run: (config?: SeederConfig) => Promise<[string[]]>;
method setConfig
setConfig: (config: SeederConfig) => SeederConfig;
interface AliasDict
interface AliasDict extends Dict<string> {}
interface AliasQueryBuilder
interface AliasQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( ...aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends (Dict | string)[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( ...aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
call signature
< AliasUT extends (Dict | string)[], TResult2 = ArrayIfAlready< TResult, DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, TRecord, IncompatibleToAlt<ArrayMember<AliasUT>, string, never>, IntersectAliases<AliasUT> > >>( aliases: AliasUT): QueryBuilder<TRecord, TResult2>;
interface AlterColumnBuilder
interface AlterColumnBuilder extends ColumnBuilder {}
interface AlterColumnView
interface AlterColumnView extends ViewBuilder {}
interface AlterTableBuilder
interface AlterTableBuilder extends TableBuilder {}
interface AlterViewBuilder
interface AlterViewBuilder extends ViewBuilder {}
method column
column: (column: string) => AlterColumnView;
interface AnalyticFunction
interface AnalyticFunction<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< TAlias extends string, TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>>( alias: TAlias, raw: Raw | QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult2>;
call signature
< TAlias extends string, TKey extends keyof ResolveTableType<TRecord>, TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>>( alias: TAlias, orderBy: | TKey | TKey[] | { column: TKey; order?: 'asc' | 'desc'; nulls?: 'first' | 'last'; }, partitionBy?: TKey | TKey[] | { column: TKey; order?: 'asc' | 'desc' }): QueryBuilder<TRecord, TResult2>;
interface As
interface As<TRecord extends {}, TResult> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface AsymmetricAggregation
interface AsymmetricAggregation< TRecord extends {} = any, TResult = unknown[], TValue = any> {}
call signature
< TOptions extends { as: string }, TResult2 = AggregationQueryResult<TResult, { [k in TOptions['as']]: TValue }>>( columnName: Readonly<keyof ResolveTableType<TRecord>>, options: Readonly<TOptions>): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: readonly (keyof ResolveTableType<TRecord>)[]): QueryBuilder<TRecord, TResult2>;
call signature
< TAliases extends {} = Record<string, string | string[] | Knex.Raw>, TResult2 = AggregationQueryResult< TResult, { [k in keyof TAliases]?: TValue } >>( aliases: TAliases): QueryBuilder<TRecord, TResult2>;
call signature
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>( ...columnNames: ReadonlyArray< | Readonly<Record<string, string | string[] | Knex.Raw>> | Knex.Raw | string >): QueryBuilder<TRecord, TResult2>;
interface BatchInsertBuilder
interface BatchInsertBuilder<TRecord extends {} = any, TResult = number[]> extends Promise<ResolveResult<TResult>> {}
method returning
returning: { (column: '*'): BatchInsertBuilder< TRecord, DeferredKeySelection<TRecord, never>[] >; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >[] >( column: TKey ): BatchInsertBuilder<TRecord, TResult2>; < TKey extends StrKey<ResolveTableType<TRecord, 'base'>>, TResult2 = DeferredKeySelection.SetSingle< DeferredKeySelection.AddAliases< DeferredKeySelection.AddKey< DeferredKeySelection.SetBase< UnwrapArrayMember<TResult>, ResolveTableType<TRecord, 'base'> >, TKey >, {} >, false >[] >( columns: readonly TKey[] ): BatchInsertBuilder<TRecord, TResult2>; <TResult2 = Partial<AnyOrUnknownToOther<TRecord, {}>>[]>( column: unknown extends TRecord ? string | Raw<any> | readonly (string | Raw<any>)[] : never ): BatchInsertBuilder<TRecord, TResult2>;};
method transacting
transacting: (trx: Transaction) => this;
interface BetterSqlite3ConnectionConfig
interface BetterSqlite3ConnectionConfig {}
Used with
better-sqlite3
adapter
interface ChainableInterface
interface ChainableInterface<T = any> extends Pick<Promise<T>, keyof Promise<T> & ExposedPromiseKeys>, StringTagSupport {}
method asCallback
asCallback: (callback: Function) => Promise<T>;
method connection
connection: (connection: any) => this;
method debug
debug: (enabled: boolean) => this;
method generateDdlCommands
generateDdlCommands: () => Promise<{ pre: string[]; sql: string[]; check: string | null; post: string[];}>;
method options
options: (options: Readonly<{ [key: string]: any }>) => this;
method pipe
pipe: <T extends NodeJS.WritableStream>( writable: T, options?: Readonly<{ [key: string]: any }>) => stream.PassThrough;
method stream
stream: { (handler: (readable: stream.PassThrough) => any): Promise<any>; ( options: Readonly<{ [key: string]: any }>, handler: (readable: stream.PassThrough) => any ): Promise<any>; (options?: Readonly<{ [key: string]: any }>): any;};
method toQuery
toQuery: () => string;
method transacting
transacting: (trx: Transaction) => this;
interface ColumnBuilder
interface ColumnBuilder {}
method after
after: (columnName: string) => ColumnBuilder;
method alter
alter: ( options?: Readonly<{ alterNullable?: boolean; alterType?: boolean }>) => ColumnBuilder;
method checkBetween
checkBetween: ( values: any[] | any[][], constraintName?: string) => ColumnBuilder;
method checkIn
checkIn: (values: string[], constraintName?: string) => ColumnBuilder;
method checkLength
checkLength: ( operator: lengthOperator, length: number, constraintName?: string) => ColumnBuilder;
method checkNegative
checkNegative: (constraintName?: string) => ColumnBuilder;
method checkNotIn
checkNotIn: (values: string[], constraintName?: string) => ColumnBuilder;
method checkPositive
checkPositive: (constraintName?: string) => ColumnBuilder;
method checkRegex
checkRegex: (regex: string, constraintName?: string) => ColumnBuilder;
method collate
collate: (collation: string) => ColumnBuilder;
method comment
comment: (value: string) => ColumnBuilder;
method defaultTo
defaultTo: (value: Value | null, options?: DefaultToOptions) => ColumnBuilder;
method first
first: () => ColumnBuilder;
method index
index: (indexName?: string) => ColumnBuilder;
method notNullable
notNullable: () => ColumnBuilder;
method nullable
nullable: () => ColumnBuilder;
method primary
primary: { ( options?: Readonly<{ constraintName?: string; deferrable?: deferrableType; }> ): ColumnBuilder; (constraintName?: string): ColumnBuilder;};
Deprecated
method queryContext
queryContext: (context: any) => ColumnBuilder;
method references
references: (columnName: string) => ReferencingColumnBuilder;
method unique
unique: { ( options?: Readonly<{ indexName?: string; deferrable?: deferrableType }> ): ColumnBuilder; (indexName?: string): ColumnBuilder;};
Deprecated
method unsigned
unsigned: () => ColumnBuilder;
interface ColumnInfo
interface ColumnInfo {}
property defaultValue
defaultValue: Value;
property maxLength
maxLength: number;
property nullable
nullable: boolean;
property type
type: string;
interface ColumnNameQueryBuilder
interface ColumnNameQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: '*'): QueryBuilder< TRecord, ArrayIfAlready<TResult, DeferredKeySelection<TRecord, string>>>;
call signature
< ColNameUT extends keyof ResolveTableType<TRecord>, TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, ColNameUT & string >[]>( ...columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult2>;
call signature
< ColNameUT extends keyof ResolveTableType<TRecord>, TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, ResolveTableType<TRecord>, ColNameUT & string >[]>( columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, SafePartial<TRecord>, keyof TRecord & string >[]>( ...columnNames: readonly ColumnDescriptor<TRecord, TResult>[]): QueryBuilder<TRecord, TResult2>;
call signature
< TResult2 = DeferredKeySelection.Augment< UnwrapArrayMember<TResult>, SafePartial<TRecord>, keyof TRecord & string >[]>( columnNames: readonly ColumnDescriptor<TRecord, TResult>[]): QueryBuilder<TRecord, TResult2>;
interface Comment
interface Comment<TRecord extends {} = any, TResult = any> {}
call signature
(comment: string): QueryBuilder<TRecord, TResult>;
interface Config
interface Config<SV extends {} = any> {}
property acquireConnectionTimeout
acquireConnectionTimeout?: number;
property asyncStackTraces
asyncStackTraces?: boolean;
property client
client?: string | typeof Client;
property compileSqlOnError
compileSqlOnError?: boolean;
property connection
connection?: string | StaticConnectionConfig | ConnectionConfigProvider;
property debug
debug?: boolean;
property dialect
dialect?: string;
property fetchAsString
fetchAsString?: string[];
property jsonbSupport
jsonbSupport?: boolean;
property log
log?: Logger;
property migrations
migrations?: MigratorConfig;
property pool
pool?: PoolConfig;
property postProcessResponse
postProcessResponse?: (result: any, queryContext: any) => any;
property searchPath
searchPath?: string | readonly string[];
property seeds
seeds?: SeederConfig<SV>;
property useNullAsDefault
useNullAsDefault?: boolean;
property version
version?: string;
property wrapIdentifier
wrapIdentifier?: ( value: string, origImpl: (value: string) => string, queryContext: any) => string;
interface ConnectionConfig
interface ConnectionConfig {}
property database
database: string;
property debug
debug?: boolean;
property domain
domain?: string;
property host
host: string;
property instanceName
instanceName?: string;
property password
password: string;
property requestTimeout
requestTimeout?: number;
property user
user: string;
interface CreateTableBuilder
interface CreateTableBuilder extends TableBuilder {}
interface DefaultToOptions
interface DefaultToOptions {}
property constraintName
constraintName?: string;
interface Distinct
interface Distinct<TRecord extends {}, TResult = {}[]> extends ColumnNameQueryBuilder<TRecord, TResult> {}
interface DistinctOn
interface DistinctOn<TRecord extends {}, TResult = {}[]> {}
call signature
<ColNameUT extends keyof TRecord>( ...columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult>;
call signature
<ColNameUT extends keyof TRecord>( columnNames: readonly ColNameUT[]): QueryBuilder<TRecord, TResult>;
call signature
(...columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
call signature
(columnNames: readonly string[]): QueryBuilder<TRecord, TResult>;
interface EnumOptions
interface EnumOptions {}
property enumName
enumName: string;
property existingType
existingType?: boolean;
property schemaName
schemaName?: string;
property useNative
useNative: boolean;
interface Except
interface Except<TRecord extends {} = any, TResult = unknown[]> extends Intersect<TRecord, TResult> {}
interface ForeignConstraintBuilder
interface ForeignConstraintBuilder {}
method references
references: (columnName: string) => ReferencingColumnBuilder;
interface FunctionHelper
interface FunctionHelper {}
interface GroupBy
interface GroupBy<TRecord extends {} = any, TResult = unknown[]> extends RawQueryBuilder<TRecord, TResult>, ColumnNameQueryBuilder<TRecord, TResult> {}
interface Having
interface Having<TRecord extends {} = any, TResult = unknown[]> extends WhereWrapped<TRecord, TResult> {}
call signature
<K extends keyof TRecord>( column: K, operator: ComparisonOperator, value: DbColumn<TRecord[K]>): QueryBuilder<TRecord, TResult>;
call signature
( column: string | Raw, operator: string, value: Value | QueryBuilder | null): QueryBuilder<TRecord, TResult>;
call signature
(raw: Raw): QueryBuilder<TRecord, TResult>;
interface HavingNull
interface HavingNull<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(columnName: keyof TRecord): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string): QueryBuilder<TRecord, TResult>;
interface HavingRange
interface HavingRange<TRecord extends {} = any, TResult = unknown[]> {}
call signature
<K extends keyof TRecord>( columnName: K, values: readonly DbColumn<TRecord[K]>[]): QueryBuilder<TRecord, TResult>;
call signature
(columnName: string, values: readonly Value[]): QueryBuilder<TRecord, TResult>;
interface HintComment
interface HintComment<TRecord extends {} = any, TResult = any> {}
call signature
(hint: string): QueryBuilder<TRecord, TResult>;
call signature
(hints: readonly string[]): QueryBuilder<TRecord, TResult>;
interface Intersect
interface Intersect<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( callback: MaybeArray<QueryCallback | QueryBuilder<TRecord> | Raw>, wrap?: boolean): QueryBuilder<TRecord, TResult>;
call signature
( ...callbacks: readonly (QueryCallback | Raw | QueryBuilder<TRecord>)[]): QueryBuilder<TRecord, TResult>;
interface Join
interface Join<TRecord extends {} = any, TResult = unknown[]> {}
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable extends TableNames, TRecord2 extends {} = ResolveTableType<TRecord> & ResolveTableType<TableType<TTable>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable, clause: JoinCallback): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable2}.${TKey2}`, operator: string, column2: `${TTable1}.${TKey1}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, operator: string, column2: string): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, clause: JoinCallback): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, columns: { [key: string]: string | number | boolean | Raw }): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable1}.${TKey1}`, column2: `${TTable2}.${TKey2}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable2}.${TKey2}`, column2: `${TTable1}.${TKey1}`): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, column2: string): QueryBuilder<TRecord2, TResult2>;
call signature
< TJoinTargetRecord extends {} = any, TRecord2 extends {} = TRecord & TJoinTargetRecord, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TableDescriptor | AliasDict | QueryCallback, column1: string, raw: Raw): QueryBuilder<TRecord2, TResult2>;
call signature
< TTable1 extends TableNames, TTable2 extends TableNames, TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> & StrKey<TRecord1>, TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>, TRecord1 = ResolveTableType<TRecord>, TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>, TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>>( tableName: TTable2, column1: `${TTable1}.${TKey1}`, operator: string, column2: `${TTable2}.${TKey2}`): QueryBuilder<TRecord2, TResult2>;
interface JoinCallback
interface JoinCallback {}
call signature
(this: JoinClause, join: JoinClause): void;
interface JoinClause
interface JoinClause {}
method andOn
andOn: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method andOnBetween
andOnBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method andOnExists
andOnExists: (callback: QueryCallback) => JoinClause;
method andOnIn
andOnIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method andOnNotBetween
andOnNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method andOnNotExists
andOnNotExists: (callback: QueryCallback) => JoinClause;
method andOnNotIn
andOnNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method andOnNotNull
andOnNotNull: (column1: string) => JoinClause;
method andOnNull
andOnNull: (column1: string) => JoinClause;
method andOnVal
andOnVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method on
on: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method onBetween
onBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method onExists
onExists: (callback: QueryCallback) => JoinClause;
method onIn
onIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method onJsonPathEquals
onJsonPathEquals: ( columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string) => JoinClause;
method onNotBetween
onNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method onNotExists
onNotExists: (callback: QueryCallback) => JoinClause;
method onNotIn
onNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method onNotNull
onNotNull: (column1: string) => JoinClause;
method onNull
onNull: (column1: string) => JoinClause;
method onVal
onVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method orOn
orOn: { (raw: Raw): JoinClause; (callback: JoinCallback): JoinClause; (columns: { [key: string]: string | Raw<any> }): JoinClause; (column1: string, column2: string): JoinClause; (column1: string, raw: Raw<any>): JoinClause; (column1: string, operator: string, column2: string | Raw<any>): JoinClause;};
method orOnBetween
orOnBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method orOnExists
orOnExists: (callback: QueryCallback) => JoinClause;
method orOnIn
orOnIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method orOnJsonPathEquals
orOnJsonPathEquals: ( columnFirst: string, jsonPathFirst: string, columnSecond: string, jsonPathSecond: string) => JoinClause;
method orOnNotBetween
orOnNotBetween: (column1: string, range: readonly [any, any]) => JoinClause;
method orOnNotExists
orOnNotExists: (callback: QueryCallback) => JoinClause;
method orOnNotIn
orOnNotIn: (column1: string, values: readonly any[] | Raw) => JoinClause;
method orOnNotNull
orOnNotNull: (column1: string) => JoinClause;
method orOnNull
orOnNull: (column1: string) => JoinClause;
method orOnVal
orOnVal: { (column1: string, value: Value): JoinClause; (column1: string, operator: string, value: any): JoinClause;};
method type
type: (type: string) => JoinClause;
method using
using: ( column: | string | readonly string[] | Raw<any> | { [key: string]: string | Raw<any> }) => JoinClause;
interface JoinRaw
interface JoinRaw<TRecord extends {} = any, TResult = unknown[]> {}
call signature
(tableName: string, binding?: Value | Value[] | ValueDict): QueryBuilder< TRecord, TResult>;
interface JsonExtract
interface JsonExtract<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, alias?: string, singleValue?: boolean): QueryBuilder<TRecord, TResult>;
call signature
(column: JsonExtraction[] | any[][], singleValue?: boolean): QueryBuilder< TRecord, TResult>;
interface JsonExtraction
interface JsonExtraction {}
property alias
alias?: string;
property column
column: string | Raw | QueryBuilder;
property path
path: string;
property singleValue
singleValue?: boolean;
interface JsonInsert
interface JsonInsert<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
interface JsonRemove
interface JsonRemove<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, alias?: string): QueryBuilder<TRecord, TResult>;
interface JsonSet
interface JsonSet<TRecord extends {} = any, TResult = any> {}
call signature
( column: string | Raw | QueryBuilder, path: string, value: any, alias?: string): QueryBuilder<TRecord, TResult>;
interface Logger
interface Logger {}
property debug
debug?: LogFn;
property deprecate
deprecate?: (method: string, alternative: string) => void;
property enableColors
enableColors?: boolean;
property error
error?: LogFn;
property inspectionDepth
inspectionDepth?: number;
property warn
warn?: LogFn;
interface MariaSqlConnectionConfig
interface MariaSqlConnectionConfig {}
property charset
charset?: string;
property compress
compress?: boolean;
property connTimeout
connTimeout?: number;
property db
db?: string;
property host
host?: string;
property keepQueries
keepQueries?: boolean;
property local_infile
local_infile?: boolean;
property multiStatements
multiStatements?: boolean;
property password
password?: string;
property pingInterval
pingInterval?: number;
property port
port?: number;
property protocol
protocol?: string;
property read_default_file
read_default_file?: string;
property read_default_group
read_default_group?: string;
property secureAuth
secureAuth?: boolean;
property ssl
ssl?: boolean | MariaSslConfiguration;
property streamHWM
streamHWM?: number;
property unixSocket
unixSocket?: string;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface MariaSslConfiguration
interface MariaSslConfiguration {}
property ca
ca?: string;
property capath
capath?: string;
property cert
cert?: string;
property cipher
cipher?: string;
property key
key?: string;
property rejectUnauthorized
rejectUnauthorized?: boolean;
method expirationChecker
expirationChecker: () => boolean;
interface Migration
interface Migration {}
interface MigrationSource
interface MigrationSource<TMigrationSpec> {}
method getMigration
getMigration: (migration: TMigrationSpec) => Promise<Migration>;
method getMigrationName
getMigrationName: (migration: TMigrationSpec) => string;
method getMigrations
getMigrations: (loadExtensions: readonly string[]) => Promise<TMigrationSpec[]>;
interface Migrator
interface Migrator {}
method currentVersion
currentVersion: (config?: MigratorConfig) => Promise<string>;
method down
down: (config?: MigratorConfig) => Promise<any>;
method forceFreeMigrationsLock
forceFreeMigrationsLock: (config?: MigratorConfig) => Promise<any>;
method latest
latest: (config?: MigratorConfig) => Promise<any>;
method list
list: (config?: MigratorConfig) => Promise<any>;
method make
make: (name: string, config?: MigratorConfig) => Promise<string>;
method rollback
rollback: (config?: MigratorConfig, all?: boolean) => Promise<any>;
method status
status: (config?: MigratorConfig) => Promise<number>;
method up
up: (config?: MigratorConfig) => Promise<any>;
interface MigratorConfig
interface MigratorConfig {}
property database
database?: string;
property directory
directory?: string | readonly string[];
property disableMigrationsListValidation
disableMigrationsListValidation?: boolean;
property disableTransactions
disableTransactions?: boolean;
property extension
extension?: string;
property loadExtensions
loadExtensions?: readonly string[];
property migrationSource
migrationSource?: MigrationSource<unknown>;
property name
name?: string;
property schemaName
schemaName?: string;
property sortDirsSeparately
sortDirsSeparately?: boolean;
property stub
stub?: string;
property tableName
tableName?: string;
interface MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig
interface MsSqlAzureActiveDirectoryAccessTokenAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig
interface MsSqlAzureActiveDirectoryMsiAppServiceAuthenticationConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId?: string;
If you user want to connect to an Azure app service using a specific client account they need to provide
clientId
asscoiate to their created idnetity.This is optional for retrieve token from azure web app service
property msiEndpoint
msiEndpoint?: string;
A msi app service environment need to provide
msiEndpoint
for retriving the accesstoken.
property msiSecret
msiSecret?: string;
A msi app service environment need to provide
msiSecret
for retriving the accesstoken.
property type
type: 'azure-active-directory-msi-app-service';
interface MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig
interface MsSqlAzureActiveDirectoryMsiVmAuthenticationConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId?: string;
If you user want to connect to an Azure app service using a specific client account they need to provide
clientId
asscoiate to their created idnetity.This is optional for retrieve token from azure web app service
property msiEndpoint
msiEndpoint?: string;
A user need to provide
msiEndpoint
for retriving the accesstoken.
property type
type: 'azure-active-directory-msi-vm';
interface MsSqlAzureActiveDirectoryPasswordAuthenticationConfig
interface MsSqlAzureActiveDirectoryPasswordAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MsSqlAzureActiveDirectoryServicePrincipalSecretConfig
interface MsSqlAzureActiveDirectoryServicePrincipalSecretConfig extends MsSqlConnectionConfigBase {}
property clientId
clientId: string;
Application (
client
) ID from your registered Azure application
property clientSecret
clientSecret: string;
The created
client secret
for this registered Azure application
property tenantId
tenantId: string;
Directory (
tenant
) ID from your registered Azure application
property type
type: 'azure-active-directory-service-principal-secret';
interface MsSqlColumnBuilder
interface MsSqlColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ predicate?: QueryBuilder }>) => ColumnBuilder;
interface MsSqlConnectionConfigBase
interface MsSqlConnectionConfigBase {}
property connectionTimeout
connectionTimeout?: number;
property database
database: string;
property domain
domain?: string;
property driver
driver?: string;
property options
options?: Readonly<{ encrypt?: boolean; instanceName?: string; useUTC?: boolean; tdsVersion?: string; appName?: string; abortTransactionOnError?: boolean; trustedConnection?: boolean; enableArithAbort?: boolean; isolationLevel?: | 'READ_UNCOMMITTED' | 'READ_COMMITTED' | 'REPEATABLE_READ' | 'SERIALIZABLE' | 'SNAPSHOT'; maxRetriesOnTransientErrors?: number; multiSubnetFailover?: boolean; packetSize?: number; trustServerCertificate?: boolean; mapBinding?: (value: any) => { value: any; type: any } | undefined;}>;
property parseJSON
parseJSON?: boolean;
property password
password?: string;
property pool
pool?: Readonly<{ min?: number; max?: number; idleTimeoutMillis?: number; maxWaitingClients?: number; testOnBorrow?: boolean; acquireTimeoutMillis?: number; fifo?: boolean; priorityRange?: number; autostart?: boolean; evictionRunIntervalMillis?: number; numTestsPerRun?: number; softIdleTimeoutMillis?: number; Promise?: any;}>;
property port
port?: number;
property requestTimeout
requestTimeout?: number;
property server
server: string;
property stream
stream?: boolean;
property type
type?: MsSqlAuthenticationTypeOptions;
property userName
userName?: string;
method expirationChecker
expirationChecker: () => boolean;
interface MsSqlDefaultAuthenticationConfig
interface MsSqlDefaultAuthenticationConfig extends MsSqlConnectionConfigBase {}
property type
type?: 'default' | never;
interface MsSqlNtlmAuthenticationConfig
interface MsSqlNtlmAuthenticationConfig extends MsSqlConnectionConfigBase {}
interface MultikeyForeignConstraintBuilder
interface MultikeyForeignConstraintBuilder {}
method references
references: (columnNames: readonly string[]) => ReferencingColumnBuilder;
interface MySql2ConnectionConfig
interface MySql2ConnectionConfig extends MySqlConnectionConfig {}
property authPlugins
authPlugins?: { [pluginName: string]: (pluginMetadata: any) => (pluginData: any) => any;};
property authSwitchHandler
authSwitchHandler?: (data: any, callback: () => void) => any;
property charsetNumber
charsetNumber?: number;
property compress
compress?: boolean;
property connectAttributes
connectAttributes?: { [attrNames: string]: any };
property enableKeepAlive
enableKeepAlive?: boolean;
property keepAliveInitialDelay
keepAliveInitialDelay?: number;
property maxPreparedStatements
maxPreparedStatements?: number;
property namedPlaceholders
namedPlaceholders?: boolean;
property nestTables
nestTables?: boolean | string;
property passwordSha1
passwordSha1?: string;
property rowsAsArray
rowsAsArray?: boolean;
property stream
stream?: boolean | ((opts: any) => Stream) | Stream;
property uri
uri?: string;
interface MySqlAlterColumnBuilder
interface MySqlAlterColumnBuilder extends AlterColumnBuilder {}
interface MySqlColumnBuilder
interface MySqlColumnBuilder extends ColumnBuilder {}
method index
index: ( indexName?: string, options?: Readonly<{ indexType?: string; storageEngineIndexType?: storageEngineIndexType; }>) => ColumnBuilder;
interface MySqlConnectionConfig
interface MySqlConnectionConfig {}
property bigNumberStrings
bigNumberStrings?: boolean;
property charset
charset?: string;
property connectTimeout
connectTimeout?: number;
property database
database?: string;
property dateStrings
dateStrings?: boolean;
property debug
debug?: boolean;
property decimalNumbers
decimalNumbers?: boolean;
property flags
flags?: string;
property host
host?: string;
property insecureAuth
insecureAuth?: boolean;
property localAddress
localAddress?: string;
property multipleStatements
multipleStatements?: boolean;
property password
password?: string;
property port
port?: number;
property queryFormat
queryFormat?: (query: string, values: any) => string;
property socketPath
socketPath?: string;
property ssl
ssl?: string | MariaSslConfiguration;
property stringifyObjects
stringifyObjects?: boolean;
property supportBigNumbers
supportBigNumbers?: boolean;
property timezone
timezone?: string;
property trace
trace?: boolean;
property typeCast
typeCast?: any;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface OnConflictQueryBuilder
interface OnConflictQueryBuilder<TRecord extends {}, TResult> {}
method ignore
ignore: () => QueryBuilder<TRecord, TResult>;
method merge
merge: { (mergeColumns?: (keyof ResolveTableType<TRecord, 'update'>)[]): QueryBuilder< TRecord, TResult >; ( data?: Extract< Readonly< Partial< AnyOrUnknownToOther< MaybeRawRecord<ResolveTableType<TRecord, 'update'>>, {} > > >, object > ): QueryBuilder<TRecord, TResult>;};
interface OracleDbConnectionConfig
interface OracleDbConnectionConfig {}
property connectString
connectString?: string;
property database
database?: string;
property debug
debug?: boolean;
property domain
domain?: string;
property host
host: string;
property instanceName
instanceName?: string;
property password
password?: string;
property requestTimeout
requestTimeout?: number;
property user
user: string;
method expirationChecker
expirationChecker: () => boolean;
interface OrderBy
interface OrderBy<TRecord extends {} = any, TResult = unknown[]> {}
call signature
( columnName: keyof TRecord | QueryBuilder, order?: 'asc' | 'desc', nulls?: 'first' | 'last'): QueryBuilder<TRecord, TResult>;
call signature
( columnName: string | QueryBuilder, order?: string, nulls?: string): QueryBuilder<TRecord, TResult>;
call signature
( columnDefs: Array< | keyof TRecord | Readonly<{ column: keyof TRecord | QueryBuilder; order?: 'asc' | 'desc'; nulls?: 'first' | 'last'; }> >): QueryBuilder<TRecord, TResult>;
call signature
( columnDefs: Array< | string | Readonly<{ column: string | QueryBuilder; order?: string; nulls?: string; }> >): QueryBuilder<TRecord, TResult>;
interface PartitionBy
interface PartitionBy<TRecord extends {} = any, TResult = unknown[]> extends OrderBy<TRecord, TResult> {}
interface PgConnectionConfig
interface PgConnectionConfig {}
property application_name
application_name?: string;
property connectionString
connectionString?: string;
property connectionTimeoutMillis
connectionTimeoutMillis?: number;
property database
database?: string;
property host
host?: string;
property idle_in_transaction_session_timeout
idle_in_transaction_session_timeout?: number;
property keepAlive
keepAlive?: boolean;
property keepAliveInitialDelayMillis
keepAliveInitialDelayMillis?: number;
property options
options?: string;
property parseInputDatesAsUTC
parseInputDatesAsUTC?: boolean;
property password
password?: string | (() => string | Promise<string>);
property port
port?: number;
property query_timeout
query_timeout?: number;
property ssl
ssl?: boolean | ConnectionOptions;
property statement_timeout
statement_timeout?: false | number;
property stream
stream?: () => stream.Duplex | stream.Duplex | undefined;
property types
types?: PgCustomTypesConfig;
property user
user?: string;
method expirationChecker
expirationChecker: () => boolean;
interface PgCustomTypesConfig
interface PgCustomTypesConfig {}
property getTypeParser
getTypeParser: PgGetTypeParser;
interface PoolConfig
interface PoolConfig {}
property acquireTimeoutMillis
acquireTimeoutMillis?: number;
property afterCreate
afterCreate?: Function;
property createRetryIntervalMillis
createRetryIntervalMillis?: number;
property createTimeoutMillis
createTimeoutMillis?: number;
property destroyTimeoutMillis
destroyTimeoutMillis?: number;
property idleTimeoutMillis
idleTimeoutMillis?: number;
property log
log?: (message: string, logLevel: string) => void;
property max
max?: number;
property min
min?: number;
property name
name?: string;
property priorityRange
priorityRange?: number;
property propagateCreateError
propagateCreateError?: boolean;
property reapIntervalMillis
reapIntervalMillis?: number;
property refreshIdle
refreshIdle?: boolean;
property returnToHead
returnToHead?: boolean;
interface PostgreSqlColumnBuilder
interface PostgreSqlColumnBuilder extends ColumnBuilder {}
method index
index: { ( indexName?: string, options?: Readonly<{ indexType?: string; predicate?: QueryBuilder }> ): ColumnBuilder; (indexName?: string, indexType?: string): ColumnBuilder;};
interface QueryBuilder
interface QueryBuilder<TRecord extends {} = any, TResult = any> extends QueryInterface<TRecord, TResult>, ChainableInterface<ResolveResult<TResult>> {}
property and
and: QueryBuilder<TRecord, TResult>;
property client
client: Client;
property not
not: QueryBuilder<TRecord, TResult>;
property or
or: QueryBuilder<TRecord, TResult>;
method clone
clone: () => QueryBuilder<TRecord, TResult>;
method columnInfo
columnInfo: { (column: keyof DeferredKeySelection.Resolve<TRecord>): Promise<ColumnInfo>; (): Promise<Record<keyof DeferredKeySelection.Resolve<TRecord>, ColumnInfo>>;};
method forKeyShare
forKeyShare: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forNoKeyUpdate
forNoKeyUpdate: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forShare
forShare: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method forUpdate
forUpdate: { (...tableNames: string[]): QueryBuilder<TRecord, TResult>; (tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;};
method noWait
noWait: () => QueryBuilder<TRecord, TResult>;
method on
on: (event: string, callback: Function) => QueryBuilder<TRecord, TResult>;
method queryContext
queryContext: { (context: any): QueryBuilder<TRecord, TResult>; (): any };
method skipLocked
skipLocked: () => QueryBuilder<TRecord, TResult>;
method timeout
timeout: ( ms: number, options?: { cancel?: boolean }) => QueryBuilder<TRecord, TResult>;
method toSQL
toSQL: () => Sql;
interface QueryInterface
interface QueryInterface<TRecord extends {} = any, TResult = any> {}
property andHaving
andHaving: Having<TRecord, TResult>;
property andHavingNotIn
andHavingNotIn: HavingRange<TRecord, TResult>;
property andWhere
andWhere: Where<TRecord, TResult>;
property andWhereBetween
andWhereBetween: WhereBetween<TRecord, TResult>;
property andWhereILike
andWhereILike: Where<TRecord, TResult>;
property andWhereJsonNotSubsetOf
andWhereJsonNotSubsetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonNotSupersetOf
andWhereJsonNotSupersetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonObject
andWhereJsonObject: WhereJsonObject<TRecord, TResult>;
property andWhereJsonPath
andWhereJsonPath: WhereJsonPath<TRecord, TResult>;
property andWhereJsonSubsetOf
andWhereJsonSubsetOf: WhereJsonObject<TRecord, TResult>;
property andWhereJsonSupersetOf
andWhereJsonSupersetOf: WhereJsonObject<TRecord, TResult>;
property andWhereLike
andWhereLike: Where<TRecord, TResult>;
property andWhereNot
andWhereNot: Where<TRecord, TResult>;
property andWhereNotBetween
andWhereNotBetween: WhereBetween<TRecord, TResult>;
property andWhereNotJsonObject
andWhereNotJsonObject: WhereJsonObject<TRecord, TResult>;
property andWhereRaw
andWhereRaw: WhereRaw<TRecord, TResult>;
property as
as: As<TRecord, TResult>;
property avg
avg: TypePreservingAggregation<TRecord, TResult>;
property avgDistinct
avgDistinct: TypePreservingAggregation<TRecord, TResult>;
property column
column: Select<TRecord, TResult>;
property columns
columns: Select<TRecord, TResult>;
property comment
comment: Comment<TRecord, TResult>;
property count
count: AsymmetricAggregation< TRecord, TResult, Lookup<ResultTypes.Registry, 'Count', number | string>>;
property countDistinct
countDistinct: AsymmetricAggregation< TRecord, TResult, Lookup<ResultTypes.Registry, 'Count', number | string>>;
property crossJoin
crossJoin: Join<TRecord, TResult>;
property denseRank
denseRank: AnalyticFunction<TRecord, TResult>;
property distinct
distinct: Distinct<TRecord, TResult>;
property distinctOn
distinctOn: DistinctOn<TRecord, TResult>;
property except
except: Except<TRecord, TResult>;
property first
first: Select< TRecord, DeferredKeySelection.AddUnionMember<UnwrapArrayMember<TResult>, undefined>>;
property from
from: Table<TRecord, TResult>;
property fromRaw
fromRaw: Table<TRecord, TResult>;
property fullOuterJoin
fullOuterJoin: Join<TRecord, TResult>;
property groupBy
groupBy: GroupBy<TRecord, TResult>;
property groupByRaw
groupByRaw: RawQueryBuilder<TRecord, TResult>;
property having
having: Having<TRecord, TResult>;
property havingBetween
havingBetween: HavingRange<TRecord, TResult>;
property havingIn
havingIn: HavingRange<TRecord, TResult>;
property havingNotBetween
havingNotBetween: HavingRange<TRecord, TResult>;
property havingNotIn
havingNotIn: HavingRange<TRecord, TResult>;
property havingNotNull
havingNotNull: HavingNull<TRecord, TResult>;
property havingNull
havingNull: HavingNull<TRecord, TResult>;
property havingRaw
havingRaw: RawQueryBuilder<TRecord, TResult>;
property havingWrapped
havingWrapped: WhereWrapped<TRecord, TResult>;
property hintComment
hintComment: HintComment<TRecord, TResult>;
property innerJoin
innerJoin: Join<TRecord, TResult>;
property intersect
intersect: Intersect<TRecord, TResult>;
property into
into: Table<TRecord, TResult>;
property join
join: Join<TRecord, TResult>;
property joinRaw
joinRaw: JoinRaw<TRecord, TResult>;
property jsonExtract
jsonExtract: JsonExtract<TRecord, TResult>;
property jsonInsert
jsonInsert: JsonInsert<TRecord, TResult>;
property jsonRemove
jsonRemove: JsonRemove<TRecord, TResult>;
property jsonSet
jsonSet: JsonSet<TRecord, TResult>;
property leftJoin
leftJoin: Join<TRecord, TResult>;
property leftOuterJoin
leftOuterJoin: Join<TRecord, TResult>;
property max
max: TypePreservingAggregation<TRecord, TResult>;
property min
min: TypePreservingAggregation<TRecord, TResult>;
property orderBy
orderBy: OrderBy<TRecord, TResult>;
property orderByRaw
orderByRaw: RawQueryBuilder<TRecord, TResult>;
property orHaving
orHaving: Having<TRecord, TResult>;
property orHavingBetween
orHavingBetween: HavingRange<TRecord, TResult>;
property orHavingNotBetween
orHavingNotBetween: HavingRange<TRecord, TResult>;
property orHavingNotIn
orHavingNotIn: HavingRange<TRecord, TResult>;
property orHavingNotNull
orHavingNotNull: HavingNull<TRecord, TResult>;
property orHavingNull
orHavingNull: HavingNull<TRecord, TResult>;