Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

§Classes

AggregateFunctionBuilder
AliasedAggregateFunctionBuilder

AggregateFunctionBuilder with an alias. The result of calling AggregateFunctionBuilder.as.

AliasedExpressionWrapper
AliasedJSONPathBuilder
AlterColumnBuilder
AlteredColumnBuilder

Allows us to force consumers to do exactly one alteration to a column.

AlterTableBuilder

This builder can be used to create a alter table query.

AlterTableColumnAlteringBuilder
AndWrapper
CamelCasePlugin

A plugin that converts snake_case identifiers in the database into camelCase in the javascript side.

CaseBuilder
CaseEndBuilder
CaseThenBuilder
CaseWhenBuilder
ColumnDefinitionBuilder
ConnectionBuilder
CreateIndexBuilder
CreateSchemaBuilder
CreateTableBuilder

This builder can be used to create a create table query.

CreateTypeBuilder
CreateViewBuilder
DeduplicateJoinsPlugin

Plugin that removes duplicate joins from queries.

DefaultConnectionProvider
DefaultQueryCompiler
DefaultQueryExecutor
DeleteQueryBuilder
DeleteResult
DialectAdapterBase abstract

A basic implementation of DialectAdapter with sensible default values. 3rd party dialects can extend this instead of implementing the DialectAdapter interface from scratch. That way all new settings will get default values when they are added and there will be less breaking changes.

DropIndexBuilder
DropSchemaBuilder
DropTableBuilder
DropTypeBuilder
DropViewBuilder
DummyDriver

A driver that does absolutely nothing.

DynamicModule
ExpressionWrapper
FileMigrationProvider

Reads all migrations from a folder in node.js.

ForeignKeyConstraintBuilder
InsertQueryBuilder
InsertResult

The result of an insert query.

JoinBuilder
JSONPathBuilder
Kysely

The main Kysely class.

Log
MatchedThenableMergeQueryBuilder
MergeQueryBuilder
MergeResult
Migrator

A class for running migrations.

MssqlAdapter
MssqlDialect

MS SQL Server dialect that uses the tedious library.

MssqlDriver
MssqlIntrospector
MssqlQueryCompiler
MysqlAdapter
MysqlDialect

MySQL dialect that uses the mysql2 library.

MysqlDriver
MysqlIntrospector
MysqlQueryCompiler
NoopQueryExecutor

A QueryExecutor subclass that can be used when you don't have a QueryCompiler, ConnectionProvider or any other needed things to actually execute queries.

NoResultError
NotMatchedThenableMergeQueryBuilder
OnConflictBuilder
OnConflictDoNothingBuilder
OnConflictUpdateBuilder
OperationNodeTransformer

Transforms an operation node tree into another one.

OperationNodeVisitor abstract
OrWrapper
ParseJSONResultsPlugin

Parses JSON strings in query results into JSON objects.

PostgresAdapter
PostgresDialect

PostgreSQL dialect that uses the pg library.

PostgresDriver
PostgresIntrospector
PostgresQueryCompiler
QueryCreator
SchemaModule

Provides methods for building database schema.

SingleConnectionProvider
SqliteAdapter
SqliteDialect

SQLite dialect that uses the better-sqlite3 library.

SqliteDriver
SqliteIntrospector
SqliteQueryCompiler
TarnPool
TediousRequest
Transaction
TransactionBuilder
TraversedJSONPathBuilder
UpdateQueryBuilder
UpdateResult
WheneableMergeQueryBuilder
WithSchemaPlugin

§Variables

