Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul validator packages #3508

Merged
merged 72 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
d0d952e
Unminify validator build output
L-Mario564 Nov 7, 2024
8399021
Reimplement `createSelectSchema` in `drizzle-zod`
L-Mario564 Nov 8, 2024
1bd5fe0
Add `getViewSelectedFields` util function
L-Mario564 Nov 8, 2024
f7c1a3b
Support views in `drizzle-zod`
L-Mario564 Nov 11, 2024
2cbd32e
Reimplement refinement in zod select schema
L-Mario564 Nov 11, 2024
d65610a
Create schema creation factory for zod
L-Mario564 Nov 11, 2024
67b8dc4
Support enums in `createSelectSchema` in `drizzle-zod`
L-Mario564 Nov 12, 2024
1fc52ca
Update peer deps' versions in `drizzle-zod`
L-Mario564 Nov 12, 2024
eb84274
Add `getViewSelectedFields` util function
L-Mario564 Nov 13, 2024
147b134
Fix view types
L-Mario564 Nov 13, 2024
a2ed22b
Add `$inferSelect` to views
L-Mario564 Nov 13, 2024
9b256e3
Format
L-Mario564 Nov 14, 2024
d91df79
Fix lint errors
L-Mario564 Nov 14, 2024
aa76163
Merge remote-tracking branch 'origin/improve-views' into update-valid…
L-Mario564 Nov 14, 2024
2579db6
Reimplement `createInsertSchema` in `drizzle-zod`
L-Mario564 Nov 15, 2024
bbaf6f0
Add `isView` util function
L-Mario564 Nov 15, 2024
56700f2
Merge remote-tracking branch 'origin/improve-views' into update-valid…
L-Mario564 Nov 15, 2024
1ff2961
Handle additional properties
L-Mario564 Nov 15, 2024
ee0e400
Add `createUpdateSchema` in `drizzle-zod` + Additional tests
L-Mario564 Nov 15, 2024
9acbabc
Update type
L-Mario564 Nov 15, 2024
2382a09
Disallow unknown keys in `drizzle-zod` refinement
L-Mario564 Nov 15, 2024
62f1698
Add checks comparison
L-Mario564 Nov 18, 2024
e8ca472
Test all PG data types
L-Mario564 Nov 18, 2024
7feec69
Restructure `drizzle-zod` files
L-Mario564 Nov 18, 2024
a016cb4
Support PG arrays in `drizzle-zod`
L-Mario564 Nov 18, 2024
b27326b
Add MySql tests to drizzle-zod
L-Mario564 Nov 19, 2024
0984880
Add SQLite tests + Fix MySql tests
L-Mario564 Nov 19, 2024
073bc7a
Format
L-Mario564 Nov 19, 2024
22de427
Update drizzle-valibot peer deps
L-Mario564 Nov 19, 2024
36c519a
Fix redundant checks in drizzle-zod
L-Mario564 Nov 19, 2024
43c0a96
Wipe drizzzle-valibot and drizzle-typebox
L-Mario564 Nov 19, 2024
d2a06d0
Adapt drizzle-zod code for drizzle-valibot
L-Mario564 Nov 19, 2024
cda7369
Update string schema generation in drizzle-zod
L-Mario564 Nov 19, 2024
3e08adb
Add type tests to drizzle-zod
L-Mario564 Nov 20, 2024
f900beb
Undo additional validation to strings in drizzle-zod
L-Mario564 Nov 20, 2024
573a5d2
Add missing text types in `getMySqlColumnBuilders` return value
L-Mario564 Nov 21, 2024
4363fe2
Handle additional MySQL text types in drizzle-zod
L-Mario564 Nov 21, 2024
6926653
Make necessary type changes to ORM
L-Mario564 Nov 21, 2024
e55c22d
Add MySQL tests to drizzle-valibot
L-Mario564 Nov 21, 2024
eb77176
Some ORM type-level changes
L-Mario564 Nov 22, 2024
19e9404
Improve and simplify array handling in drizzle-zod
L-Mario564 Nov 22, 2024
25356bf
Add drizzle-valibot PG tests
L-Mario564 Nov 22, 2024
4703de8
Add SQLite tests to drizzle-valibot
L-Mario564 Nov 22, 2024
f9cb06d
Fix drizzle-valibot not identifying length in MySQL char
L-Mario564 Nov 22, 2024
c357e74
Handle false-positive type error + Format drizzle-valibot
L-Mario564 Nov 22, 2024
71f0627
Optimize drizzle-zod
L-Mario564 Nov 25, 2024
0dabffa
Optimize drizzle-valibot
L-Mario564 Nov 25, 2024
092ba8c
Update peer deps in drizzle-typebox
L-Mario564 Nov 25, 2024
53c5dee
Reimplement everything in drizzle-typebox
L-Mario564 Nov 25, 2024
bbb2173
Add MySQL tests for drizzle-typebox
L-Mario564 Nov 25, 2024
1ef19a6
Add PG tests to drizzle-typebox
L-Mario564 Nov 25, 2024
78a6811
Write SQLite tests for drizzle-typebox
L-Mario564 Nov 26, 2024
4f52726
Format
L-Mario564 Nov 26, 2024
90e0fbe
Update validator packages README
L-Mario564 Nov 26, 2024
fc37e34
Format
L-Mario564 Nov 26, 2024
048dc14
Add tests for tables within schemas
L-Mario564 Nov 26, 2024
0aaed13
Properly implement `Buffer` schema in drizzle-typebox
L-Mario564 Nov 27, 2024
f36b6b3
Merge remote-tracking branch 'upstream/beta' into update-validators
L-Mario564 Nov 27, 2024
48993f9
Fix types
L-Mario564 Nov 27, 2024
09007c6
Fix type tests in ORM
L-Mario564 Nov 27, 2024
cf7e8fc
Fix type tests
L-Mario564 Nov 27, 2024
22c5562
Lint
L-Mario564 Nov 27, 2024
47d25b0
Fix builds for validator packages
L-Mario564 Nov 28, 2024
024b083
Format
L-Mario564 Nov 28, 2024
57162f7
Merge branch 'beta' of github.com:drizzle-team/drizzle-orm into updat…
AndriiSherman Dec 4, 2024
72047dd
Fix types ans lint
AndriiSherman Dec 4, 2024
5c49c81
fix
AndriiSherman Dec 5, 2024
75c8f2e
Fix
AndriiSherman Dec 5, 2024
08a3b58
Update ORM types
L-Mario564 Dec 5, 2024
ee0aac0
Merge branch 'update-validators' of https://github.com/L-Mario564/dri…
L-Mario564 Dec 5, 2024
8f9f3b8
Fix MySQL char types
L-Mario564 Dec 5, 2024
3168554
Merge branch 'beta' into update-validators
AndriiSherman Dec 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 43 additions & 5 deletions drizzle-orm/src/column-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,11 +313,49 @@ export type BuildColumn<
TTableName extends string,
TBuilder extends ColumnBuilderBase,
TDialect extends Dialect,
> = TDialect extends 'pg' ? PgColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'mysql' ? MySqlColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'singlestore' ? SingleStoreColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'sqlite' ? SQLiteColumn<MakeColumnConfig<TBuilder['_'], TTableName>>
: TDialect extends 'common' ? Column<MakeColumnConfig<TBuilder['_'], TTableName>>
> = TDialect extends 'pg' ? PgColumn<
MakeColumnConfig<TBuilder['_'], TTableName>,
{},
Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect'>>
>
: TDialect extends 'mysql' ? MySqlColumn<
MakeColumnConfig<TBuilder['_'], TTableName>,
{},
Simplify<
Omit<
TBuilder['_'],
| keyof MakeColumnConfig<TBuilder['_'], TTableName>
| 'brand'
| 'dialect'
| 'primaryKeyHasDefault'
| 'mysqlColumnBuilderBrand'
>
>
>
: TDialect extends 'sqlite' ? SQLiteColumn<
MakeColumnConfig<TBuilder['_'], TTableName>,
{},
Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect'>>
>
: TDialect extends 'common' ? Column<
MakeColumnConfig<TBuilder['_'], TTableName>,
{},
Simplify<Omit<TBuilder['_'], keyof MakeColumnConfig<TBuilder['_'], TTableName> | 'brand' | 'dialect'>>
>
: TDialect extends 'singlestore' ? SingleStoreColumn<
MakeColumnConfig<TBuilder['_'], TTableName>,
{},
Simplify<
Omit<
TBuilder['_'],
| keyof MakeColumnConfig<TBuilder['_'], TTableName>
| 'brand'
| 'dialect'
| 'primaryKeyHasDefault'
| 'singlestoreColumnBuilderBrand'
>
>
>
: never;

