All files / third-parties/drizzle-adapter/src/ydb dialect.types.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133                                                                                                                                                                                                                                                                         
import type {
	BuildRelationalQueryResult,
	DBQueryConfig,
	Relation,
	TableRelationalConfig,
	TablesRelationalConfig,
} from 'drizzle-orm/relations'
import type { MigrationMeta } from 'drizzle-orm/migrator'
import type { SQL, SQLWrapper } from 'drizzle-orm/sql/sql'
import type { Subquery } from 'drizzle-orm/subquery'
import type { UpdateSet } from 'drizzle-orm/utils'
import type { YdbSelectedFieldsOrdered } from '../ydb-core/result-mapping.js'
import type { YdbColumn } from '../ydb-core/columns/common.js'
import type {
	YdbFlattenConfig,
	YdbMatchRecognizeConfig,
	YdbSampleConfig,
	YdbUniqueDistinctHint,
	YdbWindowClause,
} from '../ydb-core/query-builders/select-syntax.js'
import type { YdbTable } from '../ydb-core/table.js'
import type { YdbMigrationTableConfig } from './migration-ddl.js'
 
export type YdbJoinType =
	| 'inner'
	| 'left'
	| 'right'
	| 'full'
	| 'cross'
	| 'left semi'
	| 'right semi'
	| 'left only'
	| 'right only'
	| 'exclusion'
 
export interface YdbJoinConfig {
	table: unknown
	joinType: YdbJoinType
	alias?: string | undefined
	on?: SQL | undefined
}
 
export interface YdbSetOperatorSource {
	getSelectedFields(): Record<string, unknown>
	getSQL(selectionAliases?: string[]): SQL
}
 
export interface YdbSetOperatorConfig {
	type: 'union' | 'intersect' | 'except'
	isAll: boolean
	rightSelect: YdbSetOperatorSource
	orderBy?: SQLWrapper[] | undefined
	limit?: number | undefined
	offset?: number | undefined
}
 
export interface YdbSelectConfig {
	table?: unknown | undefined
	fields: Record<string, unknown>
	fieldsFlat?: YdbSelectedFieldsOrdered | undefined
	withList?: Subquery[] | undefined
	joins?: YdbJoinConfig[] | undefined
	where?: SQL | undefined
	groupBy?: SQLWrapper[] | undefined
	groupByCompact?: boolean | undefined
	having?: SQL | undefined
	windows?: YdbWindowClause[] | undefined
	orderBy?: SQLWrapper[] | undefined
	assumeOrderBy?: SQLWrapper[] | undefined
	limit?: number | undefined
	offset?: number | undefined
	intoResult?: string | undefined
	without?: SQLWrapper[] | undefined
	flatten?: YdbFlattenConfig | undefined
	sample?: YdbSampleConfig | undefined
	matchRecognize?: YdbMatchRecognizeConfig | SQLWrapper | undefined
	uniqueDistinctHints?: YdbUniqueDistinctHint[] | undefined
	distinct?: boolean | undefined
	distinctOn?: SQLWrapper[] | undefined
	selectionAliases?: string[] | undefined
	setOperators: YdbSetOperatorConfig[]
}
 
export interface YdbInsertConfig {
	table: YdbTable
	values: Record<string, unknown>[] | SQL | SQLWrapper
	select?: boolean | undefined
	withList?: Subquery[] | undefined
	command?: 'insert' | 'upsert' | 'replace' | undefined
	columnEntries?: Array<[string, YdbColumn]> | undefined
	returning?: YdbSelectedFieldsOrdered | undefined
}
 
export interface YdbUpdateConfig {
	table: YdbTable
	set?: UpdateSet | Record<string, unknown> | undefined
	where?: SQL | undefined
	withList?: Subquery[] | undefined
	on?: SQL | SQLWrapper | undefined
	returning?: YdbSelectedFieldsOrdered | undefined
	batch?: boolean | undefined
}
 
export interface YdbDeleteConfig {
	table: YdbTable | SQLWrapper
	where?: SQL | undefined
	using?: SQLWrapper[] | undefined
	withList?: Subquery[] | undefined
	on?: SQL | SQLWrapper | undefined
	returning?: YdbSelectedFieldsOrdered | undefined
	batch?: boolean | undefined
}
 
export type YdbFlatRelationalQueryConfig = DBQueryConfig<'many', boolean>
 
export interface YdbRelationalQueryConfig {
	fullSchema: Record<string, unknown>
	schema: TablesRelationalConfig
	tableNamesMap: Record<string, string>
	table: YdbTable
	tableConfig: TableRelationalConfig
	queryConfig: true | YdbFlatRelationalQueryConfig
	tableAlias: string
	joinOn?: SQL | undefined
	nestedQueryRelation?: Relation | undefined
}
 
export type YdbRelationalQueryResult = BuildRelationalQueryResult<YdbTable, YdbColumn>
 
export interface YdbDialectMigrationConfig extends YdbMigrationTableConfig {}
 
export type YdbDialectMigration = MigrationMeta & { name?: string }