AddColumnNode
AddConstraintNode
AggregateFunctionNode
AliasNode
AlterColumnNode
AlterTableNode
AndNode
ARITHMETIC_OPERATORS
BINARY_OPERATORS
BinaryOperationNode
CaseNode
CheckConstraintNode
ColumnDefinitionNode
ColumnNode
ColumnUpdateNode
CommonTableExpressionNameNode
CommonTableExpressionNode
COMPARISON_OPERATORS
CompiledQuery
CreateIndexNode
CreateSchemaNode
CreateTableNode
CreateTypeNode
CreateViewNode
DataTypeNode
DEFAULT_ALLOW_UNORDERED_MIGRATIONS
DEFAULT_MIGRATION_LOCK_TABLE
DEFAULT_MIGRATION_TABLE
DefaultInsertValueNode
DefaultValueNode
DeleteQueryNode
DropColumnNode
DropConstraintNode
DropIndexNode
DropSchemaNode
DropTableNode
DropTypeNode
DropViewNode
ExplainNode
FetchNode
ForeignKeyConstraintNode
FromNode
GeneratedNode
GroupByItemNode
GroupByNode
HavingNode
IdentifierNode
InsertQueryNode
JoinNode
JSON_OPERATORS
JSONOperatorChainNode
JSONPathLegNode
JSONPathNode
JSONReferenceNode
LimitNode
ListNode
LOG_LEVELS
MatchedNode
MergeQueryNode
MIGRATION_LOCK_ID
ModifyColumnNode
NO_MIGRATIONS
NOOP_QUERY_EXECUTOR
OffsetNode
ON_COMMIT_ACTIONS
ON_MODIFY_FOREIGN_ACTIONS
OnConflictNode
OnDuplicateKeyNode
OnNode
OperatorNode
OPERATORS
OrderByItemNode
OrderByNode
OrNode
OverNode
ParensNode
PartitionByItemNode
PartitionByNode
PrimaryConstraintNode
PrimitiveValueListNode
QueryNode
RawNode
ReferenceNode
ReferencesNode
RenameColumnNode
ReturningNode
SelectAllNode
SelectionNode
SelectQueryNode
SetOperationNode
sql
TableNode
TopNode
TRANSACTION_ISOLATION_LEVELS
TupleNode
UNARY_FILTER_OPERATORS
UNARY_OPERATORS
UnaryOperationNode
UniqueConstraintNode
UpdateQueryNode
UsingNode
ValueListNode
ValueNode
ValuesNode
WhenNode
WhereNode
WithNode

§Functions

createFunctionModule
createRawBuilder
createSelectQueryBuilder
expressionBuilder
isAliasedExpression
isArithmeticOperator
isBinaryOperator
isColumnDataType
isComparisonOperator
isCompilable
isExpression
isJSONOperator
isKyselyProps
isNoResultErrorConstructor
isOperationNodeSource
isOperator
logOnce

Use for system-level logging, such as deprecation messages. Logs a message and ensures it won't be logged again.

§Interfaces

AddColumnNode
AddConstraintNode
AggregateFunctionBuilderProps
AggregateFunctionNode
AliasableExpression

An expression with an as method.

AliasedExpression

A type that holds an expression and an alias for it.

AliasedRawBuilder

RawBuilder with an alias. The result of calling RawBuilder.as.

AliasedSelectQueryBuilder
AliasNode
AlterColumnNode
AlterTableBuilderProps
AlterTableColumnAlteringBuilderProps
AlterTableNode
AndNode
BinaryOperationNode
CamelCasePluginOptions
CaseNode
CheckConstraintNode
ColumnAlteringInterface
ColumnDefinitionNode
ColumnMetadata
ColumnNode
ColumnUpdateNode
CommonTableExpressionNameNode
CommonTableExpressionNode
Compilable
CompiledQuery
ConnectionProvider
CreateIndexBuilderProps
CreateIndexNode
CreateSchemaBuilderProps
CreateSchemaNode
CreateTableBuilderProps
CreateTableNode
CreateTypeBuilderProps
CreateTypeNode
CreateViewBuilderProps
CreateViewNode
DatabaseConnection

A single connection to the database engine.

DatabaseIntrospector

An interface for getting the database metadata (names of the tables and columns etc.)

DatabaseMetadata
DatabaseMetadataOptions
DataTypeNode
DefaultInsertValueNode
DefaultValueNode
DeleteQueryBuilderProps
DeleteQueryNode
Dialect

A Dialect is the glue between Kysely and the underlying database engine.

DialectAdapter

A DialectAdapter encapsulates all differences between dialects outside of Driver and QueryCompiler.

Driver

A Driver creates and releases {@link DatabaseConnection | database connections} and is also responsible for connection pooling (if the dialect supports pooling).

DropColumnNode
DropConstraintNode
DropIndexBuilderProps
DropIndexNode
DropSchemaBuilderProps
DropSchemaNode
DropTableBuilderProps
DropTableNode
DropTypeBuilderProps
DropTypeNode
DropViewBuilderProps
DropViewNode
ErrorLogEvent
Explainable
ExplainNode
Expression

