drizzle-orm
Advanced tools
Comparing version 0.38.1 to 0.38.2-019d9b0
@@ -42,3 +42,4 @@ import { entityKind } from "../entity.js"; | ||
private buildOrderBy; | ||
buildSelectQuery({ withList, fields, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClause, distinct, setOperators, }: MySqlSelectConfig): SQL; | ||
private buildIndex; | ||
buildSelectQuery({ withList, fields, fieldsFlat, where, having, table, joins, orderBy, groupBy, limit, offset, lockingClause, distinct, setOperators, useIndex, forceIndex, ignoreIndex, }: MySqlSelectConfig): SQL; | ||
buildSetOperations(leftSelect: SQL, setOperators: MySqlSelectConfig['setOperators']): SQL; | ||
@@ -45,0 +46,0 @@ buildSetOperationQuery({ leftSelect, setOperator: { type, isAll, rightSelect, limit, orderBy, offset }, }: { |
@@ -167,2 +167,8 @@ import { aliasedTable, aliasedTableColumn, mapColumnsInAliasedSQLToAlias, mapColumnsInSQLToAlias } from "../alias.js"; | ||
} | ||
buildIndex({ | ||
indexes, | ||
indexFor | ||
}) { | ||
return indexes && indexes.length > 0 ? sql` ${sql.raw(indexFor)} INDEX (${sql.raw(indexes.join(`, `))})` : void 0; | ||
} | ||
buildSelectQuery({ | ||
@@ -182,3 +188,6 @@ withList, | ||
distinct, | ||
setOperators | ||
setOperators, | ||
useIndex, | ||
forceIndex, | ||
ignoreIndex | ||
}) { | ||
@@ -219,4 +228,7 @@ const fieldsList = fieldsFlat ?? orderSelectedFields(fields); | ||
const alias = tableName === origTableName ? void 0 : joinMeta.alias; | ||
const useIndexSql2 = this.buildIndex({ indexes: joinMeta.useIndex, indexFor: "USE" }); | ||
const forceIndexSql2 = this.buildIndex({ indexes: joinMeta.forceIndex, indexFor: "FORCE" }); | ||
const ignoreIndexSql2 = this.buildIndex({ indexes: joinMeta.ignoreIndex, indexFor: "IGNORE" }); | ||
joinsArray.push( | ||
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}` | ||
sql`${sql.raw(joinMeta.joinType)} join${lateralSql} ${tableSchema ? sql`${sql.identifier(tableSchema)}.` : void 0}${sql.identifier(origTableName)}${useIndexSql2}${forceIndexSql2}${ignoreIndexSql2}${alias && sql` ${sql.identifier(alias)}`} on ${joinMeta.on}` | ||
); | ||
@@ -248,2 +260,5 @@ } else if (is(table2, View)) { | ||
const offsetSql = offset ? sql` offset ${offset}` : void 0; | ||
const useIndexSql = this.buildIndex({ indexes: useIndex, indexFor: "USE" }); | ||
const forceIndexSql = this.buildIndex({ indexes: forceIndex, indexFor: "FORCE" }); | ||
const ignoreIndexSql = this.buildIndex({ indexes: ignoreIndex, indexFor: "IGNORE" }); | ||
let lockingClausesSql; | ||
@@ -259,3 +274,3 @@ if (lockingClause) { | ||
} | ||
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`; | ||
const finalQuery = sql`${withSql}select${distinctSql} ${selection} from ${tableSql}${useIndexSql}${forceIndexSql}${ignoreIndexSql}${joinsSql}${whereSql}${groupBySql}${havingSql}${orderBySql}${limitSql}${offsetSql}${lockingClausesSql}`; | ||
if (setOperators.length > 0) { | ||
@@ -262,0 +277,0 @@ return this.buildSetOperations(finalQuery, setOperators); |
@@ -6,3 +6,3 @@ import { entityKind } from "../../entity.js"; | ||
import type { SubqueryWithSelection } from "../subquery.js"; | ||
import type { MySqlTable } from "../table.js"; | ||
import { MySqlTable } from "../table.js"; | ||
import { TypedQueryBuilder } from "../../query-builders/query-builder.js"; | ||
@@ -14,5 +14,12 @@ import type { BuildSubquerySelection, GetSelectTableName, GetSelectTableSelection, JoinNullability, SelectMode, SelectResult } from "../../query-builders/select.types.js"; | ||
import { Subquery } from "../../subquery.js"; | ||
import { type ValueOrArray } from "../../utils.js"; | ||
import type { ValueOrArray } from "../../utils.js"; | ||
import type { IndexBuilder } from "../indexes.js"; | ||
import { MySqlViewBase } from "../view-base.js"; | ||
import type { CreateMySqlSelectFromBuilderMode, GetMySqlSetOperators, LockConfig, LockStrength, MySqlCreateSetOperatorFn, MySqlJoinFn, MySqlSelectConfig, MySqlSelectDynamic, MySqlSelectHKT, MySqlSelectHKTBase, MySqlSelectPrepare, MySqlSelectWithout, MySqlSetOperatorExcludedMethods, MySqlSetOperatorWithResult, SelectedFields, SetOperatorRightSelect } from "./select.types.js"; | ||
export type IndexForHint = IndexBuilder | string; | ||
export type IndexConfig = { | ||
useIndex?: IndexForHint | IndexForHint[]; | ||
forceIndex?: IndexForHint | IndexForHint[]; | ||
ignoreIndex?: IndexForHint | IndexForHint[]; | ||
}; | ||
export declare class MySqlSelectBuilder<TSelection extends SelectedFields | undefined, TPreparedQueryHKT extends PreparedQueryHKTBase, TBuilderMode extends 'db' | 'qb' = 'db'> { | ||
@@ -32,3 +39,3 @@ static readonly [entityKind]: string; | ||
}); | ||
from<TFrom extends MySqlTable | Subquery | MySqlViewBase | SQL>(source: TFrom): CreateMySqlSelectFromBuilderMode<TBuilderMode, GetSelectTableName<TFrom>, TSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection, TSelection extends undefined ? 'single' : 'partial', TPreparedQueryHKT>; | ||
from<TFrom extends MySqlTable | Subquery | MySqlViewBase | SQL>(source: TFrom, onIndex?: TFrom extends MySqlTable ? IndexConfig : 'Index hint configuration is allowed only for MySqlTable and not for subqueries or views'): CreateMySqlSelectFromBuilderMode<TBuilderMode, GetSelectTableName<TFrom>, TSelection extends undefined ? GetSelectTableSelection<TFrom> : TSelection, TSelection extends undefined ? 'single' : 'partial', TPreparedQueryHKT>; | ||
} | ||
@@ -54,3 +61,3 @@ export declare abstract class MySqlSelectQueryBuilderBase<THKT extends MySqlSelectHKTBase, TTableName extends string | undefined, TSelection extends ColumnsSelection, TSelectMode extends SelectMode, TPreparedQueryHKT extends PreparedQueryHKTBase, TNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'> : {}, TDynamic extends boolean = false, TExcludedMethods extends string = never, TResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[], TSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>> extends TypedQueryBuilder<TSelectedFields, TResult> { | ||
protected dialect: MySqlDialect; | ||
constructor({ table, fields, isPartialSelect, session, dialect, withList, distinct }: { | ||
constructor({ table, fields, isPartialSelect, session, dialect, withList, distinct, useIndex, forceIndex, ignoreIndex }: { | ||
table: MySqlSelectConfig['table']; | ||
@@ -63,2 +70,5 @@ fields: MySqlSelectConfig['fields']; | ||
distinct: boolean | undefined; | ||
useIndex?: string[]; | ||
forceIndex?: string[]; | ||
ignoreIndex?: string[]; | ||
}); | ||
@@ -91,2 +101,12 @@ private createJoin; | ||
* .leftJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -120,2 +140,12 @@ */ | ||
* .rightJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -149,2 +179,12 @@ */ | ||
* .innerJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -178,2 +218,12 @@ */ | ||
* .fullJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -180,0 +230,0 @@ */ |
import { entityKind, is } from "../../entity.js"; | ||
import { MySqlTable } from "../table.js"; | ||
import { TypedQueryBuilder } from "../../query-builders/query-builder.js"; | ||
@@ -8,5 +9,5 @@ import { QueryPromise } from "../../query-promise.js"; | ||
import { Table } from "../../table.js"; | ||
import { applyMixins, getTableColumns, getTableLikeName, haveSameKeys } from "../../utils.js"; | ||
import { orderSelectedFields } from "../../utils.js"; | ||
import { applyMixins, getTableColumns, getTableLikeName, haveSameKeys, orderSelectedFields } from "../../utils.js"; | ||
import { ViewBaseConfig } from "../../view-common.js"; | ||
import { convertIndexToString, toArray } from "../utils.js"; | ||
import { MySqlViewBase } from "../view-base.js"; | ||
@@ -29,3 +30,3 @@ class MySqlSelectBuilder { | ||
} | ||
from(source) { | ||
from(source, onIndex) { | ||
const isPartialSelect = !!this.fields; | ||
@@ -46,2 +47,16 @@ let fields; | ||
} | ||
let useIndex = []; | ||
let forceIndex = []; | ||
let ignoreIndex = []; | ||
if (is(source, MySqlTable) && onIndex && typeof onIndex !== "string") { | ||
if (onIndex.useIndex) { | ||
useIndex = convertIndexToString(toArray(onIndex.useIndex)); | ||
} | ||
if (onIndex.forceIndex) { | ||
forceIndex = convertIndexToString(toArray(onIndex.forceIndex)); | ||
} | ||
if (onIndex.ignoreIndex) { | ||
ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex)); | ||
} | ||
} | ||
return new MySqlSelectBase( | ||
@@ -55,3 +70,6 @@ { | ||
withList: this.withList, | ||
distinct: this.distinct | ||
distinct: this.distinct, | ||
useIndex, | ||
forceIndex, | ||
ignoreIndex | ||
} | ||
@@ -71,3 +89,3 @@ ); | ||
dialect; | ||
constructor({ table, fields, isPartialSelect, session, dialect, withList, distinct }) { | ||
constructor({ table, fields, isPartialSelect, session, dialect, withList, distinct, useIndex, forceIndex, ignoreIndex }) { | ||
super(); | ||
@@ -79,3 +97,6 @@ this.config = { | ||
distinct, | ||
setOperators: [] | ||
setOperators: [], | ||
useIndex, | ||
forceIndex, | ||
ignoreIndex | ||
}; | ||
@@ -92,3 +113,3 @@ this.isPartialSelect = isPartialSelect; | ||
createJoin(joinType) { | ||
return (table, on) => { | ||
return (table, on, onIndex) => { | ||
const baseTableName = this.tableName; | ||
@@ -121,3 +142,17 @@ const tableName = getTableLikeName(table); | ||
} | ||
this.config.joins.push({ on, table, joinType, alias: tableName }); | ||
let useIndex = []; | ||
let forceIndex = []; | ||
let ignoreIndex = []; | ||
if (is(table, MySqlTable) && onIndex && typeof onIndex !== "string") { | ||
if (onIndex.useIndex) { | ||
useIndex = convertIndexToString(toArray(onIndex.useIndex)); | ||
} | ||
if (onIndex.forceIndex) { | ||
forceIndex = convertIndexToString(toArray(onIndex.forceIndex)); | ||
} | ||
if (onIndex.ignoreIndex) { | ||
ignoreIndex = convertIndexToString(toArray(onIndex.ignoreIndex)); | ||
} | ||
} | ||
this.config.joins.push({ on, table, joinType, alias: tableName, useIndex, forceIndex, ignoreIndex }); | ||
if (typeof tableName === "string") { | ||
@@ -177,2 +212,12 @@ switch (joinType) { | ||
* .leftJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -206,2 +251,12 @@ */ | ||
* .rightJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -235,2 +290,12 @@ */ | ||
* .innerJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -264,2 +329,12 @@ */ | ||
* .fullJoin(pets, eq(users.id, pets.ownerId)) | ||
* | ||
* // Select userId and petId with use index hint | ||
* const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({ | ||
* userId: users.id, | ||
* petId: pets.id, | ||
* }) | ||
* .from(users) | ||
* .leftJoin(pets, eq(users.id, pets.ownerId), { | ||
* useIndex: ['pets_owner_id_index'] | ||
* }) | ||
* ``` | ||
@@ -266,0 +341,0 @@ */ |
@@ -13,3 +13,3 @@ import type { MySqlColumn } from "../columns/index.js"; | ||
import type { MySqlViewWithSelection } from "../view.js"; | ||
import type { MySqlSelectBase, MySqlSelectQueryBuilderBase } from "./select.js"; | ||
import type { IndexConfig, MySqlSelectBase, MySqlSelectQueryBuilderBase } from "./select.js"; | ||
export interface MySqlSelectJoinConfig { | ||
@@ -21,2 +21,5 @@ on: SQL | undefined; | ||
lateral?: boolean; | ||
useIndex?: string[]; | ||
forceIndex?: string[]; | ||
ignoreIndex?: string[]; | ||
} | ||
@@ -52,5 +55,8 @@ export type BuildAliasTable<TTable extends MySqlTable | View, TAlias extends string> = TTable extends Table ? MySqlTableWithColumns<UpdateTableConfig<TTable['_']['config'], { | ||
}[]; | ||
useIndex?: string[]; | ||
forceIndex?: string[]; | ||
ignoreIndex?: string[]; | ||
} | ||
export type MySqlJoin<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType, TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>> = T extends any ? MySqlSelectWithout<MySqlSelectKind<T['_']['hkt'], T['_']['tableName'], AppendToResult<T['_']['tableName'], T['_']['selection'], TJoinedName, TJoinedTable extends MySqlTable ? TJoinedTable['_']['columns'] : TJoinedTable extends Subquery ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields> : never, T['_']['selectMode']>, T['_']['selectMode'] extends 'partial' ? T['_']['selectMode'] : 'multiple', T['_']['preparedQueryHKT'], AppendToNullabilityMap<T['_']['nullabilityMap'], TJoinedName, TJoinType>, TDynamic, T['_']['excludedMethods']>, TDynamic, T['_']['excludedMethods']> : never; | ||
export type MySqlJoinFn<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType> = <TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>>(table: TJoinedTable, on: ((aliases: T['_']['selection']) => SQL | undefined) | SQL | undefined) => MySqlJoin<T, TDynamic, TJoinType, TJoinedTable, TJoinedName>; | ||
export type MySqlJoinFn<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType> = <TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>>(table: TJoinedTable, on: ((aliases: T['_']['selection']) => SQL | undefined) | SQL | undefined, onIndex?: TJoinedTable extends MySqlTable ? IndexConfig : 'Index hint configuration is allowed only for MySqlTable and not for subqueries or views') => MySqlJoin<T, TDynamic, TJoinType, TJoinedTable, TJoinedName>; | ||
export type SelectedFieldsFlat = SelectedFieldsFlatBase<MySqlColumn>; | ||
@@ -57,0 +63,0 @@ export type SelectedFields = SelectedFieldsBase<MySqlColumn, MySqlTable>; |
@@ -5,2 +5,3 @@ import type { Check } from "./checks.js"; | ||
import type { PrimaryKey } from "./primary-keys.js"; | ||
import type { IndexForHint } from "./query-builders/select.js"; | ||
import { MySqlTable } from "./table.js"; | ||
@@ -32,1 +33,3 @@ import { type UniqueConstraint } from "./unique-constraint.js"; | ||
}; | ||
export declare function convertIndexToString(indexes: IndexForHint[]): string[]; | ||
export declare function toArray<T>(value: T | T[]): T[]; |
@@ -57,6 +57,16 @@ import { is } from "../entity.js"; | ||
} | ||
function convertIndexToString(indexes) { | ||
return indexes.map((idx) => { | ||
return typeof idx === "object" ? idx.config.name : idx; | ||
}); | ||
} | ||
function toArray(value) { | ||
return Array.isArray(value) ? value : [value]; | ||
} | ||
export { | ||
convertIndexToString, | ||
getTableConfig, | ||
getViewConfig | ||
getViewConfig, | ||
toArray | ||
}; | ||
//# sourceMappingURL=utils.js.map |
@@ -18,3 +18,3 @@ import { bigint } from "./bigint.js"; | ||
import { smallint } from "./smallint.js"; | ||
import { text } from "./text.js"; | ||
import { longtext, mediumtext, text, tinytext } from "./text.js"; | ||
import { time } from "./time.js"; | ||
@@ -44,3 +44,6 @@ import { timestamp } from "./timestamp.js"; | ||
smallint: typeof smallint; | ||
longtext: typeof longtext; | ||
mediumtext: typeof mediumtext; | ||
text: typeof text; | ||
tinytext: typeof tinytext; | ||
time: typeof time; | ||
@@ -47,0 +50,0 @@ timestamp: typeof timestamp; |
@@ -18,3 +18,3 @@ import { bigint } from "./bigint.js"; | ||
import { smallint } from "./smallint.js"; | ||
import { text } from "./text.js"; | ||
import { longtext, mediumtext, text, tinytext } from "./text.js"; | ||
import { time } from "./time.js"; | ||
@@ -45,3 +45,6 @@ import { timestamp } from "./timestamp.js"; | ||
smallint, | ||
longtext, | ||
mediumtext, | ||
text, | ||
tinytext, | ||
time, | ||
@@ -48,0 +51,0 @@ timestamp, |
@@ -6,3 +6,3 @@ import type { ColumnBuilderBaseConfig } from "../../column-builder.js"; | ||
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js"; | ||
export type SingleStoreCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = SingleStoreCharBuilder<{ | ||
export type SingleStoreCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]], TLength extends number | undefined> = SingleStoreCharBuilder<{ | ||
name: TName; | ||
@@ -15,19 +15,28 @@ dataType: 'string'; | ||
generated: undefined; | ||
length: TLength; | ||
}>; | ||
export declare class SingleStoreCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreChar'>> extends SingleStoreColumnBuilder<T, SingleStoreCharConfig<T['enumValues']>> { | ||
export declare class SingleStoreCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreChar'> & { | ||
length?: number | undefined; | ||
}> extends SingleStoreColumnBuilder<T, SingleStoreCharConfig<T['enumValues'], T['length']>, { | ||
length: T['length']; | ||
}> { | ||
static readonly [entityKind]: string; | ||
constructor(name: T['name'], config: SingleStoreCharConfig<T['enumValues']>); | ||
constructor(name: T['name'], config: SingleStoreCharConfig<T['enumValues'], T['length']>); | ||
} | ||
export declare class SingleStoreChar<T extends ColumnBaseConfig<'string', 'SingleStoreChar'>> extends SingleStoreColumn<T, SingleStoreCharConfig<T['enumValues']>> { | ||
export declare class SingleStoreChar<T extends ColumnBaseConfig<'string', 'SingleStoreChar'> & { | ||
length?: number | undefined; | ||
}> extends SingleStoreColumn<T, SingleStoreCharConfig<T['enumValues'], T['length']>, { | ||
length: T['length']; | ||
}> { | ||
static readonly [entityKind]: string; | ||
readonly length: number | undefined; | ||
readonly length: T['length']; | ||
readonly enumValues: T["enumValues"] | undefined; | ||
getSQLType(): string; | ||
} | ||
export interface SingleStoreCharConfig<TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined> { | ||
length?: number; | ||
export interface SingleStoreCharConfig<TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined, TLength extends number | undefined = number | undefined> { | ||
enum?: TEnum; | ||
length?: TLength; | ||
} | ||
export declare function char(): SingleStoreCharBuilderInitial<'', [string, ...string[]]>; | ||
export declare function char<U extends string, T extends Readonly<[U, ...U[]]>>(config?: SingleStoreCharConfig<T | Writable<T>>): SingleStoreCharBuilderInitial<'', Writable<T>>; | ||
export declare function char<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(name: TName, config?: SingleStoreCharConfig<T | Writable<T>>): SingleStoreCharBuilderInitial<TName, Writable<T>>; | ||
export declare function char(): SingleStoreCharBuilderInitial<'', [string, ...string[]], undefined>; | ||
export declare function char<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(config?: SingleStoreCharConfig<T | Writable<T>, L>): SingleStoreCharBuilderInitial<'', Writable<T>, L>; | ||
export declare function char<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(name: TName, config?: SingleStoreCharConfig<T | Writable<T>, L>): SingleStoreCharBuilderInitial<TName, Writable<T>, L>; |
@@ -28,3 +28,3 @@ import type { ColumnBuilderBaseConfig } from "../../column-builder.js"; | ||
static readonly [entityKind]: string; | ||
private textType; | ||
readonly textType: SingleStoreTextColumnType; | ||
readonly enumValues: T["enumValues"]; | ||
@@ -31,0 +31,0 @@ getSQLType(): string; |
@@ -6,3 +6,3 @@ import type { ColumnBuilderBaseConfig } from "../../column-builder.js"; | ||
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js"; | ||
export type SingleStoreVarCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = SingleStoreVarCharBuilder<{ | ||
export type SingleStoreVarCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]], TLength extends number | undefined> = SingleStoreVarCharBuilder<{ | ||
name: TName; | ||
@@ -15,17 +15,26 @@ dataType: 'string'; | ||
generated: undefined; | ||
length: TLength; | ||
}>; | ||
export declare class SingleStoreVarCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreVarChar'>> extends SingleStoreColumnBuilder<T, SingleStoreVarCharConfig<T['enumValues']>> { | ||
export declare class SingleStoreVarCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreVarChar'> & { | ||
length?: number | undefined; | ||
}> extends SingleStoreColumnBuilder<T, SingleStoreVarCharConfig<T['enumValues'], T['length']>, { | ||
length: T['length']; | ||
}> { | ||
static readonly [entityKind]: string; | ||
} | ||
export declare class SingleStoreVarChar<T extends ColumnBaseConfig<'string', 'SingleStoreVarChar'>> extends SingleStoreColumn<T, SingleStoreVarCharConfig<T['enumValues']>> { | ||
export declare class SingleStoreVarChar<T extends ColumnBaseConfig<'string', 'SingleStoreVarChar'> & { | ||
length?: number | undefined; | ||
}> extends SingleStoreColumn<T, SingleStoreVarCharConfig<T['enumValues'], T['length']>, { | ||
length: T['length']; | ||
}> { | ||
static readonly [entityKind]: string; | ||
readonly length: number | undefined; | ||
readonly length: T['length']; | ||
readonly enumValues: T["enumValues"] | undefined; | ||
getSQLType(): string; | ||
} | ||
export interface SingleStoreVarCharConfig<TEnum extends string[] | readonly string[] | undefined = string[] | readonly string[] | undefined> { | ||
length: number; | ||
export interface SingleStoreVarCharConfig<TEnum extends string[] | readonly string[] | undefined = string[] | readonly string[] | undefined, TLength extends number | undefined = number | undefined> { | ||
enum?: TEnum; | ||
length?: TLength; | ||
} | ||
export declare function varchar<U extends string, T extends Readonly<[U, ...U[]]>>(config: SingleStoreVarCharConfig<T | Writable<T>>): SingleStoreVarCharBuilderInitial<'', Writable<T>>; | ||
export declare function varchar<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(name: TName, config: SingleStoreVarCharConfig<T | Writable<T>>): SingleStoreVarCharBuilderInitial<TName, Writable<T>>; | ||
export declare function varchar<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(config: SingleStoreVarCharConfig<T | Writable<T>, L>): SingleStoreVarCharBuilderInitial<'', Writable<T>, L>; | ||
export declare function varchar<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(name: TName, config: SingleStoreVarCharConfig<T | Writable<T>, L>): SingleStoreVarCharBuilderInitial<TName, Writable<T>, L>; |
@@ -1,2 +0,2 @@ | ||
var version = "0.38.1"; | ||
var version = "0.38.2-019d9b0"; | ||
@@ -3,0 +3,0 @@ declare const compatibilityVersion = 10; |
// package.json | ||
var version = "0.38.1"; | ||
var version = "0.38.2-019d9b0"; | ||
@@ -4,0 +4,0 @@ // src/version.ts |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8152098
78815