{"version":3,"sources":["../../../src/mysql-core/columns/text.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnyMySqlTable } from '~/mysql-core/table.ts';\nimport { getColumnNameAndConfig, type Writable } from '~/utils.ts';\nimport { MySqlColumn, MySqlColumnBuilder } from './common.ts';\n\nexport type MySqlTextColumnType = 'tinytext' | 'text' | 'mediumtext' | 'longtext';\n\nexport type MySqlTextBuilderInitial = MySqlTextBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'MySqlText';\n\tdata: TEnum[number];\n\tdriverParam: string;\n\tenumValues: TEnum;\n}>;\n\nexport class MySqlTextBuilder> extends MySqlColumnBuilder<\n\tT,\n\t{ textType: MySqlTextColumnType; enumValues: T['enumValues'] }\n> {\n\tstatic override readonly [entityKind]: string = 'MySqlTextBuilder';\n\n\tconstructor(name: T['name'], textType: MySqlTextColumnType, config: MySqlTextConfig) {\n\t\tsuper(name, 'string', 'MySqlText');\n\t\tthis.config.textType = textType;\n\t\tthis.config.enumValues = config.enum;\n\t}\n\n\t/** @internal */\n\toverride build(\n\t\ttable: AnyMySqlTable<{ name: TTableName }>,\n\t): MySqlText> {\n\t\treturn new MySqlText>(table, this.config as ColumnBuilderRuntimeConfig);\n\t}\n}\n\nexport class MySqlText>\n\textends MySqlColumn\n{\n\tstatic override readonly [entityKind]: string = 'MySqlText';\n\n\treadonly textType: MySqlTextColumnType = this.config.textType;\n\n\toverride readonly enumValues = this.config.enumValues;\n\n\tgetSQLType(): string {\n\t\treturn this.textType;\n\t}\n}\n\nexport interface MySqlTextConfig<\n\tTEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined,\n> {\n\tenum?: TEnum;\n}\n\nexport function text(): MySqlTextBuilderInitial<'', [string, ...string[]]>;\nexport function text>(\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial<'', Writable>;\nexport function text>(\n\tname: TName,\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial>;\nexport function text(a?: string | MySqlTextConfig, b: MySqlTextConfig = {}): any {\n\tconst { name, config } = getColumnNameAndConfig(a, b);\n\treturn new MySqlTextBuilder(name, 'text', config as any);\n}\n\nexport function tinytext(): MySqlTextBuilderInitial<'', [string, ...string[]]>;\nexport function tinytext>(\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial<'', Writable>;\nexport function tinytext>(\n\tname: TName,\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial>;\nexport function tinytext(a?: string | MySqlTextConfig, b: MySqlTextConfig = {}): any {\n\tconst { name, config } = getColumnNameAndConfig(a, b);\n\treturn new MySqlTextBuilder(name, 'tinytext', config as any);\n}\n\nexport function mediumtext(): MySqlTextBuilderInitial<'', [string, ...string[]]>;\nexport function mediumtext>(\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial<'', Writable>;\nexport function mediumtext>(\n\tname: TName,\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial>;\nexport function mediumtext(a?: string | MySqlTextConfig, b: MySqlTextConfig = {}): any {\n\tconst { name, config } = getColumnNameAndConfig(a, b);\n\treturn new MySqlTextBuilder(name, 'mediumtext', config as any);\n}\n\nexport function longtext(): MySqlTextBuilderInitial<'', [string, ...string[]]>;\nexport function longtext>(\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial<'', Writable>;\nexport function longtext>(\n\tname: TName,\n\tconfig?: MySqlTextConfig>,\n): MySqlTextBuilderInitial>;\nexport function longtext(a?: string | MySqlTextConfig, b: MySqlTextConfig = {}): any {\n\tconst { name, config } = getColumnNameAndConfig(a, b);\n\treturn new MySqlTextBuilder(name, 'longtext', config as any);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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