Expression represents an arbitrary SQL expression with a type.

ExpressionBuilder
FetchNode
FileMigrationProviderFS
FileMigrationProviderPath
FileMigrationProviderProps
ForeignKeyConstraintBuilderInterface
ForeignKeyConstraintNode
FromNode
FunctionModule

Helpers for type safe SQL function calls.

GeneratedNode
GroupByItemNode
GroupByNode
HavingInterface
HavingNode
IdentifierNode
InsertQueryBuilderProps
InsertQueryNode
JoinBuilderProps
JoinNode
JSONOperatorChainNode
JSONPathLegNode
JSONPathNode
JSONReferenceNode
KyselyConfig
KyselyPlugin
KyselyProps
LimitNode
ListNode
MatchedNode
MergeQueryBuilderProps
MergeQueryNode
Migration
MigrationInfo
MigrationLockOptions
MigrationProvider
MigrationResult
MigrationResultSet

All migration methods (migrateTo, migrateToLatest etc.) never throw but return this object instead.

MigratorProps
ModifyColumnNode
MssqlDialectConfig
MysqlDialectConfig

Config for the MySQL dialect.

MysqlOkPacket
MysqlPool

This interface is the subset of mysql2 driver's Pool class that kysely needs.

MysqlPoolConnection
MysqlStream
MysqlStreamOptions
NoMigrations

Type for the NO_MIGRATIONS constant. Never create one of these.

OffsetNode
OnConflictBuilderProps
OnConflictNode
OnDuplicateKeyNode
OnNode
OperationNode
OperationNodeSource
OperatorNode
OrderByItemNode
OrderByNode
OrNode
OverNode
ParensNode
PartitionByItemNode
PartitionByNode
PluginTransformQueryArgs
PluginTransformResultArgs
PostgresCursor
PostgresDialectConfig

Config for the PostgreSQL dialect.

PostgresPool

This interface is the subset of pg driver's Pool class that kysely needs.

PostgresPoolClient
PostgresQueryResult
PostgresStream
PrimaryKeyConstraintNode
PrimitiveValueListNode

This node is basically just a performance optimization over the normal ValueListNode. The queries often contain large arrays of primitive values (for example in a where in list) and we don't want to create a ValueNode for each item in those lists.

QueryCompiler

a QueryCompiler compiles a query expressed as a tree of OperationNodes into SQL.

QueryCreatorProps
QueryExecutor

This interface abstracts away the details of how to compile a query into SQL and execute it. Instead of passing around all those details, SelectQueryBuilder and other classes that execute queries can just pass around and instance of QueryExecutor.

QueryExecutorProvider
QueryLogEvent
QueryResult
RawBuilder

An instance of this class can be used to create raw SQL snippets or queries.

RawBuilderProps
RawNode
ReferenceNode
ReferencesNode
RenameColumnNode
ReturningInterface
ReturningNode
SchemaMetadata
SelectAllNode
SelectionNode
SelectQueryBuilder
SelectQueryBuilderProps
SelectQueryNode
SetOperationNode
Sql
SqliteDatabase

This interface is the subset of better-sqlite3 driver's Database class that kysely needs.

SqliteDialectConfig

Config for the SQLite dialect.

SqliteStatement
Streamable
TableMetadata
TableNode
Tarn
TarnPendingRequest
TarnPoolOptions
Tedious
TediousColumnValue
TediousConnection
TediousType
TopNode
TransactionSettings
TupleNode
UnaryOperationNode
UniqueConstraintNode
UpdateQueryBuilderProps
UpdateQueryNode
UsingNode
ValueListNode
ValueNode
ValuesNode
WhenNode
WhereInterface
WhereNode
WithNode

§Type Aliases

AlterColumnBuilderCallback
AlterColumnNodeProps
AlterTableColumnAlterationNode
AlterTableNodeTableProps
AnyAliasedColumn

Just like AnyColumn but with a as <string> suffix.

AnyAliasedColumnWithTable

Just like AnyColumnWithTable but with a as <string> suffix.

AnyColumn

Given a database type and a union of table names in that db, returns a union type with all possible column names.

AnyColumnWithTable

Given a database type and a union of table names in that db, returns a union type with all possible table.column combinations.

ArithmeticOperator
BinaryOperator
CallbackSelection