export type BuildIndexColumn<
Expand Down
5 changes: 4 additions & 1 deletion drizzle-orm/src/mysql-core/columns/all.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { mediumint } from './mediumint.ts';
import { real } from './real.ts';
import { serial } from './serial.ts';
import { smallint } from './smallint.ts';
import { text } from './text.ts';
import { longtext, mediumtext, text, tinytext } from './text.ts';
import { time } from './time.ts';
import { timestamp } from './timestamp.ts';
import { tinyint } from './tinyint.ts';
Expand Down Expand Up @@ -49,6 +49,9 @@ export function getMySqlColumnBuilders() {
varbinary,
varchar,
year,
longtext,
mediumtext,
tinytext,
};
}

Expand Down
48 changes: 31 additions & 17 deletions drizzle-orm/src/mysql-core/columns/char.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@ import type { AnyMySqlTable } from '~/mysql-core/table.ts';
import { getColumnNameAndConfig, type Writable } from '~/utils.ts';
import { MySqlColumn, MySqlColumnBuilder } from './common.ts';

export type MySqlCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = MySqlCharBuilder<{
export type MySqlCharBuilderInitial<
TName extends string,
TEnum extends [string, ...string[]],
TLength extends number | undefined,
> = MySqlCharBuilder<{
name: TName;
dataType: 'string';
columnType: 'MySqlChar';
data: TEnum[number];
driverParam: number | string;
enumValues: TEnum;
length: TLength;
}>;

export class MySqlCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'MySqlChar'>> extends MySqlColumnBuilder<
export class MySqlCharBuilder<
T extends ColumnBuilderBaseConfig<'string', 'MySqlChar'> & { length?: number | undefined },
> extends MySqlColumnBuilder<
T,
MySqlCharConfig<T['enumValues']>
MySqlCharConfig<T['enumValues'], T['length']>,
{ length: T['length'] }
> {
static override readonly [entityKind]: string = 'MySqlCharBuilder';

constructor(name: T['name'], config: MySqlCharConfig<T['enumValues']>) {
constructor(name: T['name'], config: MySqlCharConfig<T['enumValues'], T['length']>) {
super(name, 'string', 'MySqlChar');
this.config.length = config.length;
this.config.enum = config.enum;
Expand All @@ -29,20 +37,20 @@ export class MySqlCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'MySql
/** @internal */
override build<TTableName extends string>(
table: AnyMySqlTable<{ name: TTableName }>,
): MySqlChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }> {
return new MySqlChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }>(
): MySqlChar<MakeColumnConfig<T, TTableName> & { length: T['length']; enumValues: T['enumValues'] }> {
return new MySqlChar<MakeColumnConfig<T, TTableName> & { length: T['length']; enumValues: T['enumValues'] }>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}

export class MySqlChar<T extends ColumnBaseConfig<'string', 'MySqlChar'>>
extends MySqlColumn<T, MySqlCharConfig<T['enumValues']>>
export class MySqlChar<T extends ColumnBaseConfig<'string', 'MySqlChar'> & { length?: number | undefined }>
extends MySqlColumn<T, MySqlCharConfig<T['enumValues'], T['length']>, { length: T['length'] }>
{
static override readonly [entityKind]: string = 'MySqlChar';

readonly length: number | undefined = this.config.length;
readonly length: T['length'] = this.config.length;
override readonly enumValues = this.config.enum;

getSQLType(): string {
Expand All @@ -52,19 +60,25 @@ export class MySqlChar<T extends ColumnBaseConfig<'string', 'MySqlChar'>>

export interface MySqlCharConfig<
TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined,
TLength extends number | undefined = number | undefined,
> {
length?: number;
enum?: TEnum;
length?: TLength;
}

export function char(): MySqlCharBuilderInitial<'', [string, ...string[]]>;
export function char<U extends string, T extends Readonly<[U, ...U[]]>>(
config?: MySqlCharConfig<T | Writable<T>>,
): MySqlCharBuilderInitial<'', Writable<T>>;
export function char<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(
export function char(): MySqlCharBuilderInitial<'', [string, ...string[]], undefined>;
export function char<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(
config?: MySqlCharConfig<T | Writable<T>, L>,
): MySqlCharBuilderInitial<'', Writable<T>, L>;
export function char<
TName extends string,
U extends string,
T extends Readonly<[U, ...U[]]>,
L extends number | undefined,
>(
name: TName,
config?: MySqlCharConfig<T | Writable<T>>,
): MySqlCharBuilderInitial<TName, Writable<T>>;
config?: MySqlCharConfig<T | Writable<T>, L>,
): MySqlCharBuilderInitial<TName, Writable<T>, L>;
export function char(a?: string | MySqlCharConfig, b: MySqlCharConfig = {}): any {
const { name, config } = getColumnNameAndConfig<MySqlCharConfig>(a, b);
return new MySqlCharBuilder(name, config as any);
Expand Down
5 changes: 3 additions & 2 deletions drizzle-orm/src/mysql-core/columns/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ export abstract class MySqlColumnBuilder<
// To understand how to use `MySqlColumn` and `AnyMySqlColumn`, see `Column` and `AnyColumn` documentation.
export abstract class MySqlColumn<
T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>,
TRuntimeConfig extends object = object,
> extends Column<T, TRuntimeConfig, { dialect: 'mysql' }> {
TRuntimeConfig extends object = {},
TTypeConfig extends object = {},
> extends Column<T, TRuntimeConfig, TTypeConfig & { dialect: 'mysql' }> {
static override readonly [entityKind]: string = 'MySqlColumn';

constructor(
Expand Down
2 changes: 1 addition & 1 deletion drizzle-orm/src/mysql-core/columns/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class MySqlText<T extends ColumnBaseConfig<'string', 'MySqlText'>>
{
static override readonly [entityKind]: string = 'MySqlText';

private textType: MySqlTextColumnType = this.config.textType;
readonly textType: MySqlTextColumnType = this.config.textType;

override readonly enumValues = this.config.enumValues;

Expand Down
43 changes: 27 additions & 16 deletions drizzle-orm/src/mysql-core/columns/varchar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,29 @@ import type { AnyMySqlTable } from '~/mysql-core/table.ts';
import { getColumnNameAndConfig, type Writable } from '~/utils.ts';
import { MySqlColumn, MySqlColumnBuilder } from './common.ts';

export type MySqlVarCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = MySqlVarCharBuilder<
export type MySqlVarCharBuilderInitial<
TName extends string,
TEnum extends [string, ...string[]],
TLength extends number | undefined,
> = MySqlVarCharBuilder<
{
name: TName;
dataType: 'string';
columnType: 'MySqlVarChar';
data: TEnum[number];
driverParam: number | string;
enumValues: TEnum;
length: TLength;
}
>;

export class MySqlVarCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'MySqlVarChar'>>
extends MySqlColumnBuilder<T, MySqlVarCharConfig<T['enumValues']>>
{
export class MySqlVarCharBuilder<
T extends ColumnBuilderBaseConfig<'string', 'MySqlVarChar'> & { length?: number | undefined },
> extends MySqlColumnBuilder<T, MySqlVarCharConfig<T['enumValues'], T['length']>> {
static override readonly [entityKind]: string = 'MySqlVarCharBuilder';

/** @internal */
constructor(name: T['name'], config: MySqlVarCharConfig<T['enumValues']>) {
constructor(name: T['name'], config: MySqlVarCharConfig<T['enumValues'], T['length']>) {
super(name, 'string', 'MySqlVarChar');
this.config.length = config.length;
this.config.enum = config.enum;
Expand All @@ -31,16 +36,16 @@ export class MySqlVarCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'My
/** @internal */
override build<TTableName extends string>(
table: AnyMySqlTable<{ name: TTableName }>,
): MySqlVarChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }> {
return new MySqlVarChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }>(
): MySqlVarChar<MakeColumnConfig<T, TTableName> & { length: T['length']; enumValues: T['enumValues'] }> {
return new MySqlVarChar<MakeColumnConfig<T, TTableName> & { length: T['length']; enumValues: T['enumValues'] }>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}

export class MySqlVarChar<T extends ColumnBaseConfig<'string', 'MySqlVarChar'>>
extends MySqlColumn<T, MySqlVarCharConfig<T['enumValues']>>
export class MySqlVarChar<T extends ColumnBaseConfig<'string', 'MySqlVarChar'> & { length?: number | undefined }>
extends MySqlColumn<T, MySqlVarCharConfig<T['enumValues'], T['length']>, { length: T['length'] }>
{
static override readonly [entityKind]: string = 'MySqlVarChar';

Expand All @@ -55,18 +60,24 @@ export class MySqlVarChar<T extends ColumnBaseConfig<'string', 'MySqlVarChar'>>

export interface MySqlVarCharConfig<
TEnum extends string[] | readonly string[] | undefined = string[] | readonly string[] | undefined,
TLength extends number | undefined = number | undefined,
> {
length: number;
enum?: TEnum;
length?: TLength;
}

export function varchar<U extends string, T extends Readonly<[U, ...U[]]>>(
config: MySqlVarCharConfig<T | Writable<T>>,
): MySqlVarCharBuilderInitial<'', Writable<T>>;
export function varchar<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(
export function varchar<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(
config: MySqlVarCharConfig<T | Writable<T>, L>,
): MySqlVarCharBuilderInitial<'', Writable<T>, L>;
export function varchar<
TName extends string,
U extends string,
T extends Readonly<[U, ...U[]]>,
L extends number | undefined,
>(
name: TName,
config: MySqlVarCharConfig<T | Writable<T>>,
): MySqlVarCharBuilderInitial<TName, Writable<T>>;
config: MySqlVarCharConfig<T | Writable<T>, L>,
): MySqlVarCharBuilderInitial<TName, Writable<T>, L>;
export function varchar(a?: string | MySqlVarCharConfig, b?: MySqlVarCharConfig): any {
const { name, config } = getColumnNameAndConfig<MySqlVarCharConfig>(a, b);
return new MySqlVarCharBuilder(name, config as any);
Expand Down
53 changes: 35 additions & 18 deletions drizzle-orm/src/pg-core/columns/char.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,30 @@ import type { AnyPgTable } from '~/pg-core/table.ts';
import { getColumnNameAndConfig, type Writable } from '~/utils.ts';
import { PgColumn, PgColumnBuilder } from './common.ts';

export type PgCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = PgCharBuilder<{
export type PgCharBuilderInitial<
TName extends string,
TEnum extends [string, ...string[]],
TLength extends number | undefined,
> = PgCharBuilder<{
name: TName;
dataType: 'string';
columnType: 'PgChar';
data: TEnum[number];
enumValues: TEnum;
driverParam: string;
length: TLength;
}>;

export class PgCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'PgChar'>> extends PgColumnBuilder<
T,
{ length: number | undefined; enumValues: T['enumValues'] }
> {
export class PgCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'PgChar'> & { length?: number | undefined }>
extends PgColumnBuilder<
T,
{ length: T['length']; enumValues: T['enumValues'] },
{ length: T['length'] }
>
{
static override readonly [entityKind]: string = 'PgCharBuilder';

constructor(name: T['name'], config: PgCharConfig<T['enumValues']>) {
constructor(name: T['name'], config: PgCharConfig<T['enumValues'], T['length']>) {
super(name, 'string', 'PgChar');
this.config.length = config.length;
this.config.enumValues = config.enum;
Expand All @@ -29,13 +37,16 @@ export class PgCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'PgChar'>
/** @internal */
override build<TTableName extends string>(
table: AnyPgTable<{ name: TTableName }>,
): PgChar<MakeColumnConfig<T, TTableName>> {
return new PgChar<MakeColumnConfig<T, TTableName>>(table, this.config as ColumnBuilderRuntimeConfig<any, any>);
): PgChar<MakeColumnConfig<T, TTableName> & { length: T['length'] }> {
return new PgChar<MakeColumnConfig<T, TTableName> & { length: T['length'] }>(
table,
this.config as ColumnBuilderRuntimeConfig<any, any>,
);
}
}

export class PgChar<T extends ColumnBaseConfig<'string', 'PgChar'>>
extends PgColumn<T, { length: number | undefined; enumValues: T['enumValues'] }>
export class PgChar<T extends ColumnBaseConfig<'string', 'PgChar'> & { length?: number | undefined }>
extends PgColumn<T, { length: T['length']; enumValues: T['enumValues'] }, { length: T['length'] }>
{
static override readonly [entityKind]: string = 'PgChar';

Expand All @@ -49,19 +60,25 @@ export class PgChar<T extends ColumnBaseConfig<'string', 'PgChar'>>

export interface PgCharConfig<
TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined,
TLength extends number | undefined = number | undefined,
> {
length?: number;
enum?: TEnum;
length?: TLength;
}

export function char(): PgCharBuilderInitial<'', [string, ...string[]]>;
export function char<U extends string, T extends Readonly<[U, ...U[]]>>(
config?: PgCharConfig<T | Writable<T>>,
): PgCharBuilderInitial<'', Writable<T>>;
export function char<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(
export function char(): PgCharBuilderInitial<'', [string, ...string[]], undefined>;
export function char<U extends string, T extends Readonly<[U, ...U[]]>, L extends number | undefined>(
config?: PgCharConfig<T | Writable<T>, L>,
): PgCharBuilderInitial<'', Writable<T>, L>;
export function char<
TName extends string,
U extends string,
T extends Readonly<[U, ...U[]]>,
L extends number | undefined,
>(
name: TName,
config?: PgCharConfig<T | Writable<T>>,
): PgCharBuilderInitial<TName, Writable<T>>;
config?: PgCharConfig<T | Writable<T>, L>,
): PgCharBuilderInitial<TName, Writable<T>, L>;
export function char(a?: string | PgCharConfig, b: PgCharConfig = {}): any {
const { name, config } = getColumnNameAndConfig<PgCharConfig>(a, b);
return new PgCharBuilder(name, config as any);
Expand Down
Loading