Turns a SelectCallback into a selection object.

ColumnBuilderCallback
ColumnDataType
ColumnDefinitionBuilderCallback
ColumnDefinitionNodeProps
ColumnType

This type can be used to specify a different type for select, insert and update operations.

ComparisonOperator
ComparisonOperatorExpression
ConstraintNode
CreateIndexNodeProps
CreateSchemaNodeParams
CreateTableNodeParams
CreateTypeNodeParams
CreateViewNodeParams
DataTypeParams
DeleteQueryBuilderWithFullJoin
DeleteQueryBuilderWithInnerJoin
DeleteQueryBuilderWithLeftJoin
DeleteQueryBuilderWithRightJoin
DropConstraintNodeProps
DropIndexNodeProps
DropSchemaNodeParams
DropTablexNodeParams
DropTypeNodeParams
DropViewNodeParams
Equals

Evaluates to true if the types T and U are equal.

ExistsExpression
ExplainFormat
ExpressionOrFactory
ExtractTypeFromReferenceExpression
ExtractTypeFromStringReference
ExtractWheneableMergeQueryBuilder
FetchModifier
FilterObject
ForeignKeyConstraintBuilderCallback
ForeignKeyConstraintNodeProps
Generated

A shortcut for defining database-generated columns. The type is the same for all selects, inserts and updates but the column is optional for inserts and updates.

GeneratedAlways

A shortcut for defining columns that are only database-generated (like postgres GENERATED ALWAYS AS IDENTITY). No insert/update is allowed.

GeneratedNodeParams
IndexType
InferResult

A helper type that allows inferring a select/insert/update/delete query's result type from a query builder or compiled query.

Insertable

Given a table interface, extracts the insert type from all ColumnType types.

InsertObject
InsertQueryNodeProps
InsertType
IsolationLevel
JoinCallbackExpression
JoinReferenceExpression
JoinType
JSONColumnType

A shortcut for defining JSON columns, which are by default inserted/updated as stringified JSON strings.

JSONOperator
JSONOperatorWith$
JSONPathLegType
LogConfig
LogEvent
Logger
LogLevel
MysqlQueryResult
NonNullableInsertKeys

Keys of R whose InsertType values can't be null or undefined.

NoResultErrorConstructor
NotNull

A type constant for marking a column as not null. Can be used with $narrowPartial.

Nullable

Makes all properties of object type T nullable.

NullableInsertKeys

Keys of R whose InsertType values can be null or undefined.

OnCommitAction
OnConflictDatabase
OnConflictNodeProps
OnConflictTables
OnDuplicateKeyNodeProps
OnModifyForeignAction
OperandExpression

Like Expression<V> but also accepts a select query with an output type extending Record<string, V>. This type is useful because SQL treats records with a single column as single values.

OperandValueExpression
OperandValueExpressionOrList
OperationNodeKind
Operator
OrderByDirectionExpression
OrderByExpression
OverBuilderCallback
PostgresCursorConstructor
QueryNode
ReferenceExpression
ReferenceExpressionOrList
RootOperationNode
Selectable

Given a table interface, extracts the select type from all ColumnType types.

SelectArg
SelectCallback
SelectExpression
Selection

Turns a SelectExpression or a union of them into a selection object.

SelectQueryBuilderWithFullJoin
SelectQueryBuilderWithInnerJoin
SelectQueryBuilderWithLeftJoin
SelectQueryBuilderWithRightJoin
SelectType
SetOperator
SimpleReferenceExpression
SimpleTableReference
Simplify
SqlBool
StringReference
TableExpression
TableExpressionOrList
TediousIsolationLevel
TediousTypes
TopModifier
UnaryFilterOperator
UnaryOperator
UniqueConstraintNodeProps
UnknownRow

Represents a database row whose column names and their types are unknown.

Updateable

Given a table interface, extracts the update type from all ColumnType types.

UpdateKeys

Keys of R whose UpdateType values are not never

UpdateObject
UpdateQueryBuilderWithFullJoin
UpdateQueryBuilderWithInnerJoin
UpdateQueryBuilderWithLeftJoin
UpdateQueryBuilderWithRightJoin
UpdateType
UpdateValuesNode
ValueExpression
ValueExpressionOrList
ValuesItemNode
WithNodeParams