Initial commit

This commit is contained in:
Ammaar Reshi
2025-01-04 14:06:53 +00:00
parent 7082408604
commit d6025af146
23760 changed files with 3299690 additions and 0 deletions

32
node_modules/drizzle-orm/singlestore-core/alias.cjs generated vendored Normal file
View File

@ -0,0 +1,32 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var alias_exports = {};
__export(alias_exports, {
alias: () => alias
});
module.exports = __toCommonJS(alias_exports);
var import_alias = require("../alias.cjs");
function alias(table, alias2) {
return new Proxy(table, new import_alias.TableAliasProxyHandler(alias2, false));
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
alias
});
//# sourceMappingURL=alias.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/singlestore-core/alias.ts"],"sourcesContent":["import { TableAliasProxyHandler } from '~/alias.ts';\nimport type { BuildAliasTable } from './query-builders/select.types.ts';\nimport type { SingleStoreTable } from './table.ts';\n\nexport function alias<TTable extends SingleStoreTable, TAlias extends string>( // | SingleStoreViewBase\n\ttable: TTable,\n\talias: TAlias,\n): BuildAliasTable<TTable, TAlias> {\n\treturn new Proxy(table, new TableAliasProxyHandler(alias, false)) as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAuC;AAIhC,SAAS,MACf,OACAA,QACkC;AAClC,SAAO,IAAI,MAAM,OAAO,IAAI,oCAAuBA,QAAO,KAAK,CAAC;AACjE;","names":["alias"]}

View File

@ -0,0 +1,4 @@
import type { BuildAliasTable } from "./query-builders/select.types.cjs";
import type { SingleStoreTable } from "./table.cjs";
export declare function alias<TTable extends SingleStoreTable, TAlias extends string>(// | SingleStoreViewBase
table: TTable, alias: TAlias): BuildAliasTable<TTable, TAlias>;

4
node_modules/drizzle-orm/singlestore-core/alias.d.ts generated vendored Normal file
View File

@ -0,0 +1,4 @@
import type { BuildAliasTable } from "./query-builders/select.types.js";
import type { SingleStoreTable } from "./table.js";
export declare function alias<TTable extends SingleStoreTable, TAlias extends string>(// | SingleStoreViewBase
table: TTable, alias: TAlias): BuildAliasTable<TTable, TAlias>;

8
node_modules/drizzle-orm/singlestore-core/alias.js generated vendored Normal file
View File

@ -0,0 +1,8 @@
import { TableAliasProxyHandler } from "../alias.js";
function alias(table, alias2) {
return new Proxy(table, new TableAliasProxyHandler(alias2, false));
}
export {
alias
};
//# sourceMappingURL=alias.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../src/singlestore-core/alias.ts"],"sourcesContent":["import { TableAliasProxyHandler } from '~/alias.ts';\nimport type { BuildAliasTable } from './query-builders/select.types.ts';\nimport type { SingleStoreTable } from './table.ts';\n\nexport function alias<TTable extends SingleStoreTable, TAlias extends string>( // | SingleStoreViewBase\n\ttable: TTable,\n\talias: TAlias,\n): BuildAliasTable<TTable, TAlias> {\n\treturn new Proxy(table, new TableAliasProxyHandler(alias, false)) as any;\n}\n"],"mappings":"AAAA,SAAS,8BAA8B;AAIhC,SAAS,MACf,OACAA,QACkC;AAClC,SAAO,IAAI,MAAM,OAAO,IAAI,uBAAuBA,QAAO,KAAK,CAAC;AACjE;","names":["alias"]}

View File

@ -0,0 +1,80 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var all_exports = {};
__export(all_exports, {
getSingleStoreColumnBuilders: () => getSingleStoreColumnBuilders
});
module.exports = __toCommonJS(all_exports);
var import_bigint = require("./bigint.cjs");
var import_binary = require("./binary.cjs");
var import_boolean = require("./boolean.cjs");
var import_char = require("./char.cjs");
var import_custom = require("./custom.cjs");
var import_date = require("./date.cjs");
var import_datetime = require("./datetime.cjs");
var import_decimal = require("./decimal.cjs");
var import_double = require("./double.cjs");
var import_enum = require("./enum.cjs");
var import_float = require("./float.cjs");
var import_int = require("./int.cjs");
var import_json = require("./json.cjs");
var import_mediumint = require("./mediumint.cjs");
var import_real = require("./real.cjs");
var import_serial = require("./serial.cjs");
var import_smallint = require("./smallint.cjs");
var import_text = require("./text.cjs");
var import_time = require("./time.cjs");
var import_timestamp = require("./timestamp.cjs");
var import_tinyint = require("./tinyint.cjs");
var import_varbinary = require("./varbinary.cjs");
var import_varchar = require("./varchar.cjs");
var import_year = require("./year.cjs");
function getSingleStoreColumnBuilders() {
return {
bigint: import_bigint.bigint,
binary: import_binary.binary,
boolean: import_boolean.boolean,
char: import_char.char,
customType: import_custom.customType,
date: import_date.date,
datetime: import_datetime.datetime,
decimal: import_decimal.decimal,
double: import_double.double,
singlestoreEnum: import_enum.singlestoreEnum,
float: import_float.float,
int: import_int.int,
json: import_json.json,
mediumint: import_mediumint.mediumint,
real: import_real.real,
serial: import_serial.serial,
smallint: import_smallint.smallint,
text: import_text.text,
time: import_time.time,
timestamp: import_timestamp.timestamp,
tinyint: import_tinyint.tinyint,
varbinary: import_varbinary.varbinary,
varchar: import_varchar.varchar,
year: import_year.year
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
getSingleStoreColumnBuilders
});
//# sourceMappingURL=all.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/all.ts"],"sourcesContent":["import { bigint } from './bigint.ts';\nimport { binary } from './binary.ts';\nimport { boolean } from './boolean.ts';\nimport { char } from './char.ts';\nimport { customType } from './custom.ts';\nimport { date } from './date.ts';\nimport { datetime } from './datetime.ts';\nimport { decimal } from './decimal.ts';\nimport { double } from './double.ts';\nimport { singlestoreEnum } from './enum.ts';\nimport { float } from './float.ts';\nimport { int } from './int.ts';\nimport { json } from './json.ts';\nimport { mediumint } from './mediumint.ts';\nimport { real } from './real.ts';\nimport { serial } from './serial.ts';\nimport { smallint } from './smallint.ts';\nimport { text } from './text.ts';\nimport { time } from './time.ts';\nimport { timestamp } from './timestamp.ts';\nimport { tinyint } from './tinyint.ts';\nimport { varbinary } from './varbinary.ts';\nimport { varchar } from './varchar.ts';\nimport { year } from './year.ts';\n\nexport function getSingleStoreColumnBuilders() {\n\treturn {\n\t\tbigint,\n\t\tbinary,\n\t\tboolean,\n\t\tchar,\n\t\tcustomType,\n\t\tdate,\n\t\tdatetime,\n\t\tdecimal,\n\t\tdouble,\n\t\tsinglestoreEnum,\n\t\tfloat,\n\t\tint,\n\t\tjson,\n\t\tmediumint,\n\t\treal,\n\t\tserial,\n\t\tsmallint,\n\t\ttext,\n\t\ttime,\n\t\ttimestamp,\n\t\ttinyint,\n\t\tvarbinary,\n\t\tvarchar,\n\t\tyear,\n\t};\n}\n\nexport type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuB;AACvB,oBAAuB;AACvB,qBAAwB;AACxB,kBAAqB;AACrB,oBAA2B;AAC3B,kBAAqB;AACrB,sBAAyB;AACzB,qBAAwB;AACxB,oBAAuB;AACvB,kBAAgC;AAChC,mBAAsB;AACtB,iBAAoB;AACpB,kBAAqB;AACrB,uBAA0B;AAC1B,kBAAqB;AACrB,oBAAuB;AACvB,sBAAyB;AACzB,kBAAqB;AACrB,kBAAqB;AACrB,uBAA0B;AAC1B,qBAAwB;AACxB,uBAA0B;AAC1B,qBAAwB;AACxB,kBAAqB;AAEd,SAAS,+BAA+B;AAC9C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}

View File

@ -0,0 +1,51 @@
import { bigint } from "./bigint.cjs";
import { binary } from "./binary.cjs";
import { boolean } from "./boolean.cjs";
import { char } from "./char.cjs";
import { customType } from "./custom.cjs";
import { date } from "./date.cjs";
import { datetime } from "./datetime.cjs";
import { decimal } from "./decimal.cjs";
import { double } from "./double.cjs";
import { singlestoreEnum } from "./enum.cjs";
import { float } from "./float.cjs";
import { int } from "./int.cjs";
import { json } from "./json.cjs";
import { mediumint } from "./mediumint.cjs";
import { real } from "./real.cjs";
import { serial } from "./serial.cjs";
import { smallint } from "./smallint.cjs";
import { text } from "./text.cjs";
import { time } from "./time.cjs";
import { timestamp } from "./timestamp.cjs";
import { tinyint } from "./tinyint.cjs";
import { varbinary } from "./varbinary.cjs";
import { varchar } from "./varchar.cjs";
import { year } from "./year.cjs";
export declare function getSingleStoreColumnBuilders(): {
bigint: typeof bigint;
binary: typeof binary;
boolean: typeof boolean;
char: typeof char;
customType: typeof customType;
date: typeof date;
datetime: typeof datetime;
decimal: typeof decimal;
double: typeof double;
singlestoreEnum: typeof singlestoreEnum;
float: typeof float;
int: typeof int;
json: typeof json;
mediumint: typeof mediumint;
real: typeof real;
serial: typeof serial;
smallint: typeof smallint;
text: typeof text;
time: typeof time;
timestamp: typeof timestamp;
tinyint: typeof tinyint;
varbinary: typeof varbinary;
varchar: typeof varchar;
year: typeof year;
};
export type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;

View File

@ -0,0 +1,51 @@
import { bigint } from "./bigint.js";
import { binary } from "./binary.js";
import { boolean } from "./boolean.js";
import { char } from "./char.js";
import { customType } from "./custom.js";
import { date } from "./date.js";
import { datetime } from "./datetime.js";
import { decimal } from "./decimal.js";
import { double } from "./double.js";
import { singlestoreEnum } from "./enum.js";
import { float } from "./float.js";
import { int } from "./int.js";
import { json } from "./json.js";
import { mediumint } from "./mediumint.js";
import { real } from "./real.js";
import { serial } from "./serial.js";
import { smallint } from "./smallint.js";
import { text } from "./text.js";
import { time } from "./time.js";
import { timestamp } from "./timestamp.js";
import { tinyint } from "./tinyint.js";
import { varbinary } from "./varbinary.js";
import { varchar } from "./varchar.js";
import { year } from "./year.js";
export declare function getSingleStoreColumnBuilders(): {
bigint: typeof bigint;
binary: typeof binary;
boolean: typeof boolean;
char: typeof char;
customType: typeof customType;
date: typeof date;
datetime: typeof datetime;
decimal: typeof decimal;
double: typeof double;
singlestoreEnum: typeof singlestoreEnum;
float: typeof float;
int: typeof int;
json: typeof json;
mediumint: typeof mediumint;
real: typeof real;
serial: typeof serial;
smallint: typeof smallint;
text: typeof text;
time: typeof time;
timestamp: typeof timestamp;
tinyint: typeof tinyint;
varbinary: typeof varbinary;
varchar: typeof varchar;
year: typeof year;
};
export type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;

View File

@ -0,0 +1,56 @@
import { bigint } from "./bigint.js";
import { binary } from "./binary.js";
import { boolean } from "./boolean.js";
import { char } from "./char.js";
import { customType } from "./custom.js";
import { date } from "./date.js";
import { datetime } from "./datetime.js";
import { decimal } from "./decimal.js";
import { double } from "./double.js";
import { singlestoreEnum } from "./enum.js";
import { float } from "./float.js";
import { int } from "./int.js";
import { json } from "./json.js";
import { mediumint } from "./mediumint.js";
import { real } from "./real.js";
import { serial } from "./serial.js";
import { smallint } from "./smallint.js";
import { text } from "./text.js";
import { time } from "./time.js";
import { timestamp } from "./timestamp.js";
import { tinyint } from "./tinyint.js";
import { varbinary } from "./varbinary.js";
import { varchar } from "./varchar.js";
import { year } from "./year.js";
function getSingleStoreColumnBuilders() {
return {
bigint,
binary,
boolean,
char,
customType,
date,
datetime,
decimal,
double,
singlestoreEnum,
float,
int,
json,
mediumint,
real,
serial,
smallint,
text,
time,
timestamp,
tinyint,
varbinary,
varchar,
year
};
}
export {
getSingleStoreColumnBuilders
};
//# sourceMappingURL=all.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/all.ts"],"sourcesContent":["import { bigint } from './bigint.ts';\nimport { binary } from './binary.ts';\nimport { boolean } from './boolean.ts';\nimport { char } from './char.ts';\nimport { customType } from './custom.ts';\nimport { date } from './date.ts';\nimport { datetime } from './datetime.ts';\nimport { decimal } from './decimal.ts';\nimport { double } from './double.ts';\nimport { singlestoreEnum } from './enum.ts';\nimport { float } from './float.ts';\nimport { int } from './int.ts';\nimport { json } from './json.ts';\nimport { mediumint } from './mediumint.ts';\nimport { real } from './real.ts';\nimport { serial } from './serial.ts';\nimport { smallint } from './smallint.ts';\nimport { text } from './text.ts';\nimport { time } from './time.ts';\nimport { timestamp } from './timestamp.ts';\nimport { tinyint } from './tinyint.ts';\nimport { varbinary } from './varbinary.ts';\nimport { varchar } from './varchar.ts';\nimport { year } from './year.ts';\n\nexport function getSingleStoreColumnBuilders() {\n\treturn {\n\t\tbigint,\n\t\tbinary,\n\t\tboolean,\n\t\tchar,\n\t\tcustomType,\n\t\tdate,\n\t\tdatetime,\n\t\tdecimal,\n\t\tdouble,\n\t\tsinglestoreEnum,\n\t\tfloat,\n\t\tint,\n\t\tjson,\n\t\tmediumint,\n\t\treal,\n\t\tserial,\n\t\tsmallint,\n\t\ttext,\n\t\ttime,\n\t\ttimestamp,\n\t\ttinyint,\n\t\tvarbinary,\n\t\tvarchar,\n\t\tyear,\n\t};\n}\n\nexport type SingleStoreColumnBuilders = ReturnType<typeof getSingleStoreColumnBuilders>;\n"],"mappings":"AAAA,SAAS,cAAc;AACvB,SAAS,cAAc;AACvB,SAAS,eAAe;AACxB,SAAS,YAAY;AACrB,SAAS,kBAAkB;AAC3B,SAAS,YAAY;AACrB,SAAS,gBAAgB;AACzB,SAAS,eAAe;AACxB,SAAS,cAAc;AACvB,SAAS,uBAAuB;AAChC,SAAS,aAAa;AACtB,SAAS,WAAW;AACpB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AACrB,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,YAAY;AACrB,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,eAAe;AACxB,SAAS,YAAY;AAEd,SAAS,+BAA+B;AAC9C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AACD;","names":[]}

View File

@ -0,0 +1,96 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var bigint_exports = {};
__export(bigint_exports, {
SingleStoreBigInt53: () => SingleStoreBigInt53,
SingleStoreBigInt53Builder: () => SingleStoreBigInt53Builder,
SingleStoreBigInt64: () => SingleStoreBigInt64,
SingleStoreBigInt64Builder: () => SingleStoreBigInt64Builder,
bigint: () => bigint
});
module.exports = __toCommonJS(bigint_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreBigInt53Builder extends import_common.SingleStoreColumnBuilderWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreBigInt53Builder";
constructor(name, unsigned = false) {
super(name, "number", "SingleStoreBigInt53");
this.config.unsigned = unsigned;
}
/** @internal */
build(table) {
return new SingleStoreBigInt53(
table,
this.config
);
}
}
class SingleStoreBigInt53 extends import_common.SingleStoreColumnWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreBigInt53";
getSQLType() {
return `bigint${this.config.unsigned ? " unsigned" : ""}`;
}
mapFromDriverValue(value) {
if (typeof value === "number") {
return value;
}
return Number(value);
}
}
class SingleStoreBigInt64Builder extends import_common.SingleStoreColumnBuilderWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreBigInt64Builder";
constructor(name, unsigned = false) {
super(name, "bigint", "SingleStoreBigInt64");
this.config.unsigned = unsigned;
}
/** @internal */
build(table) {
return new SingleStoreBigInt64(
table,
this.config
);
}
}
class SingleStoreBigInt64 extends import_common.SingleStoreColumnWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreBigInt64";
getSQLType() {
return `bigint${this.config.unsigned ? " unsigned" : ""}`;
}
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
mapFromDriverValue(value) {
return BigInt(value);
}
}
function bigint(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
if (config.mode === "number") {
return new SingleStoreBigInt53Builder(name, config.unsigned);
}
return new SingleStoreBigInt64Builder(name, config.unsigned);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreBigInt53,
SingleStoreBigInt53Builder,
SingleStoreBigInt64,
SingleStoreBigInt64Builder,
bigint
});
//# sourceMappingURL=bigint.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,53 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.cjs";
export type SingleStoreBigInt53BuilderInitial<TName extends string> = SingleStoreBigInt53Builder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreBigInt53';
data: number;
driverParam: number | string;
enumValues: undefined;
}>;
export declare class SingleStoreBigInt53Builder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreBigInt53'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], unsigned?: boolean);
}
export declare class SingleStoreBigInt53<T extends ColumnBaseConfig<'number', 'SingleStoreBigInt53'>> extends SingleStoreColumnWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: number | string): number;
}
export type SingleStoreBigInt64BuilderInitial<TName extends string> = SingleStoreBigInt64Builder<{
name: TName;
dataType: 'bigint';
columnType: 'SingleStoreBigInt64';
data: bigint;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreBigInt64Builder<T extends ColumnBuilderBaseConfig<'bigint', 'SingleStoreBigInt64'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], unsigned?: boolean);
}
export declare class SingleStoreBigInt64<T extends ColumnBaseConfig<'bigint', 'SingleStoreBigInt64'>> extends SingleStoreColumnWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: string): bigint;
}
export interface SingleStoreBigIntConfig<T extends 'number' | 'bigint' = 'number' | 'bigint'> {
mode: T;
unsigned?: boolean;
}
export declare function bigint<TMode extends SingleStoreBigIntConfig['mode']>(config: SingleStoreBigIntConfig<TMode>): TMode extends 'number' ? SingleStoreBigInt53BuilderInitial<''> : SingleStoreBigInt64BuilderInitial<''>;
export declare function bigint<TName extends string, TMode extends SingleStoreBigIntConfig['mode']>(name: TName, config: SingleStoreBigIntConfig<TMode>): TMode extends 'number' ? SingleStoreBigInt53BuilderInitial<TName> : SingleStoreBigInt64BuilderInitial<TName>;

View File

@ -0,0 +1,53 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
export type SingleStoreBigInt53BuilderInitial<TName extends string> = SingleStoreBigInt53Builder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreBigInt53';
data: number;
driverParam: number | string;
enumValues: undefined;
}>;
export declare class SingleStoreBigInt53Builder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreBigInt53'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], unsigned?: boolean);
}
export declare class SingleStoreBigInt53<T extends ColumnBaseConfig<'number', 'SingleStoreBigInt53'>> extends SingleStoreColumnWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: number | string): number;
}
export type SingleStoreBigInt64BuilderInitial<TName extends string> = SingleStoreBigInt64Builder<{
name: TName;
dataType: 'bigint';
columnType: 'SingleStoreBigInt64';
data: bigint;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreBigInt64Builder<T extends ColumnBuilderBaseConfig<'bigint', 'SingleStoreBigInt64'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], unsigned?: boolean);
}
export declare class SingleStoreBigInt64<T extends ColumnBaseConfig<'bigint', 'SingleStoreBigInt64'>> extends SingleStoreColumnWithAutoIncrement<T, {
unsigned: boolean;
}> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: string): bigint;
}
export interface SingleStoreBigIntConfig<T extends 'number' | 'bigint' = 'number' | 'bigint'> {
mode: T;
unsigned?: boolean;
}
export declare function bigint<TMode extends SingleStoreBigIntConfig['mode']>(config: SingleStoreBigIntConfig<TMode>): TMode extends 'number' ? SingleStoreBigInt53BuilderInitial<''> : SingleStoreBigInt64BuilderInitial<''>;
export declare function bigint<TName extends string, TMode extends SingleStoreBigIntConfig['mode']>(name: TName, config: SingleStoreBigIntConfig<TMode>): TMode extends 'number' ? SingleStoreBigInt53BuilderInitial<TName> : SingleStoreBigInt64BuilderInitial<TName>;

View File

@ -0,0 +1,68 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
class SingleStoreBigInt53Builder extends SingleStoreColumnBuilderWithAutoIncrement {
static [entityKind] = "SingleStoreBigInt53Builder";
constructor(name, unsigned = false) {
super(name, "number", "SingleStoreBigInt53");
this.config.unsigned = unsigned;
}
/** @internal */
build(table) {
return new SingleStoreBigInt53(
table,
this.config
);
}
}
class SingleStoreBigInt53 extends SingleStoreColumnWithAutoIncrement {
static [entityKind] = "SingleStoreBigInt53";
getSQLType() {
return `bigint${this.config.unsigned ? " unsigned" : ""}`;
}
mapFromDriverValue(value) {
if (typeof value === "number") {
return value;
}
return Number(value);
}
}
class SingleStoreBigInt64Builder extends SingleStoreColumnBuilderWithAutoIncrement {
static [entityKind] = "SingleStoreBigInt64Builder";
constructor(name, unsigned = false) {
super(name, "bigint", "SingleStoreBigInt64");
this.config.unsigned = unsigned;
}
/** @internal */
build(table) {
return new SingleStoreBigInt64(
table,
this.config
);
}
}
class SingleStoreBigInt64 extends SingleStoreColumnWithAutoIncrement {
static [entityKind] = "SingleStoreBigInt64";
getSQLType() {
return `bigint${this.config.unsigned ? " unsigned" : ""}`;
}
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
mapFromDriverValue(value) {
return BigInt(value);
}
}
function bigint(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
if (config.mode === "number") {
return new SingleStoreBigInt53Builder(name, config.unsigned);
}
return new SingleStoreBigInt64Builder(name, config.unsigned);
}
export {
SingleStoreBigInt53,
SingleStoreBigInt53Builder,
SingleStoreBigInt64,
SingleStoreBigInt64Builder,
bigint
};
//# sourceMappingURL=bigint.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,60 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var binary_exports = {};
__export(binary_exports, {
SingleStoreBinary: () => SingleStoreBinary,
SingleStoreBinaryBuilder: () => SingleStoreBinaryBuilder,
binary: () => binary
});
module.exports = __toCommonJS(binary_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreBinaryBuilder extends import_common.SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreBinaryBuilder";
constructor(name, length) {
super(name, "string", "SingleStoreBinary");
this.config.length = length;
}
/** @internal */
build(table) {
return new SingleStoreBinary(
table,
this.config
);
}
}
class SingleStoreBinary extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreBinary";
length = this.config.length;
getSQLType() {
return this.length === void 0 ? `binary` : `binary(${this.length})`;
}
}
function binary(a, b = {}) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
return new SingleStoreBinaryBuilder(name, config.length);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreBinary,
SingleStoreBinaryBuilder,
binary
});
//# sourceMappingURL=binary.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/binary.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreBinaryBuilderInitial<TName extends string> = SingleStoreBinaryBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SingleStoreBinary';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreBinaryBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreBinary'>>\n\textends SingleStoreColumnBuilder<\n\t\tT,\n\t\tSingleStoreBinaryConfig\n\t>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreBinaryBuilder';\n\n\tconstructor(name: T['name'], length: number | undefined) {\n\t\tsuper(name, 'string', 'SingleStoreBinary');\n\t\tthis.config.length = length;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreBinary<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreBinary<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreBinary<T extends ColumnBaseConfig<'string', 'SingleStoreBinary'>> extends SingleStoreColumn<\n\tT,\n\tSingleStoreBinaryConfig\n> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreBinary';\n\n\tlength: number | undefined = this.config.length;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `binary` : `binary(${this.length})`;\n\t}\n}\n\nexport interface SingleStoreBinaryConfig {\n\tlength?: number;\n}\n\nexport function binary(): SingleStoreBinaryBuilderInitial<''>;\nexport function binary(\n\tconfig?: SingleStoreBinaryConfig,\n): SingleStoreBinaryBuilderInitial<''>;\nexport function binary<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreBinaryConfig,\n): SingleStoreBinaryBuilderInitial<TName>;\nexport function binary(a?: string | SingleStoreBinaryConfig, b: SingleStoreBinaryConfig = {}) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreBinaryConfig>(a, b);\n\treturn new SingleStoreBinaryBuilder(name, config.length);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,mBAAuC;AACvC,oBAA4D;AAYrD,MAAM,iCACJ,uCAIT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA4B;AACxD,UAAM,MAAM,UAAU,mBAAmB;AACzC,SAAK,OAAO,SAAS;AAAA,EACtB;AAAA;AAAA,EAGS,MACR,OACqD;AACrD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,0BAAqF,gCAGhG;AAAA,EACD,QAA0B,wBAAU,IAAY;AAAA,EAEhD,SAA6B,KAAK,OAAO;AAAA,EAEzC,aAAqB;AACpB,WAAO,KAAK,WAAW,SAAY,WAAW,UAAU,KAAK,MAAM;AAAA,EACpE;AACD;AAcO,SAAS,OAAO,GAAsC,IAA6B,CAAC,GAAG;AAC7F,QAAM,EAAE,MAAM,OAAO,QAAI,qCAAgD,GAAG,CAAC;AAC7E,SAAO,IAAI,yBAAyB,MAAM,OAAO,MAAM;AACxD;","names":[]}

View File

@ -0,0 +1,28 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export type SingleStoreBinaryBuilderInitial<TName extends string> = SingleStoreBinaryBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreBinary';
data: string;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreBinaryBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreBinary'>> extends SingleStoreColumnBuilder<T, SingleStoreBinaryConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], length: number | undefined);
}
export declare class SingleStoreBinary<T extends ColumnBaseConfig<'string', 'SingleStoreBinary'>> extends SingleStoreColumn<T, SingleStoreBinaryConfig> {
static readonly [entityKind]: string;
length: number | undefined;
getSQLType(): string;
}
export interface SingleStoreBinaryConfig {
length?: number;
}
export declare function binary(): SingleStoreBinaryBuilderInitial<''>;
export declare function binary(config?: SingleStoreBinaryConfig): SingleStoreBinaryBuilderInitial<''>;
export declare function binary<TName extends string>(name: TName, config?: SingleStoreBinaryConfig): SingleStoreBinaryBuilderInitial<TName>;

View File

@ -0,0 +1,28 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export type SingleStoreBinaryBuilderInitial<TName extends string> = SingleStoreBinaryBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreBinary';
data: string;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreBinaryBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreBinary'>> extends SingleStoreColumnBuilder<T, SingleStoreBinaryConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], length: number | undefined);
}
export declare class SingleStoreBinary<T extends ColumnBaseConfig<'string', 'SingleStoreBinary'>> extends SingleStoreColumn<T, SingleStoreBinaryConfig> {
static readonly [entityKind]: string;
length: number | undefined;
getSQLType(): string;
}
export interface SingleStoreBinaryConfig {
length?: number;
}
export declare function binary(): SingleStoreBinaryBuilderInitial<''>;
export declare function binary(config?: SingleStoreBinaryConfig): SingleStoreBinaryBuilderInitial<''>;
export declare function binary<TName extends string>(name: TName, config?: SingleStoreBinaryConfig): SingleStoreBinaryBuilderInitial<TName>;

View File

@ -0,0 +1,34 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreBinaryBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreBinaryBuilder";
constructor(name, length) {
super(name, "string", "SingleStoreBinary");
this.config.length = length;
}
/** @internal */
build(table) {
return new SingleStoreBinary(
table,
this.config
);
}
}
class SingleStoreBinary extends SingleStoreColumn {
static [entityKind] = "SingleStoreBinary";
length = this.config.length;
getSQLType() {
return this.length === void 0 ? `binary` : `binary(${this.length})`;
}
}
function binary(a, b = {}) {
const { name, config } = getColumnNameAndConfig(a, b);
return new SingleStoreBinaryBuilder(name, config.length);
}
export {
SingleStoreBinary,
SingleStoreBinaryBuilder,
binary
};
//# sourceMappingURL=binary.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/binary.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreBinaryBuilderInitial<TName extends string> = SingleStoreBinaryBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SingleStoreBinary';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreBinaryBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreBinary'>>\n\textends SingleStoreColumnBuilder<\n\t\tT,\n\t\tSingleStoreBinaryConfig\n\t>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreBinaryBuilder';\n\n\tconstructor(name: T['name'], length: number | undefined) {\n\t\tsuper(name, 'string', 'SingleStoreBinary');\n\t\tthis.config.length = length;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreBinary<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreBinary<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreBinary<T extends ColumnBaseConfig<'string', 'SingleStoreBinary'>> extends SingleStoreColumn<\n\tT,\n\tSingleStoreBinaryConfig\n> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreBinary';\n\n\tlength: number | undefined = this.config.length;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `binary` : `binary(${this.length})`;\n\t}\n}\n\nexport interface SingleStoreBinaryConfig {\n\tlength?: number;\n}\n\nexport function binary(): SingleStoreBinaryBuilderInitial<''>;\nexport function binary(\n\tconfig?: SingleStoreBinaryConfig,\n): SingleStoreBinaryBuilderInitial<''>;\nexport function binary<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreBinaryConfig,\n): SingleStoreBinaryBuilderInitial<TName>;\nexport function binary(a?: string | SingleStoreBinaryConfig, b: SingleStoreBinaryConfig = {}) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreBinaryConfig>(a, b);\n\treturn new SingleStoreBinaryBuilder(name, config.length);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,8BAA8B;AACvC,SAAS,mBAAmB,gCAAgC;AAYrD,MAAM,iCACJ,yBAIT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA4B;AACxD,UAAM,MAAM,UAAU,mBAAmB;AACzC,SAAK,OAAO,SAAS;AAAA,EACtB;AAAA;AAAA,EAGS,MACR,OACqD;AACrD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,0BAAqF,kBAGhG;AAAA,EACD,QAA0B,UAAU,IAAY;AAAA,EAEhD,SAA6B,KAAK,OAAO;AAAA,EAEzC,aAAqB;AACpB,WAAO,KAAK,WAAW,SAAY,WAAW,UAAU,KAAK,MAAM;AAAA,EACpE;AACD;AAcO,SAAS,OAAO,GAAsC,IAA6B,CAAC,GAAG;AAC7F,QAAM,EAAE,MAAM,OAAO,IAAI,uBAAgD,GAAG,CAAC;AAC7E,SAAO,IAAI,yBAAyB,MAAM,OAAO,MAAM;AACxD;","names":[]}

View File

@ -0,0 +1,62 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var boolean_exports = {};
__export(boolean_exports, {
SingleStoreBoolean: () => SingleStoreBoolean,
SingleStoreBooleanBuilder: () => SingleStoreBooleanBuilder,
boolean: () => boolean
});
module.exports = __toCommonJS(boolean_exports);
var import_entity = require("../../entity.cjs");
var import_common = require("./common.cjs");
class SingleStoreBooleanBuilder extends import_common.SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreBooleanBuilder";
constructor(name) {
super(name, "boolean", "SingleStoreBoolean");
}
/** @internal */
build(table) {
return new SingleStoreBoolean(
table,
this.config
);
}
}
class SingleStoreBoolean extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreBoolean";
getSQLType() {
return "boolean";
}
mapFromDriverValue(value) {
if (typeof value === "boolean") {
return value;
}
return value === 1;
}
}
function boolean(name) {
return new SingleStoreBooleanBuilder(name ?? "");
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreBoolean,
SingleStoreBooleanBuilder,
boolean
});
//# sourceMappingURL=boolean.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/boolean.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreBooleanBuilderInitial<TName extends string> = SingleStoreBooleanBuilder<{\n\tname: TName;\n\tdataType: 'boolean';\n\tcolumnType: 'SingleStoreBoolean';\n\tdata: boolean;\n\tdriverParam: number | boolean;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'SingleStoreBoolean'>>\n\textends SingleStoreColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreBooleanBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'boolean', 'SingleStoreBoolean');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreBoolean<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreBoolean<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreBoolean<T extends ColumnBaseConfig<'boolean', 'SingleStoreBoolean'>>\n\textends SingleStoreColumn<T>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreBoolean';\n\n\tgetSQLType(): string {\n\t\treturn 'boolean';\n\t}\n\n\toverride mapFromDriverValue(value: number | boolean): boolean {\n\t\tif (typeof value === 'boolean') {\n\t\t\treturn value;\n\t\t}\n\t\treturn value === 1;\n\t}\n}\n\nexport function boolean(): SingleStoreBooleanBuilderInitial<''>;\nexport function boolean<TName extends string>(name: TName): SingleStoreBooleanBuilderInitial<TName>;\nexport function boolean(name?: string) {\n\treturn new SingleStoreBooleanBuilder(name ?? '');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,oBAA4D;AAYrD,MAAM,kCACJ,uCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,WAAW,oBAAoB;AAAA,EAC5C;AAAA;AAAA,EAGS,MACR,OACsD;AACtD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,2BACJ,gCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AAAA,EAES,mBAAmB,OAAkC;AAC7D,QAAI,OAAO,UAAU,WAAW;AAC/B,aAAO;AAAA,IACR;AACA,WAAO,UAAU;AAAA,EAClB;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,0BAA0B,QAAQ,EAAE;AAChD;","names":[]}

View File

@ -0,0 +1,24 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export type SingleStoreBooleanBuilderInitial<TName extends string> = SingleStoreBooleanBuilder<{
name: TName;
dataType: 'boolean';
columnType: 'SingleStoreBoolean';
data: boolean;
driverParam: number | boolean;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'SingleStoreBoolean'>> extends SingleStoreColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreBoolean<T extends ColumnBaseConfig<'boolean', 'SingleStoreBoolean'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: number | boolean): boolean;
}
export declare function boolean(): SingleStoreBooleanBuilderInitial<''>;
export declare function boolean<TName extends string>(name: TName): SingleStoreBooleanBuilderInitial<TName>;

View File

@ -0,0 +1,24 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export type SingleStoreBooleanBuilderInitial<TName extends string> = SingleStoreBooleanBuilder<{
name: TName;
dataType: 'boolean';
columnType: 'SingleStoreBoolean';
data: boolean;
driverParam: number | boolean;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'SingleStoreBoolean'>> extends SingleStoreColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreBoolean<T extends ColumnBaseConfig<'boolean', 'SingleStoreBoolean'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: number | boolean): boolean;
}
export declare function boolean(): SingleStoreBooleanBuilderInitial<''>;
export declare function boolean<TName extends string>(name: TName): SingleStoreBooleanBuilderInitial<TName>;

View File

@ -0,0 +1,36 @@
import { entityKind } from "../../entity.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreBooleanBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreBooleanBuilder";
constructor(name) {
super(name, "boolean", "SingleStoreBoolean");
}
/** @internal */
build(table) {
return new SingleStoreBoolean(
table,
this.config
);
}
}
class SingleStoreBoolean extends SingleStoreColumn {
static [entityKind] = "SingleStoreBoolean";
getSQLType() {
return "boolean";
}
mapFromDriverValue(value) {
if (typeof value === "boolean") {
return value;
}
return value === 1;
}
}
function boolean(name) {
return new SingleStoreBooleanBuilder(name ?? "");
}
export {
SingleStoreBoolean,
SingleStoreBooleanBuilder,
boolean
};
//# sourceMappingURL=boolean.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/boolean.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreBooleanBuilderInitial<TName extends string> = SingleStoreBooleanBuilder<{\n\tname: TName;\n\tdataType: 'boolean';\n\tcolumnType: 'SingleStoreBoolean';\n\tdata: boolean;\n\tdriverParam: number | boolean;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreBooleanBuilder<T extends ColumnBuilderBaseConfig<'boolean', 'SingleStoreBoolean'>>\n\textends SingleStoreColumnBuilder<T>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreBooleanBuilder';\n\n\tconstructor(name: T['name']) {\n\t\tsuper(name, 'boolean', 'SingleStoreBoolean');\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreBoolean<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreBoolean<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreBoolean<T extends ColumnBaseConfig<'boolean', 'SingleStoreBoolean'>>\n\textends SingleStoreColumn<T>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreBoolean';\n\n\tgetSQLType(): string {\n\t\treturn 'boolean';\n\t}\n\n\toverride mapFromDriverValue(value: number | boolean): boolean {\n\t\tif (typeof value === 'boolean') {\n\t\t\treturn value;\n\t\t}\n\t\treturn value === 1;\n\t}\n}\n\nexport function boolean(): SingleStoreBooleanBuilderInitial<''>;\nexport function boolean<TName extends string>(name: TName): SingleStoreBooleanBuilderInitial<TName>;\nexport function boolean(name?: string) {\n\treturn new SingleStoreBooleanBuilder(name ?? '');\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,mBAAmB,gCAAgC;AAYrD,MAAM,kCACJ,yBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB;AAC5B,UAAM,MAAM,WAAW,oBAAoB;AAAA,EAC5C;AAAA;AAAA,EAGS,MACR,OACsD;AACtD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,2BACJ,kBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO;AAAA,EACR;AAAA,EAES,mBAAmB,OAAkC;AAC7D,QAAI,OAAO,UAAU,WAAW;AAC/B,aAAO;AAAA,IACR;AACA,WAAO,UAAU;AAAA,EAClB;AACD;AAIO,SAAS,QAAQ,MAAe;AACtC,SAAO,IAAI,0BAA0B,QAAQ,EAAE;AAChD;","names":[]}

View File

@ -0,0 +1,62 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var char_exports = {};
__export(char_exports, {
SingleStoreChar: () => SingleStoreChar,
SingleStoreCharBuilder: () => SingleStoreCharBuilder,
char: () => char
});
module.exports = __toCommonJS(char_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreCharBuilder extends import_common.SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreCharBuilder";
constructor(name, config) {
super(name, "string", "SingleStoreChar");
this.config.length = config.length;
this.config.enum = config.enum;
}
/** @internal */
build(table) {
return new SingleStoreChar(
table,
this.config
);
}
}
class SingleStoreChar extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreChar";
length = this.config.length;
enumValues = this.config.enum;
getSQLType() {
return this.length === void 0 ? `char` : `char(${this.length})`;
}
}
function char(a, b = {}) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
return new SingleStoreCharBuilder(name, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreChar,
SingleStoreCharBuilder,
char
});
//# sourceMappingURL=char.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/char.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig, type Writable } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> =\n\tSingleStoreCharBuilder<{\n\t\tname: TName;\n\t\tdataType: 'string';\n\t\tcolumnType: 'SingleStoreChar';\n\t\tdata: TEnum[number];\n\t\tdriverParam: number | string;\n\t\tenumValues: TEnum;\n\t\tgenerated: undefined;\n\t}>;\n\nexport class SingleStoreCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreChar'>>\n\textends SingleStoreColumnBuilder<\n\t\tT,\n\t\tSingleStoreCharConfig<T['enumValues']>\n\t>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreCharBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreCharConfig<T['enumValues']>) {\n\t\tsuper(name, 'string', 'SingleStoreChar');\n\t\tthis.config.length = config.length;\n\t\tthis.config.enum = config.enum;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }> {\n\t\treturn new SingleStoreChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreChar<T extends ColumnBaseConfig<'string', 'SingleStoreChar'>>\n\textends SingleStoreColumn<T, SingleStoreCharConfig<T['enumValues']>>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreChar';\n\n\treadonly length: number | undefined = this.config.length;\n\toverride readonly enumValues = this.config.enum;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `char` : `char(${this.length})`;\n\t}\n}\n\nexport interface SingleStoreCharConfig<\n\tTEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined,\n> {\n\tlength?: number;\n\tenum?: TEnum;\n}\n\nexport function char(): SingleStoreCharBuilderInitial<'', [string, ...string[]]>;\nexport function char<U extends string, T extends Readonly<[U, ...U[]]>>(\n\tconfig?: SingleStoreCharConfig<T | Writable<T>>,\n): SingleStoreCharBuilderInitial<'', Writable<T>>;\nexport function char<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(\n\tname: TName,\n\tconfig?: SingleStoreCharConfig<T | Writable<T>>,\n): SingleStoreCharBuilderInitial<TName, Writable<T>>;\nexport function char(a?: string | SingleStoreCharConfig, b: SingleStoreCharConfig = {}): any {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreCharConfig>(a, b);\n\treturn new SingleStoreCharBuilder(name, config as any);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,mBAAsD;AACtD,oBAA4D;AAarD,MAAM,+BACJ,uCAIT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAgD;AAC5E,UAAM,MAAM,UAAU,iBAAiB;AACvC,SAAK,OAAO,SAAS,OAAO;AAC5B,SAAK,OAAO,OAAO,OAAO;AAAA,EAC3B;AAAA;AAAA,EAGS,MACR,OACqF;AACrF,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,wBACJ,gCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEvC,SAA6B,KAAK,OAAO;AAAA,EAChC,aAAa,KAAK,OAAO;AAAA,EAE3C,aAAqB;AACpB,WAAO,KAAK,WAAW,SAAY,SAAS,QAAQ,KAAK,MAAM;AAAA,EAChE;AACD;AAiBO,SAAS,KAAK,GAAoC,IAA2B,CAAC,GAAQ;AAC5F,QAAM,EAAE,MAAM,OAAO,QAAI,qCAA8C,GAAG,CAAC;AAC3E,SAAO,IAAI,uBAAuB,MAAM,MAAa;AACtD;","names":[]}

View File

@ -0,0 +1,31 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { type Writable } from "../../utils.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export type SingleStoreCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = SingleStoreCharBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreChar';
data: TEnum[number];
driverParam: number | string;
enumValues: TEnum;
generated: undefined;
}>;
export declare class SingleStoreCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreChar'>> extends SingleStoreColumnBuilder<T, SingleStoreCharConfig<T['enumValues']>> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreCharConfig<T['enumValues']>);
}
export declare class SingleStoreChar<T extends ColumnBaseConfig<'string', 'SingleStoreChar'>> extends SingleStoreColumn<T, SingleStoreCharConfig<T['enumValues']>> {
static readonly [entityKind]: string;
readonly length: number | undefined;
readonly enumValues: T["enumValues"] | undefined;
getSQLType(): string;
}
export interface SingleStoreCharConfig<TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined> {
length?: number;
enum?: TEnum;
}
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>>;

View File

@ -0,0 +1,31 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { type Writable } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export type SingleStoreCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = SingleStoreCharBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreChar';
data: TEnum[number];
driverParam: number | string;
enumValues: TEnum;
generated: undefined;
}>;
export declare class SingleStoreCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreChar'>> extends SingleStoreColumnBuilder<T, SingleStoreCharConfig<T['enumValues']>> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreCharConfig<T['enumValues']>);
}
export declare class SingleStoreChar<T extends ColumnBaseConfig<'string', 'SingleStoreChar'>> extends SingleStoreColumn<T, SingleStoreCharConfig<T['enumValues']>> {
static readonly [entityKind]: string;
readonly length: number | undefined;
readonly enumValues: T["enumValues"] | undefined;
getSQLType(): string;
}
export interface SingleStoreCharConfig<TEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined> {
length?: number;
enum?: TEnum;
}
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>>;

View File

@ -0,0 +1,36 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreCharBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreCharBuilder";
constructor(name, config) {
super(name, "string", "SingleStoreChar");
this.config.length = config.length;
this.config.enum = config.enum;
}
/** @internal */
build(table) {
return new SingleStoreChar(
table,
this.config
);
}
}
class SingleStoreChar extends SingleStoreColumn {
static [entityKind] = "SingleStoreChar";
length = this.config.length;
enumValues = this.config.enum;
getSQLType() {
return this.length === void 0 ? `char` : `char(${this.length})`;
}
}
function char(a, b = {}) {
const { name, config } = getColumnNameAndConfig(a, b);
return new SingleStoreCharBuilder(name, config);
}
export {
SingleStoreChar,
SingleStoreCharBuilder,
char
};
//# sourceMappingURL=char.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/char.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig, type Writable } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreCharBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> =\n\tSingleStoreCharBuilder<{\n\t\tname: TName;\n\t\tdataType: 'string';\n\t\tcolumnType: 'SingleStoreChar';\n\t\tdata: TEnum[number];\n\t\tdriverParam: number | string;\n\t\tenumValues: TEnum;\n\t\tgenerated: undefined;\n\t}>;\n\nexport class SingleStoreCharBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreChar'>>\n\textends SingleStoreColumnBuilder<\n\t\tT,\n\t\tSingleStoreCharConfig<T['enumValues']>\n\t>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreCharBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreCharConfig<T['enumValues']>) {\n\t\tsuper(name, 'string', 'SingleStoreChar');\n\t\tthis.config.length = config.length;\n\t\tthis.config.enum = config.enum;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }> {\n\t\treturn new SingleStoreChar<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreChar<T extends ColumnBaseConfig<'string', 'SingleStoreChar'>>\n\textends SingleStoreColumn<T, SingleStoreCharConfig<T['enumValues']>>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreChar';\n\n\treadonly length: number | undefined = this.config.length;\n\toverride readonly enumValues = this.config.enum;\n\n\tgetSQLType(): string {\n\t\treturn this.length === undefined ? `char` : `char(${this.length})`;\n\t}\n}\n\nexport interface SingleStoreCharConfig<\n\tTEnum extends readonly string[] | string[] | undefined = readonly string[] | string[] | undefined,\n> {\n\tlength?: number;\n\tenum?: TEnum;\n}\n\nexport function char(): SingleStoreCharBuilderInitial<'', [string, ...string[]]>;\nexport function char<U extends string, T extends Readonly<[U, ...U[]]>>(\n\tconfig?: SingleStoreCharConfig<T | Writable<T>>,\n): SingleStoreCharBuilderInitial<'', Writable<T>>;\nexport function char<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(\n\tname: TName,\n\tconfig?: SingleStoreCharConfig<T | Writable<T>>,\n): SingleStoreCharBuilderInitial<TName, Writable<T>>;\nexport function char(a?: string | SingleStoreCharConfig, b: SingleStoreCharConfig = {}): any {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreCharConfig>(a, b);\n\treturn new SingleStoreCharBuilder(name, config as any);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,8BAA6C;AACtD,SAAS,mBAAmB,gCAAgC;AAarD,MAAM,+BACJ,yBAIT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAgD;AAC5E,UAAM,MAAM,UAAU,iBAAiB;AACvC,SAAK,OAAO,SAAS,OAAO;AAC5B,SAAK,OAAO,OAAO,OAAO;AAAA,EAC3B;AAAA;AAAA,EAGS,MACR,OACqF;AACrF,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,wBACJ,kBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEvC,SAA6B,KAAK,OAAO;AAAA,EAChC,aAAa,KAAK,OAAO;AAAA,EAE3C,aAAqB;AACpB,WAAO,KAAK,WAAW,SAAY,SAAS,QAAQ,KAAK,MAAM;AAAA,EAChE;AACD;AAiBO,SAAS,KAAK,GAAoC,IAA2B,CAAC,GAAQ;AAC5F,QAAM,EAAE,MAAM,OAAO,IAAI,uBAA8C,GAAG,CAAC;AAC3E,SAAO,IAAI,uBAAuB,MAAM,MAAa;AACtD;","names":[]}

View File

@ -0,0 +1,82 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var common_exports = {};
__export(common_exports, {
SingleStoreColumn: () => SingleStoreColumn,
SingleStoreColumnBuilder: () => SingleStoreColumnBuilder,
SingleStoreColumnBuilderWithAutoIncrement: () => SingleStoreColumnBuilderWithAutoIncrement,
SingleStoreColumnWithAutoIncrement: () => SingleStoreColumnWithAutoIncrement
});
module.exports = __toCommonJS(common_exports);
var import_column_builder = require("../../column-builder.cjs");
var import_column = require("../../column.cjs");
var import_entity = require("../../entity.cjs");
var import_unique_constraint = require("../unique-constraint.cjs");
class SingleStoreColumnBuilder extends import_column_builder.ColumnBuilder {
static [import_entity.entityKind] = "SingleStoreColumnBuilder";
unique(name) {
this.config.isUnique = true;
this.config.uniqueName = name;
return this;
}
// TODO: Implement generated columns for SingleStore (https://docs.singlestore.com/cloud/create-a-database/using-persistent-computed-columns/)
/** @internal */
generatedAlwaysAs(as, config) {
this.config.generated = {
as,
type: "always",
mode: config?.mode ?? "virtual"
};
return this;
}
}
class SingleStoreColumn extends import_column.Column {
constructor(table, config) {
if (!config.uniqueName) {
config.uniqueName = (0, import_unique_constraint.uniqueKeyName)(table, [config.name]);
}
super(table, config);
this.table = table;
}
static [import_entity.entityKind] = "SingleStoreColumn";
}
class SingleStoreColumnBuilderWithAutoIncrement extends SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreColumnBuilderWithAutoIncrement";
constructor(name, dataType, columnType) {
super(name, dataType, columnType);
this.config.autoIncrement = false;
}
autoincrement() {
this.config.autoIncrement = true;
this.config.hasDefault = true;
return this;
}
}
class SingleStoreColumnWithAutoIncrement extends SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreColumnWithAutoIncrement";
autoIncrement = this.config.autoIncrement;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreColumn,
SingleStoreColumnBuilder,
SingleStoreColumnBuilderWithAutoIncrement,
SingleStoreColumnWithAutoIncrement
});
//# sourceMappingURL=common.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,42 @@
import type { ColumnBuilderBase, ColumnBuilderBaseConfig, ColumnBuilderExtraConfig, ColumnBuilderRuntimeConfig, ColumnDataType, HasDefault, IsAutoincrement } from "../../column-builder.cjs";
import { ColumnBuilder } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { Column } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { SingleStoreTable } from "../table.cjs";
import type { Update } from "../../utils.cjs";
export interface SingleStoreColumnBuilderBase<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TTypeConfig extends object = object> extends ColumnBuilderBase<T, TTypeConfig & {
dialect: 'singlestore';
}> {
}
export interface SingleStoreGeneratedColumnConfig {
mode?: 'virtual' | 'stored';
}
export declare abstract class SingleStoreColumnBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string> & {
data: any;
}, TRuntimeConfig extends object = object, TTypeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig> extends ColumnBuilder<T, TRuntimeConfig, TTypeConfig & {
dialect: 'singlestore';
}, TExtraConfig> implements SingleStoreColumnBuilderBase<T, TTypeConfig> {
static readonly [entityKind]: string;
unique(name?: string): this;
}
export declare abstract class SingleStoreColumn<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = {}, TTypeConfig extends object = {}> extends Column<T, TRuntimeConfig, TTypeConfig & {
dialect: 'singlestore';
}> {
readonly table: SingleStoreTable;
static readonly [entityKind]: string;
constructor(table: SingleStoreTable, config: ColumnBuilderRuntimeConfig<T['data'], TRuntimeConfig>);
}
export type AnySingleStoreColumn<TPartial extends Partial<ColumnBaseConfig<ColumnDataType, string>> = {}> = SingleStoreColumn<Required<Update<ColumnBaseConfig<ColumnDataType, string>, TPartial>>>;
export interface SingleStoreColumnWithAutoIncrementConfig {
autoIncrement: boolean;
}
export declare abstract class SingleStoreColumnBuilderWithAutoIncrement<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig> extends SingleStoreColumnBuilder<T, TRuntimeConfig & SingleStoreColumnWithAutoIncrementConfig, TExtraConfig> {
static readonly [entityKind]: string;
constructor(name: NonNullable<T['name']>, dataType: T['dataType'], columnType: T['columnType']);
autoincrement(): IsAutoincrement<HasDefault<this>>;
}
export declare abstract class SingleStoreColumnWithAutoIncrement<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SingleStoreColumn<T, SingleStoreColumnWithAutoIncrementConfig & TRuntimeConfig> {
static readonly [entityKind]: string;
readonly autoIncrement: boolean;
}

View File

@ -0,0 +1,42 @@
import type { ColumnBuilderBase, ColumnBuilderBaseConfig, ColumnBuilderExtraConfig, ColumnBuilderRuntimeConfig, ColumnDataType, HasDefault, IsAutoincrement } from "../../column-builder.js";
import { ColumnBuilder } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { Column } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { SingleStoreTable } from "../table.js";
import type { Update } from "../../utils.js";
export interface SingleStoreColumnBuilderBase<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TTypeConfig extends object = object> extends ColumnBuilderBase<T, TTypeConfig & {
dialect: 'singlestore';
}> {
}
export interface SingleStoreGeneratedColumnConfig {
mode?: 'virtual' | 'stored';
}
export declare abstract class SingleStoreColumnBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string> & {
data: any;
}, TRuntimeConfig extends object = object, TTypeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig> extends ColumnBuilder<T, TRuntimeConfig, TTypeConfig & {
dialect: 'singlestore';
}, TExtraConfig> implements SingleStoreColumnBuilderBase<T, TTypeConfig> {
static readonly [entityKind]: string;
unique(name?: string): this;
}
export declare abstract class SingleStoreColumn<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = {}, TTypeConfig extends object = {}> extends Column<T, TRuntimeConfig, TTypeConfig & {
dialect: 'singlestore';
}> {
readonly table: SingleStoreTable;
static readonly [entityKind]: string;
constructor(table: SingleStoreTable, config: ColumnBuilderRuntimeConfig<T['data'], TRuntimeConfig>);
}
export type AnySingleStoreColumn<TPartial extends Partial<ColumnBaseConfig<ColumnDataType, string>> = {}> = SingleStoreColumn<Required<Update<ColumnBaseConfig<ColumnDataType, string>, TPartial>>>;
export interface SingleStoreColumnWithAutoIncrementConfig {
autoIncrement: boolean;
}
export declare abstract class SingleStoreColumnBuilderWithAutoIncrement<T extends ColumnBuilderBaseConfig<ColumnDataType, string> = ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig> extends SingleStoreColumnBuilder<T, TRuntimeConfig & SingleStoreColumnWithAutoIncrementConfig, TExtraConfig> {
static readonly [entityKind]: string;
constructor(name: NonNullable<T['name']>, dataType: T['dataType'], columnType: T['columnType']);
autoincrement(): IsAutoincrement<HasDefault<this>>;
}
export declare abstract class SingleStoreColumnWithAutoIncrement<T extends ColumnBaseConfig<ColumnDataType, string> = ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SingleStoreColumn<T, SingleStoreColumnWithAutoIncrementConfig & TRuntimeConfig> {
static readonly [entityKind]: string;
readonly autoIncrement: boolean;
}

View File

@ -0,0 +1,55 @@
import { ColumnBuilder } from "../../column-builder.js";
import { Column } from "../../column.js";
import { entityKind } from "../../entity.js";
import { uniqueKeyName } from "../unique-constraint.js";
class SingleStoreColumnBuilder extends ColumnBuilder {
static [entityKind] = "SingleStoreColumnBuilder";
unique(name) {
this.config.isUnique = true;
this.config.uniqueName = name;
return this;
}
// TODO: Implement generated columns for SingleStore (https://docs.singlestore.com/cloud/create-a-database/using-persistent-computed-columns/)
/** @internal */
generatedAlwaysAs(as, config) {
this.config.generated = {
as,
type: "always",
mode: config?.mode ?? "virtual"
};
return this;
}
}
class SingleStoreColumn extends Column {
constructor(table, config) {
if (!config.uniqueName) {
config.uniqueName = uniqueKeyName(table, [config.name]);
}
super(table, config);
this.table = table;
}
static [entityKind] = "SingleStoreColumn";
}
class SingleStoreColumnBuilderWithAutoIncrement extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreColumnBuilderWithAutoIncrement";
constructor(name, dataType, columnType) {
super(name, dataType, columnType);
this.config.autoIncrement = false;
}
autoincrement() {
this.config.autoIncrement = true;
this.config.hasDefault = true;
return this;
}
}
class SingleStoreColumnWithAutoIncrement extends SingleStoreColumn {
static [entityKind] = "SingleStoreColumnWithAutoIncrement";
autoIncrement = this.config.autoIncrement;
}
export {
SingleStoreColumn,
SingleStoreColumnBuilder,
SingleStoreColumnBuilderWithAutoIncrement,
SingleStoreColumnWithAutoIncrement
};
//# sourceMappingURL=common.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,77 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var custom_exports = {};
__export(custom_exports, {
SingleStoreCustomColumn: () => SingleStoreCustomColumn,
SingleStoreCustomColumnBuilder: () => SingleStoreCustomColumnBuilder,
customType: () => customType
});
module.exports = __toCommonJS(custom_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreCustomColumnBuilder extends import_common.SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreCustomColumnBuilder";
constructor(name, fieldConfig, customTypeParams) {
super(name, "custom", "SingleStoreCustomColumn");
this.config.fieldConfig = fieldConfig;
this.config.customTypeParams = customTypeParams;
}
/** @internal */
build(table) {
return new SingleStoreCustomColumn(
table,
this.config
);
}
}
class SingleStoreCustomColumn extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreCustomColumn";
sqlName;
mapTo;
mapFrom;
constructor(table, config) {
super(table, config);
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
this.mapTo = config.customTypeParams.toDriver;
this.mapFrom = config.customTypeParams.fromDriver;
}
getSQLType() {
return this.sqlName;
}
mapFromDriverValue(value) {
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
}
mapToDriverValue(value) {
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
}
}
function customType(customTypeParams) {
return (a, b) => {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
return new SingleStoreCustomColumnBuilder(name, config, customTypeParams);
};
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreCustomColumn,
SingleStoreCustomColumnBuilder,
customType
});
//# sourceMappingURL=custom.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,156 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { AnySingleStoreTable } from "../table.cjs";
import type { SQL } from "../../sql/sql.cjs";
import { type Equal } from "../../utils.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export type ConvertCustomConfig<TName extends string, T extends Partial<CustomTypeValues>> = {
name: TName;
dataType: 'custom';
columnType: 'SingleStoreCustomColumn';
data: T['data'];
driverParam: T['driverData'];
enumValues: undefined;
generated: undefined;
} & (T['notNull'] extends true ? {
notNull: true;
} : {}) & (T['default'] extends true ? {
hasDefault: true;
} : {});
export interface SingleStoreCustomColumnInnerConfig {
customTypeValues: CustomTypeValues;
}
export declare class SingleStoreCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'SingleStoreCustomColumn'>> extends SingleStoreColumnBuilder<T, {
fieldConfig: CustomTypeValues['config'];
customTypeParams: CustomTypeParams<any>;
}, {
singlestoreColumnBuilderBrand: 'SingleStoreCustomColumnBuilderBrand';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], fieldConfig: CustomTypeValues['config'], customTypeParams: CustomTypeParams<any>);
}
export declare class SingleStoreCustomColumn<T extends ColumnBaseConfig<'custom', 'SingleStoreCustomColumn'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
private sqlName;
private mapTo?;
private mapFrom?;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreCustomColumnBuilder<T>['config']);
getSQLType(): string;
mapFromDriverValue(value: T['driverParam']): T['data'];
mapToDriverValue(value: T['data']): T['driverParam'];
}
export type CustomTypeValues = {
/**
* Required type for custom column, that will infer proper type model
*
* Examples:
*
* If you want your column to be `string` type after selecting/or on inserting - use `data: string`. Like `text`, `varchar`
*
* If you want your column to be `number` type after selecting/or on inserting - use `data: number`. Like `integer`
*/
data: unknown;
/**
* Type helper, that represents what type database driver is accepting for specific database data type
*/
driverData?: unknown;
/**
* What config type should be used for {@link CustomTypeParams} `dataType` generation
*/
config?: Record<string, any>;
/**
* Whether the config argument should be required or not
* @default false
*/
configRequired?: boolean;
/**
* If your custom data type should be notNull by default you can use `notNull: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
notNull?: boolean;
/**
* If your custom data type has default you can use `default: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
default?: boolean;
};
export interface CustomTypeParams<T extends CustomTypeValues> {
/**
* Database data type string representation, that is used for migrations
* @example
* ```
* `jsonb`, `text`
* ```
*
* If database data type needs additional params you can use them from `config` param
* @example
* ```
* `varchar(256)`, `numeric(2,3)`
* ```
*
* To make `config` be of specific type please use config generic in {@link CustomTypeValues}
*
* @example
* Usage example
* ```
* dataType() {
* return 'boolean';
* },
* ```
* Or
* ```
* dataType(config) {
* return typeof config.length !== 'undefined' ? `varchar(${config.length})` : `varchar`;
* }
* ```
*/
dataType: (config: T['config'] | (Equal<T['configRequired'], true> extends true ? never : undefined)) => string;
/**
* Optional mapping function, between user input and driver
* @example
* For example, when using jsonb we need to map JS/TS object to string before writing to database
* ```
* toDriver(value: TData): string {
* return JSON.stringify(value);
* }
* ```
*/
toDriver?: (value: T['data']) => T['driverData'] | SQL;
/**
* Optional mapping function, that is responsible for data mapping from database to JS/TS code
* @example
* For example, when using timestamp we need to map string Date representation to JS Date
* ```
* fromDriver(value: string): Date {
* return new Date(value);
* },
* ```
*/
fromDriver?: (value: T['driverData']) => T['data'];
}
/**
* Custom singlestore database data type generator
*/
export declare function customType<T extends CustomTypeValues = CustomTypeValues>(customTypeParams: CustomTypeParams<T>): Equal<T['configRequired'], true> extends true ? {
<TConfig extends Record<string, any> & T['config']>(fieldConfig: TConfig): SingleStoreCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig: T['config']): SingleStoreCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
} : {
(): SingleStoreCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TConfig extends Record<string, any> & T['config']>(fieldConfig?: TConfig): SingleStoreCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig?: T['config']): SingleStoreCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
};

View File

@ -0,0 +1,156 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { AnySingleStoreTable } from "../table.js";
import type { SQL } from "../../sql/sql.js";
import { type Equal } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export type ConvertCustomConfig<TName extends string, T extends Partial<CustomTypeValues>> = {
name: TName;
dataType: 'custom';
columnType: 'SingleStoreCustomColumn';
data: T['data'];
driverParam: T['driverData'];
enumValues: undefined;
generated: undefined;
} & (T['notNull'] extends true ? {
notNull: true;
} : {}) & (T['default'] extends true ? {
hasDefault: true;
} : {});
export interface SingleStoreCustomColumnInnerConfig {
customTypeValues: CustomTypeValues;
}
export declare class SingleStoreCustomColumnBuilder<T extends ColumnBuilderBaseConfig<'custom', 'SingleStoreCustomColumn'>> extends SingleStoreColumnBuilder<T, {
fieldConfig: CustomTypeValues['config'];
customTypeParams: CustomTypeParams<any>;
}, {
singlestoreColumnBuilderBrand: 'SingleStoreCustomColumnBuilderBrand';
}> {
static readonly [entityKind]: string;
constructor(name: T['name'], fieldConfig: CustomTypeValues['config'], customTypeParams: CustomTypeParams<any>);
}
export declare class SingleStoreCustomColumn<T extends ColumnBaseConfig<'custom', 'SingleStoreCustomColumn'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
private sqlName;
private mapTo?;
private mapFrom?;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreCustomColumnBuilder<T>['config']);
getSQLType(): string;
mapFromDriverValue(value: T['driverParam']): T['data'];
mapToDriverValue(value: T['data']): T['driverParam'];
}
export type CustomTypeValues = {
/**
* Required type for custom column, that will infer proper type model
*
* Examples:
*
* If you want your column to be `string` type after selecting/or on inserting - use `data: string`. Like `text`, `varchar`
*
* If you want your column to be `number` type after selecting/or on inserting - use `data: number`. Like `integer`
*/
data: unknown;
/**
* Type helper, that represents what type database driver is accepting for specific database data type
*/
driverData?: unknown;
/**
* What config type should be used for {@link CustomTypeParams} `dataType` generation
*/
config?: Record<string, any>;
/**
* Whether the config argument should be required or not
* @default false
*/
configRequired?: boolean;
/**
* If your custom data type should be notNull by default you can use `notNull: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
notNull?: boolean;
/**
* If your custom data type has default you can use `default: true`
*
* @example
* const customSerial = customType<{ data: number, notNull: true, default: true }>({
* dataType() {
* return 'serial';
* },
* });
*/
default?: boolean;
};
export interface CustomTypeParams<T extends CustomTypeValues> {
/**
* Database data type string representation, that is used for migrations
* @example
* ```
* `jsonb`, `text`
* ```
*
* If database data type needs additional params you can use them from `config` param
* @example
* ```
* `varchar(256)`, `numeric(2,3)`
* ```
*
* To make `config` be of specific type please use config generic in {@link CustomTypeValues}
*
* @example
* Usage example
* ```
* dataType() {
* return 'boolean';
* },
* ```
* Or
* ```
* dataType(config) {
* return typeof config.length !== 'undefined' ? `varchar(${config.length})` : `varchar`;
* }
* ```
*/
dataType: (config: T['config'] | (Equal<T['configRequired'], true> extends true ? never : undefined)) => string;
/**
* Optional mapping function, between user input and driver
* @example
* For example, when using jsonb we need to map JS/TS object to string before writing to database
* ```
* toDriver(value: TData): string {
* return JSON.stringify(value);
* }
* ```
*/
toDriver?: (value: T['data']) => T['driverData'] | SQL;
/**
* Optional mapping function, that is responsible for data mapping from database to JS/TS code
* @example
* For example, when using timestamp we need to map string Date representation to JS Date
* ```
* fromDriver(value: string): Date {
* return new Date(value);
* },
* ```
*/
fromDriver?: (value: T['driverData']) => T['data'];
}
/**
* Custom singlestore database data type generator
*/
export declare function customType<T extends CustomTypeValues = CustomTypeValues>(customTypeParams: CustomTypeParams<T>): Equal<T['configRequired'], true> extends true ? {
<TConfig extends Record<string, any> & T['config']>(fieldConfig: TConfig): SingleStoreCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig: T['config']): SingleStoreCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
} : {
(): SingleStoreCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TConfig extends Record<string, any> & T['config']>(fieldConfig?: TConfig): SingleStoreCustomColumnBuilder<ConvertCustomConfig<'', T>>;
<TName extends string>(dbName: TName, fieldConfig?: T['config']): SingleStoreCustomColumnBuilder<ConvertCustomConfig<TName, T>>;
};

View File

@ -0,0 +1,51 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreCustomColumnBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreCustomColumnBuilder";
constructor(name, fieldConfig, customTypeParams) {
super(name, "custom", "SingleStoreCustomColumn");
this.config.fieldConfig = fieldConfig;
this.config.customTypeParams = customTypeParams;
}
/** @internal */
build(table) {
return new SingleStoreCustomColumn(
table,
this.config
);
}
}
class SingleStoreCustomColumn extends SingleStoreColumn {
static [entityKind] = "SingleStoreCustomColumn";
sqlName;
mapTo;
mapFrom;
constructor(table, config) {
super(table, config);
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
this.mapTo = config.customTypeParams.toDriver;
this.mapFrom = config.customTypeParams.fromDriver;
}
getSQLType() {
return this.sqlName;
}
mapFromDriverValue(value) {
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
}
mapToDriverValue(value) {
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
}
}
function customType(customTypeParams) {
return (a, b) => {
const { name, config } = getColumnNameAndConfig(a, b);
return new SingleStoreCustomColumnBuilder(name, config, customTypeParams);
};
}
export {
SingleStoreCustomColumn,
SingleStoreCustomColumnBuilder,
customType
};
//# sourceMappingURL=custom.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,93 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var date_exports = {};
__export(date_exports, {
SingleStoreDate: () => SingleStoreDate,
SingleStoreDateBuilder: () => SingleStoreDateBuilder,
SingleStoreDateString: () => SingleStoreDateString,
SingleStoreDateStringBuilder: () => SingleStoreDateStringBuilder,
date: () => date
});
module.exports = __toCommonJS(date_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreDateBuilder extends import_common.SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreDateBuilder";
constructor(name) {
super(name, "date", "SingleStoreDate");
}
/** @internal */
build(table) {
return new SingleStoreDate(
table,
this.config
);
}
}
class SingleStoreDate extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreDate";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `date`;
}
mapFromDriverValue(value) {
return new Date(value);
}
}
class SingleStoreDateStringBuilder extends import_common.SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreDateStringBuilder";
constructor(name) {
super(name, "string", "SingleStoreDateString");
}
/** @internal */
build(table) {
return new SingleStoreDateString(
table,
this.config
);
}
}
class SingleStoreDateString extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreDateString";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `date`;
}
}
function date(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
if (config?.mode === "string") {
return new SingleStoreDateStringBuilder(name);
}
return new SingleStoreDateBuilder(name);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreDate,
SingleStoreDateBuilder,
SingleStoreDateString,
SingleStoreDateStringBuilder,
date
});
//# sourceMappingURL=date.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,48 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var date_common_exports = {};
__export(date_common_exports, {
SingleStoreDateBaseColumn: () => SingleStoreDateBaseColumn,
SingleStoreDateColumnBaseBuilder: () => SingleStoreDateColumnBaseBuilder
});
module.exports = __toCommonJS(date_common_exports);
var import_entity = require("../../entity.cjs");
var import_sql = require("../../sql/sql.cjs");
var import_common = require("./common.cjs");
class SingleStoreDateColumnBaseBuilder extends import_common.SingleStoreColumnBuilder {
static [import_entity.entityKind] = "SingleStoreDateColumnBuilder";
defaultNow() {
return this.default(import_sql.sql`now()`);
}
onUpdateNow() {
this.config.hasOnUpdateNow = true;
this.config.hasDefault = true;
return this;
}
}
class SingleStoreDateBaseColumn extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreDateColumn";
hasOnUpdateNow = this.config.hasOnUpdateNow;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreDateBaseColumn,
SingleStoreDateColumnBaseBuilder
});
//# sourceMappingURL=date.common.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/date.common.ts"],"sourcesContent":["import type {\n\tColumnBuilderBaseConfig,\n\tColumnBuilderExtraConfig,\n\tColumnDataType,\n\tHasDefault,\n} from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport { sql } from '~/sql/sql.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport interface SingleStoreDateColumnBaseConfig {\n\thasOnUpdateNow: boolean;\n}\n\nexport abstract class SingleStoreDateColumnBaseBuilder<\n\tT extends ColumnBuilderBaseConfig<ColumnDataType, string>,\n\tTRuntimeConfig extends object = object,\n\tTExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig,\n> extends SingleStoreColumnBuilder<T, TRuntimeConfig & SingleStoreDateColumnBaseConfig, TExtraConfig> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDateColumnBuilder';\n\n\tdefaultNow() {\n\t\treturn this.default(sql`now()`);\n\t}\n\n\tonUpdateNow(): HasDefault<this> {\n\t\tthis.config.hasOnUpdateNow = true;\n\t\tthis.config.hasDefault = true;\n\t\treturn this as HasDefault<this>;\n\t}\n}\n\nexport abstract class SingleStoreDateBaseColumn<\n\tT extends ColumnBaseConfig<ColumnDataType, string>,\n\tTRuntimeConfig extends object = object,\n> extends SingleStoreColumn<T, SingleStoreDateColumnBaseConfig & TRuntimeConfig> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDateColumn';\n\n\treadonly hasOnUpdateNow: boolean = this.config.hasOnUpdateNow;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,oBAA2B;AAC3B,iBAAoB;AACpB,oBAA4D;AAMrD,MAAe,yCAIZ,uCAA4F;AAAA,EACrG,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAa;AACZ,WAAO,KAAK,QAAQ,qBAAU;AAAA,EAC/B;AAAA,EAEA,cAAgC;AAC/B,SAAK,OAAO,iBAAiB;AAC7B,SAAK,OAAO,aAAa;AACzB,WAAO;AAAA,EACR;AACD;AAEO,MAAe,kCAGZ,gCAAuE;AAAA,EAChF,QAA0B,wBAAU,IAAY;AAAA,EAEvC,iBAA0B,KAAK,OAAO;AAChD;","names":[]}

View File

@ -0,0 +1,16 @@
import type { ColumnBuilderBaseConfig, ColumnBuilderExtraConfig, ColumnDataType, HasDefault } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export interface SingleStoreDateColumnBaseConfig {
hasOnUpdateNow: boolean;
}
export declare abstract class SingleStoreDateColumnBaseBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig> extends SingleStoreColumnBuilder<T, TRuntimeConfig & SingleStoreDateColumnBaseConfig, TExtraConfig> {
static readonly [entityKind]: string;
defaultNow(): HasDefault<this>;
onUpdateNow(): HasDefault<this>;
}
export declare abstract class SingleStoreDateBaseColumn<T extends ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SingleStoreColumn<T, SingleStoreDateColumnBaseConfig & TRuntimeConfig> {
static readonly [entityKind]: string;
readonly hasOnUpdateNow: boolean;
}

View File

@ -0,0 +1,16 @@
import type { ColumnBuilderBaseConfig, ColumnBuilderExtraConfig, ColumnDataType, HasDefault } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export interface SingleStoreDateColumnBaseConfig {
hasOnUpdateNow: boolean;
}
export declare abstract class SingleStoreDateColumnBaseBuilder<T extends ColumnBuilderBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object, TExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig> extends SingleStoreColumnBuilder<T, TRuntimeConfig & SingleStoreDateColumnBaseConfig, TExtraConfig> {
static readonly [entityKind]: string;
defaultNow(): HasDefault<this>;
onUpdateNow(): HasDefault<this>;
}
export declare abstract class SingleStoreDateBaseColumn<T extends ColumnBaseConfig<ColumnDataType, string>, TRuntimeConfig extends object = object> extends SingleStoreColumn<T, SingleStoreDateColumnBaseConfig & TRuntimeConfig> {
static readonly [entityKind]: string;
readonly hasOnUpdateNow: boolean;
}

View File

@ -0,0 +1,23 @@
import { entityKind } from "../../entity.js";
import { sql } from "../../sql/sql.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreDateColumnBaseBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreDateColumnBuilder";
defaultNow() {
return this.default(sql`now()`);
}
onUpdateNow() {
this.config.hasOnUpdateNow = true;
this.config.hasDefault = true;
return this;
}
}
class SingleStoreDateBaseColumn extends SingleStoreColumn {
static [entityKind] = "SingleStoreDateColumn";
hasOnUpdateNow = this.config.hasOnUpdateNow;
}
export {
SingleStoreDateBaseColumn,
SingleStoreDateColumnBaseBuilder
};
//# sourceMappingURL=date.common.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/date.common.ts"],"sourcesContent":["import type {\n\tColumnBuilderBaseConfig,\n\tColumnBuilderExtraConfig,\n\tColumnDataType,\n\tHasDefault,\n} from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport { sql } from '~/sql/sql.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport interface SingleStoreDateColumnBaseConfig {\n\thasOnUpdateNow: boolean;\n}\n\nexport abstract class SingleStoreDateColumnBaseBuilder<\n\tT extends ColumnBuilderBaseConfig<ColumnDataType, string>,\n\tTRuntimeConfig extends object = object,\n\tTExtraConfig extends ColumnBuilderExtraConfig = ColumnBuilderExtraConfig,\n> extends SingleStoreColumnBuilder<T, TRuntimeConfig & SingleStoreDateColumnBaseConfig, TExtraConfig> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDateColumnBuilder';\n\n\tdefaultNow() {\n\t\treturn this.default(sql`now()`);\n\t}\n\n\tonUpdateNow(): HasDefault<this> {\n\t\tthis.config.hasOnUpdateNow = true;\n\t\tthis.config.hasDefault = true;\n\t\treturn this as HasDefault<this>;\n\t}\n}\n\nexport abstract class SingleStoreDateBaseColumn<\n\tT extends ColumnBaseConfig<ColumnDataType, string>,\n\tTRuntimeConfig extends object = object,\n> extends SingleStoreColumn<T, SingleStoreDateColumnBaseConfig & TRuntimeConfig> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDateColumn';\n\n\treadonly hasOnUpdateNow: boolean = this.config.hasOnUpdateNow;\n}\n"],"mappings":"AAOA,SAAS,kBAAkB;AAC3B,SAAS,WAAW;AACpB,SAAS,mBAAmB,gCAAgC;AAMrD,MAAe,yCAIZ,yBAA4F;AAAA,EACrG,QAA0B,UAAU,IAAY;AAAA,EAEhD,aAAa;AACZ,WAAO,KAAK,QAAQ,UAAU;AAAA,EAC/B;AAAA,EAEA,cAAgC;AAC/B,SAAK,OAAO,iBAAiB;AAC7B,SAAK,OAAO,aAAa;AACzB,WAAO;AAAA,EACR;AACD;AAEO,MAAe,kCAGZ,kBAAuE;AAAA,EAChF,QAA0B,UAAU,IAAY;AAAA,EAEvC,iBAA0B,KAAK,OAAO;AAChD;","names":[]}

View File

@ -0,0 +1,53 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { AnySingleStoreTable } from "../table.cjs";
import { type Equal } from "../../utils.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export type SingleStoreDateBuilderInitial<TName extends string> = SingleStoreDateBuilder<{
name: TName;
dataType: 'date';
columnType: 'SingleStoreDate';
data: Date;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateBuilder<T extends ColumnBuilderBaseConfig<'date', 'SingleStoreDate'>> extends SingleStoreColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDate<T extends ColumnBaseConfig<'date', 'SingleStoreDate'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateBuilder<T>['config']);
getSQLType(): string;
mapFromDriverValue(value: string): Date;
}
export type SingleStoreDateStringBuilderInitial<TName extends string> = SingleStoreDateStringBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreDateString';
data: string;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateStringBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreDateString'>> extends SingleStoreColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDateString<T extends ColumnBaseConfig<'string', 'SingleStoreDateString'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateStringBuilder<T>['config']);
getSQLType(): string;
}
export interface SingleStoreDateConfig<TMode extends 'date' | 'string' = 'date' | 'string'> {
mode?: TMode;
}
export declare function date(): SingleStoreDateBuilderInitial<''>;
export declare function date<TMode extends SingleStoreDateConfig['mode'] & {}>(config?: SingleStoreDateConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateStringBuilderInitial<''> : SingleStoreDateBuilderInitial<''>;
export declare function date<TName extends string, TMode extends SingleStoreDateConfig['mode'] & {}>(name: TName, config?: SingleStoreDateConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateStringBuilderInitial<TName> : SingleStoreDateBuilderInitial<TName>;

View File

@ -0,0 +1,53 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { AnySingleStoreTable } from "../table.js";
import { type Equal } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export type SingleStoreDateBuilderInitial<TName extends string> = SingleStoreDateBuilder<{
name: TName;
dataType: 'date';
columnType: 'SingleStoreDate';
data: Date;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateBuilder<T extends ColumnBuilderBaseConfig<'date', 'SingleStoreDate'>> extends SingleStoreColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDate<T extends ColumnBaseConfig<'date', 'SingleStoreDate'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateBuilder<T>['config']);
getSQLType(): string;
mapFromDriverValue(value: string): Date;
}
export type SingleStoreDateStringBuilderInitial<TName extends string> = SingleStoreDateStringBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreDateString';
data: string;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateStringBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreDateString'>> extends SingleStoreColumnBuilder<T> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDateString<T extends ColumnBaseConfig<'string', 'SingleStoreDateString'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateStringBuilder<T>['config']);
getSQLType(): string;
}
export interface SingleStoreDateConfig<TMode extends 'date' | 'string' = 'date' | 'string'> {
mode?: TMode;
}
export declare function date(): SingleStoreDateBuilderInitial<''>;
export declare function date<TMode extends SingleStoreDateConfig['mode'] & {}>(config?: SingleStoreDateConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateStringBuilderInitial<''> : SingleStoreDateBuilderInitial<''>;
export declare function date<TName extends string, TMode extends SingleStoreDateConfig['mode'] & {}>(name: TName, config?: SingleStoreDateConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateStringBuilderInitial<TName> : SingleStoreDateBuilderInitial<TName>;

View File

@ -0,0 +1,65 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreDateBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreDateBuilder";
constructor(name) {
super(name, "date", "SingleStoreDate");
}
/** @internal */
build(table) {
return new SingleStoreDate(
table,
this.config
);
}
}
class SingleStoreDate extends SingleStoreColumn {
static [entityKind] = "SingleStoreDate";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `date`;
}
mapFromDriverValue(value) {
return new Date(value);
}
}
class SingleStoreDateStringBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreDateStringBuilder";
constructor(name) {
super(name, "string", "SingleStoreDateString");
}
/** @internal */
build(table) {
return new SingleStoreDateString(
table,
this.config
);
}
}
class SingleStoreDateString extends SingleStoreColumn {
static [entityKind] = "SingleStoreDateString";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `date`;
}
}
function date(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
if (config?.mode === "string") {
return new SingleStoreDateStringBuilder(name);
}
return new SingleStoreDateBuilder(name);
}
export {
SingleStoreDate,
SingleStoreDateBuilder,
SingleStoreDateString,
SingleStoreDateStringBuilder,
date
};
//# sourceMappingURL=date.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,106 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var datetime_exports = {};
__export(datetime_exports, {
SingleStoreDateTime: () => SingleStoreDateTime,
SingleStoreDateTimeBuilder: () => SingleStoreDateTimeBuilder,
SingleStoreDateTimeString: () => SingleStoreDateTimeString,
SingleStoreDateTimeStringBuilder: () => SingleStoreDateTimeStringBuilder,
datetime: () => datetime
});
module.exports = __toCommonJS(datetime_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreDateTimeBuilder extends import_common.SingleStoreColumnBuilder {
/** @internal */
// TODO: we need to add a proper support for SingleStore
generatedAlwaysAs(_as, _config) {
throw new Error("Method not implemented.");
}
static [import_entity.entityKind] = "SingleStoreDateTimeBuilder";
constructor(name) {
super(name, "date", "SingleStoreDateTime");
}
/** @internal */
build(table) {
return new SingleStoreDateTime(
table,
this.config
);
}
}
class SingleStoreDateTime extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreDateTime";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `datetime`;
}
mapToDriverValue(value) {
return value.toISOString().replace("T", " ").replace("Z", "");
}
mapFromDriverValue(value) {
return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
}
}
class SingleStoreDateTimeStringBuilder extends import_common.SingleStoreColumnBuilder {
/** @internal */
// TODO: we need to add a proper support for SingleStore
generatedAlwaysAs(_as, _config) {
throw new Error("Method not implemented.");
}
static [import_entity.entityKind] = "SingleStoreDateTimeStringBuilder";
constructor(name) {
super(name, "string", "SingleStoreDateTimeString");
}
/** @internal */
build(table) {
return new SingleStoreDateTimeString(
table,
this.config
);
}
}
class SingleStoreDateTimeString extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreDateTimeString";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `datetime`;
}
}
function datetime(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
if (config?.mode === "string") {
return new SingleStoreDateTimeStringBuilder(name);
}
return new SingleStoreDateTimeBuilder(name);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreDateTime,
SingleStoreDateTimeBuilder,
SingleStoreDateTimeString,
SingleStoreDateTimeStringBuilder,
datetime
});
//# sourceMappingURL=datetime.cjs.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,54 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { AnySingleStoreTable } from "../table.cjs";
import { type Equal } from "../../utils.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export type SingleStoreDateTimeBuilderInitial<TName extends string> = SingleStoreDateTimeBuilder<{
name: TName;
dataType: 'date';
columnType: 'SingleStoreDateTime';
data: Date;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateTimeBuilder<T extends ColumnBuilderBaseConfig<'date', 'SingleStoreDateTime'>> extends SingleStoreColumnBuilder<T, SingleStoreDatetimeConfig> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDateTime<T extends ColumnBaseConfig<'date', 'SingleStoreDateTime'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateTimeBuilder<T>['config']);
getSQLType(): string;
mapToDriverValue(value: Date): unknown;
mapFromDriverValue(value: string): Date;
}
export type SingleStoreDateTimeStringBuilderInitial<TName extends string> = SingleStoreDateTimeStringBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreDateTimeString';
data: string;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateTimeStringBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreDateTimeString'>> extends SingleStoreColumnBuilder<T, SingleStoreDatetimeConfig> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDateTimeString<T extends ColumnBaseConfig<'string', 'SingleStoreDateTimeString'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateTimeStringBuilder<T>['config']);
getSQLType(): string;
}
export interface SingleStoreDatetimeConfig<TMode extends 'date' | 'string' = 'date' | 'string'> {
mode?: TMode;
}
export declare function datetime(): SingleStoreDateTimeBuilderInitial<''>;
export declare function datetime<TMode extends SingleStoreDatetimeConfig['mode'] & {}>(config?: SingleStoreDatetimeConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateTimeStringBuilderInitial<''> : SingleStoreDateTimeBuilderInitial<''>;
export declare function datetime<TName extends string, TMode extends SingleStoreDatetimeConfig['mode'] & {}>(name: TName, config?: SingleStoreDatetimeConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateTimeStringBuilderInitial<TName> : SingleStoreDateTimeBuilderInitial<TName>;

View File

@ -0,0 +1,54 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { AnySingleStoreTable } from "../table.js";
import { type Equal } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export type SingleStoreDateTimeBuilderInitial<TName extends string> = SingleStoreDateTimeBuilder<{
name: TName;
dataType: 'date';
columnType: 'SingleStoreDateTime';
data: Date;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateTimeBuilder<T extends ColumnBuilderBaseConfig<'date', 'SingleStoreDateTime'>> extends SingleStoreColumnBuilder<T, SingleStoreDatetimeConfig> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDateTime<T extends ColumnBaseConfig<'date', 'SingleStoreDateTime'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateTimeBuilder<T>['config']);
getSQLType(): string;
mapToDriverValue(value: Date): unknown;
mapFromDriverValue(value: string): Date;
}
export type SingleStoreDateTimeStringBuilderInitial<TName extends string> = SingleStoreDateTimeStringBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreDateTimeString';
data: string;
driverParam: string | number;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDateTimeStringBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreDateTimeString'>> extends SingleStoreColumnBuilder<T, SingleStoreDatetimeConfig> {
static readonly [entityKind]: string;
constructor(name: T['name']);
}
export declare class SingleStoreDateTimeString<T extends ColumnBaseConfig<'string', 'SingleStoreDateTimeString'>> extends SingleStoreColumn<T> {
static readonly [entityKind]: string;
constructor(table: AnySingleStoreTable<{
name: T['tableName'];
}>, config: SingleStoreDateTimeStringBuilder<T>['config']);
getSQLType(): string;
}
export interface SingleStoreDatetimeConfig<TMode extends 'date' | 'string' = 'date' | 'string'> {
mode?: TMode;
}
export declare function datetime(): SingleStoreDateTimeBuilderInitial<''>;
export declare function datetime<TMode extends SingleStoreDatetimeConfig['mode'] & {}>(config?: SingleStoreDatetimeConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateTimeStringBuilderInitial<''> : SingleStoreDateTimeBuilderInitial<''>;
export declare function datetime<TName extends string, TMode extends SingleStoreDatetimeConfig['mode'] & {}>(name: TName, config?: SingleStoreDatetimeConfig<TMode>): Equal<TMode, 'string'> extends true ? SingleStoreDateTimeStringBuilderInitial<TName> : SingleStoreDateTimeBuilderInitial<TName>;

View File

@ -0,0 +1,78 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreDateTimeBuilder extends SingleStoreColumnBuilder {
/** @internal */
// TODO: we need to add a proper support for SingleStore
generatedAlwaysAs(_as, _config) {
throw new Error("Method not implemented.");
}
static [entityKind] = "SingleStoreDateTimeBuilder";
constructor(name) {
super(name, "date", "SingleStoreDateTime");
}
/** @internal */
build(table) {
return new SingleStoreDateTime(
table,
this.config
);
}
}
class SingleStoreDateTime extends SingleStoreColumn {
static [entityKind] = "SingleStoreDateTime";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `datetime`;
}
mapToDriverValue(value) {
return value.toISOString().replace("T", " ").replace("Z", "");
}
mapFromDriverValue(value) {
return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
}
}
class SingleStoreDateTimeStringBuilder extends SingleStoreColumnBuilder {
/** @internal */
// TODO: we need to add a proper support for SingleStore
generatedAlwaysAs(_as, _config) {
throw new Error("Method not implemented.");
}
static [entityKind] = "SingleStoreDateTimeStringBuilder";
constructor(name) {
super(name, "string", "SingleStoreDateTimeString");
}
/** @internal */
build(table) {
return new SingleStoreDateTimeString(
table,
this.config
);
}
}
class SingleStoreDateTimeString extends SingleStoreColumn {
static [entityKind] = "SingleStoreDateTimeString";
constructor(table, config) {
super(table, config);
}
getSQLType() {
return `datetime`;
}
}
function datetime(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
if (config?.mode === "string") {
return new SingleStoreDateTimeStringBuilder(name);
}
return new SingleStoreDateTimeBuilder(name);
}
export {
SingleStoreDateTime,
SingleStoreDateTimeBuilder,
SingleStoreDateTimeString,
SingleStoreDateTimeStringBuilder,
datetime
};
//# sourceMappingURL=datetime.js.map

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,76 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var decimal_exports = {};
__export(decimal_exports, {
SingleStoreDecimal: () => SingleStoreDecimal,
SingleStoreDecimalBuilder: () => SingleStoreDecimalBuilder,
decimal: () => decimal
});
module.exports = __toCommonJS(decimal_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreDecimalBuilder extends import_common.SingleStoreColumnBuilderWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreDecimalBuilder";
constructor(name, config) {
super(name, "string", "SingleStoreDecimal");
this.config.precision = config?.precision;
this.config.scale = config?.scale;
this.config.unsigned = config?.unsigned;
}
/** @internal */
build(table) {
return new SingleStoreDecimal(
table,
this.config
);
}
}
class SingleStoreDecimal extends import_common.SingleStoreColumnWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreDecimal";
precision = this.config.precision;
scale = this.config.scale;
unsigned = this.config.unsigned;
getSQLType() {
let type = "";
if (this.precision !== void 0 && this.scale !== void 0) {
type += `decimal(${this.precision},${this.scale})`;
} else if (this.precision === void 0) {
type += "decimal";
} else {
type += `decimal(${this.precision})`;
}
type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
return this.unsigned ? `${type} unsigned` : type;
}
}
function decimal(a, b = {}) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(
a,
b
);
return new SingleStoreDecimalBuilder(name, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreDecimal,
SingleStoreDecimalBuilder,
decimal
});
//# sourceMappingURL=decimal.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';\n\nexport type SingleStoreDecimalBuilderInitial<TName extends string> = SingleStoreDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SingleStoreDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreDecimalBuilder<\n\tT extends ColumnBuilderBaseConfig<'string', 'SingleStoreDecimal'>,\n> extends SingleStoreColumnBuilderWithAutoIncrement<\n\tT,\n\tSingleStoreDecimalConfig\n> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDecimalBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreDecimalConfig | undefined) {\n\t\tsuper(name, 'string', 'SingleStoreDecimal');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreDecimal<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreDecimal<\n\tT extends ColumnBaseConfig<'string', 'SingleStoreDecimal'>,\n> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDecimal';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface SingleStoreDecimalConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function decimal(): SingleStoreDecimalBuilderInitial<''>;\nexport function decimal(\n\tconfig: SingleStoreDecimalConfig,\n): SingleStoreDecimalBuilderInitial<''>;\nexport function decimal<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreDecimalConfig,\n): SingleStoreDecimalBuilderInitial<TName>;\nexport function decimal(\n\ta?: string | SingleStoreDecimalConfig,\n\tb: SingleStoreDecimalConfig = {},\n) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreDecimalConfig>(\n\t\ta,\n\t\tb,\n\t);\n\treturn new SingleStoreDecimalBuilder(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,mBAAuC;AACvC,oBAA8F;AAYvF,MAAM,kCAEH,wDAGR;AAAA,EACD,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA8C;AAC1E,UAAM,MAAM,UAAU,oBAAoB;AAC1C,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACsD;AACtD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,2BAEH,iDAAgE;AAAA,EACzE,QAA0B,wBAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAErD,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAChD,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,WAAW,KAAK,SAAS;AAAA,IAClC;AACA,WAAO,SAAS,mBAAmB,SAAS,gBAAgB,YAAY;AACxE,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,QACf,GACA,IAA8B,CAAC,GAC9B;AACD,QAAM,EAAE,MAAM,OAAO,QAAI;AAAA,IACxB;AAAA,IACA;AAAA,EACD;AACA,SAAO,IAAI,0BAA0B,MAAM,MAAM;AAClD;","names":[]}

View File

@ -0,0 +1,32 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.cjs";
export type SingleStoreDecimalBuilderInitial<TName extends string> = SingleStoreDecimalBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreDecimal';
data: string;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDecimalBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreDecimal'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreDecimalConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreDecimalConfig | undefined);
}
export declare class SingleStoreDecimal<T extends ColumnBaseConfig<'string', 'SingleStoreDecimal'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreDecimalConfig> {
static readonly [entityKind]: string;
readonly precision: number | undefined;
readonly scale: number | undefined;
readonly unsigned: boolean | undefined;
getSQLType(): string;
}
export interface SingleStoreDecimalConfig {
precision?: number;
scale?: number;
unsigned?: boolean;
}
export declare function decimal(): SingleStoreDecimalBuilderInitial<''>;
export declare function decimal(config: SingleStoreDecimalConfig): SingleStoreDecimalBuilderInitial<''>;
export declare function decimal<TName extends string>(name: TName, config?: SingleStoreDecimalConfig): SingleStoreDecimalBuilderInitial<TName>;

View File

@ -0,0 +1,32 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
export type SingleStoreDecimalBuilderInitial<TName extends string> = SingleStoreDecimalBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreDecimal';
data: string;
driverParam: string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDecimalBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreDecimal'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreDecimalConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreDecimalConfig | undefined);
}
export declare class SingleStoreDecimal<T extends ColumnBaseConfig<'string', 'SingleStoreDecimal'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreDecimalConfig> {
static readonly [entityKind]: string;
readonly precision: number | undefined;
readonly scale: number | undefined;
readonly unsigned: boolean | undefined;
getSQLType(): string;
}
export interface SingleStoreDecimalConfig {
precision?: number;
scale?: number;
unsigned?: boolean;
}
export declare function decimal(): SingleStoreDecimalBuilderInitial<''>;
export declare function decimal(config: SingleStoreDecimalConfig): SingleStoreDecimalBuilderInitial<''>;
export declare function decimal<TName extends string>(name: TName, config?: SingleStoreDecimalConfig): SingleStoreDecimalBuilderInitial<TName>;

View File

@ -0,0 +1,50 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
class SingleStoreDecimalBuilder extends SingleStoreColumnBuilderWithAutoIncrement {
static [entityKind] = "SingleStoreDecimalBuilder";
constructor(name, config) {
super(name, "string", "SingleStoreDecimal");
this.config.precision = config?.precision;
this.config.scale = config?.scale;
this.config.unsigned = config?.unsigned;
}
/** @internal */
build(table) {
return new SingleStoreDecimal(
table,
this.config
);
}
}
class SingleStoreDecimal extends SingleStoreColumnWithAutoIncrement {
static [entityKind] = "SingleStoreDecimal";
precision = this.config.precision;
scale = this.config.scale;
unsigned = this.config.unsigned;
getSQLType() {
let type = "";
if (this.precision !== void 0 && this.scale !== void 0) {
type += `decimal(${this.precision},${this.scale})`;
} else if (this.precision === void 0) {
type += "decimal";
} else {
type += `decimal(${this.precision})`;
}
type = type === "decimal(10,0)" || type === "decimal(10)" ? "decimal" : type;
return this.unsigned ? `${type} unsigned` : type;
}
}
function decimal(a, b = {}) {
const { name, config } = getColumnNameAndConfig(
a,
b
);
return new SingleStoreDecimalBuilder(name, config);
}
export {
SingleStoreDecimal,
SingleStoreDecimalBuilder,
decimal
};
//# sourceMappingURL=decimal.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/decimal.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';\n\nexport type SingleStoreDecimalBuilderInitial<TName extends string> = SingleStoreDecimalBuilder<{\n\tname: TName;\n\tdataType: 'string';\n\tcolumnType: 'SingleStoreDecimal';\n\tdata: string;\n\tdriverParam: string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreDecimalBuilder<\n\tT extends ColumnBuilderBaseConfig<'string', 'SingleStoreDecimal'>,\n> extends SingleStoreColumnBuilderWithAutoIncrement<\n\tT,\n\tSingleStoreDecimalConfig\n> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDecimalBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreDecimalConfig | undefined) {\n\t\tsuper(name, 'string', 'SingleStoreDecimal');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreDecimal<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreDecimal<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreDecimal<\n\tT extends ColumnBaseConfig<'string', 'SingleStoreDecimal'>,\n> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreDecimalConfig> {\n\tstatic override readonly [entityKind]: string = 'SingleStoreDecimal';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `decimal(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'decimal';\n\t\t} else {\n\t\t\ttype += `decimal(${this.precision})`;\n\t\t}\n\t\ttype = type === 'decimal(10,0)' || type === 'decimal(10)' ? 'decimal' : type;\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface SingleStoreDecimalConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function decimal(): SingleStoreDecimalBuilderInitial<''>;\nexport function decimal(\n\tconfig: SingleStoreDecimalConfig,\n): SingleStoreDecimalBuilderInitial<''>;\nexport function decimal<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreDecimalConfig,\n): SingleStoreDecimalBuilderInitial<TName>;\nexport function decimal(\n\ta?: string | SingleStoreDecimalConfig,\n\tb: SingleStoreDecimalConfig = {},\n) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreDecimalConfig>(\n\t\ta,\n\t\tb,\n\t);\n\treturn new SingleStoreDecimalBuilder(name, config);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,8BAA8B;AACvC,SAAS,2CAA2C,0CAA0C;AAYvF,MAAM,kCAEH,0CAGR;AAAA,EACD,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA8C;AAC1E,UAAM,MAAM,UAAU,oBAAoB;AAC1C,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACsD;AACtD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,2BAEH,mCAAgE;AAAA,EACzE,QAA0B,UAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAErD,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,WAAW,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAChD,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,WAAW,KAAK,SAAS;AAAA,IAClC;AACA,WAAO,SAAS,mBAAmB,SAAS,gBAAgB,YAAY;AACxE,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,QACf,GACA,IAA8B,CAAC,GAC9B;AACD,QAAM,EAAE,MAAM,OAAO,IAAI;AAAA,IACxB;AAAA,IACA;AAAA,EACD;AACA,SAAO,IAAI,0BAA0B,MAAM,MAAM;AAClD;","names":[]}

View File

@ -0,0 +1,72 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var double_exports = {};
__export(double_exports, {
SingleStoreDouble: () => SingleStoreDouble,
SingleStoreDoubleBuilder: () => SingleStoreDoubleBuilder,
double: () => double
});
module.exports = __toCommonJS(double_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreDoubleBuilder extends import_common.SingleStoreColumnBuilderWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreDoubleBuilder";
constructor(name, config) {
super(name, "number", "SingleStoreDouble");
this.config.precision = config?.precision;
this.config.scale = config?.scale;
this.config.unsigned = config?.unsigned;
}
/** @internal */
build(table) {
return new SingleStoreDouble(
table,
this.config
);
}
}
class SingleStoreDouble extends import_common.SingleStoreColumnWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreDouble";
precision = this.config.precision;
scale = this.config.scale;
unsigned = this.config.unsigned;
getSQLType() {
let type = "";
if (this.precision !== void 0 && this.scale !== void 0) {
type += `double(${this.precision},${this.scale})`;
} else if (this.precision === void 0) {
type += "double";
} else {
type += `double(${this.precision})`;
}
return this.unsigned ? `${type} unsigned` : type;
}
}
function double(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
return new SingleStoreDoubleBuilder(name, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreDouble,
SingleStoreDoubleBuilder,
double
});
//# sourceMappingURL=double.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/double.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';\n\nexport type SingleStoreDoubleBuilderInitial<TName extends string> = SingleStoreDoubleBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SingleStoreDouble';\n\tdata: number;\n\tdriverParam: number | string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreDoubleBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreDouble'>>\n\textends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreDoubleConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreDoubleBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreDoubleConfig | undefined) {\n\t\tsuper(name, 'number', 'SingleStoreDouble');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreDouble<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreDouble<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreDouble<T extends ColumnBaseConfig<'number', 'SingleStoreDouble'>>\n\textends SingleStoreColumnWithAutoIncrement<T, SingleStoreDoubleConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreDouble';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `double(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'double';\n\t\t} else {\n\t\t\ttype += `double(${this.precision})`;\n\t\t}\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface SingleStoreDoubleConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function double(): SingleStoreDoubleBuilderInitial<''>;\nexport function double(\n\tconfig?: SingleStoreDoubleConfig,\n): SingleStoreDoubleBuilderInitial<''>;\nexport function double<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreDoubleConfig,\n): SingleStoreDoubleBuilderInitial<TName>;\nexport function double(a?: string | SingleStoreDoubleConfig, b?: SingleStoreDoubleConfig) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreDoubleConfig>(a, b);\n\treturn new SingleStoreDoubleBuilder(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,mBAAuC;AACvC,oBAA8F;AAYvF,MAAM,iCACJ,wDACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA6C;AACzE,UAAM,MAAM,UAAU,mBAAmB;AACzC,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACqD;AACrD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,0BACJ,iDACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAErD,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,UAAU,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAC/C,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,UAAU,KAAK,SAAS;AAAA,IACjC;AACA,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,OAAO,GAAsC,GAA6B;AACzF,QAAM,EAAE,MAAM,OAAO,QAAI,qCAAgD,GAAG,CAAC;AAC7E,SAAO,IAAI,yBAAyB,MAAM,MAAM;AACjD;","names":[]}

View File

@ -0,0 +1,32 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.cjs";
export type SingleStoreDoubleBuilderInitial<TName extends string> = SingleStoreDoubleBuilder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreDouble';
data: number;
driverParam: number | string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDoubleBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreDouble'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreDoubleConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreDoubleConfig | undefined);
}
export declare class SingleStoreDouble<T extends ColumnBaseConfig<'number', 'SingleStoreDouble'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreDoubleConfig> {
static readonly [entityKind]: string;
readonly precision: number | undefined;
readonly scale: number | undefined;
readonly unsigned: boolean | undefined;
getSQLType(): string;
}
export interface SingleStoreDoubleConfig {
precision?: number;
scale?: number;
unsigned?: boolean;
}
export declare function double(): SingleStoreDoubleBuilderInitial<''>;
export declare function double(config?: SingleStoreDoubleConfig): SingleStoreDoubleBuilderInitial<''>;
export declare function double<TName extends string>(name: TName, config?: SingleStoreDoubleConfig): SingleStoreDoubleBuilderInitial<TName>;

View File

@ -0,0 +1,32 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
export type SingleStoreDoubleBuilderInitial<TName extends string> = SingleStoreDoubleBuilder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreDouble';
data: number;
driverParam: number | string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreDoubleBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreDouble'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreDoubleConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreDoubleConfig | undefined);
}
export declare class SingleStoreDouble<T extends ColumnBaseConfig<'number', 'SingleStoreDouble'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreDoubleConfig> {
static readonly [entityKind]: string;
readonly precision: number | undefined;
readonly scale: number | undefined;
readonly unsigned: boolean | undefined;
getSQLType(): string;
}
export interface SingleStoreDoubleConfig {
precision?: number;
scale?: number;
unsigned?: boolean;
}
export declare function double(): SingleStoreDoubleBuilderInitial<''>;
export declare function double(config?: SingleStoreDoubleConfig): SingleStoreDoubleBuilderInitial<''>;
export declare function double<TName extends string>(name: TName, config?: SingleStoreDoubleConfig): SingleStoreDoubleBuilderInitial<TName>;

View File

@ -0,0 +1,46 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
class SingleStoreDoubleBuilder extends SingleStoreColumnBuilderWithAutoIncrement {
static [entityKind] = "SingleStoreDoubleBuilder";
constructor(name, config) {
super(name, "number", "SingleStoreDouble");
this.config.precision = config?.precision;
this.config.scale = config?.scale;
this.config.unsigned = config?.unsigned;
}
/** @internal */
build(table) {
return new SingleStoreDouble(
table,
this.config
);
}
}
class SingleStoreDouble extends SingleStoreColumnWithAutoIncrement {
static [entityKind] = "SingleStoreDouble";
precision = this.config.precision;
scale = this.config.scale;
unsigned = this.config.unsigned;
getSQLType() {
let type = "";
if (this.precision !== void 0 && this.scale !== void 0) {
type += `double(${this.precision},${this.scale})`;
} else if (this.precision === void 0) {
type += "double";
} else {
type += `double(${this.precision})`;
}
return this.unsigned ? `${type} unsigned` : type;
}
}
function double(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
return new SingleStoreDoubleBuilder(name, config);
}
export {
SingleStoreDouble,
SingleStoreDoubleBuilder,
double
};
//# sourceMappingURL=double.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/double.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';\n\nexport type SingleStoreDoubleBuilderInitial<TName extends string> = SingleStoreDoubleBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SingleStoreDouble';\n\tdata: number;\n\tdriverParam: number | string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreDoubleBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreDouble'>>\n\textends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreDoubleConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreDoubleBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreDoubleConfig | undefined) {\n\t\tsuper(name, 'number', 'SingleStoreDouble');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreDouble<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreDouble<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreDouble<T extends ColumnBaseConfig<'number', 'SingleStoreDouble'>>\n\textends SingleStoreColumnWithAutoIncrement<T, SingleStoreDoubleConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreDouble';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `double(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'double';\n\t\t} else {\n\t\t\ttype += `double(${this.precision})`;\n\t\t}\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface SingleStoreDoubleConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function double(): SingleStoreDoubleBuilderInitial<''>;\nexport function double(\n\tconfig?: SingleStoreDoubleConfig,\n): SingleStoreDoubleBuilderInitial<''>;\nexport function double<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreDoubleConfig,\n): SingleStoreDoubleBuilderInitial<TName>;\nexport function double(a?: string | SingleStoreDoubleConfig, b?: SingleStoreDoubleConfig) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreDoubleConfig>(a, b);\n\treturn new SingleStoreDoubleBuilder(name, config);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,8BAA8B;AACvC,SAAS,2CAA2C,0CAA0C;AAYvF,MAAM,iCACJ,0CACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA6C;AACzE,UAAM,MAAM,UAAU,mBAAmB;AACzC,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACqD;AACrD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,0BACJ,mCACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAErD,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,UAAU,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAC/C,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,UAAU,KAAK,SAAS;AAAA,IACjC;AACA,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,OAAO,GAAsC,GAA6B;AACzF,QAAM,EAAE,MAAM,OAAO,IAAI,uBAAgD,GAAG,CAAC;AAC7E,SAAO,IAAI,yBAAyB,MAAM,MAAM;AACjD;","names":[]}

View File

@ -0,0 +1,67 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var enum_exports = {};
__export(enum_exports, {
SingleStoreEnumColumn: () => SingleStoreEnumColumn,
SingleStoreEnumColumnBuilder: () => SingleStoreEnumColumnBuilder,
singlestoreEnum: () => singlestoreEnum
});
module.exports = __toCommonJS(enum_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreEnumColumnBuilder extends import_common.SingleStoreColumnBuilder {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
generatedAlwaysAs(as, config) {
throw new Error("Method not implemented.");
}
static [import_entity.entityKind] = "SingleStoreEnumColumnBuilder";
constructor(name, values) {
super(name, "string", "SingleStoreEnumColumn");
this.config.enumValues = values;
}
/** @internal */
build(table) {
return new SingleStoreEnumColumn(
table,
this.config
);
}
}
class SingleStoreEnumColumn extends import_common.SingleStoreColumn {
static [import_entity.entityKind] = "SingleStoreEnumColumn";
enumValues = this.config.enumValues;
getSQLType() {
return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
}
}
function singlestoreEnum(a, b) {
const { name, config: values } = (0, import_utils.getColumnNameAndConfig)(a, b);
if (values.length === 0) {
throw new Error(`You have an empty array for "${name}" enum values`);
}
return new SingleStoreEnumColumnBuilder(name, values);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreEnumColumn,
SingleStoreEnumColumnBuilder,
singlestoreEnum
});
//# sourceMappingURL=enum.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/enum.ts"],"sourcesContent":["import type {\n\tColumnBuilderBaseConfig,\n\tColumnBuilderRuntimeConfig,\n\tGeneratedColumnConfig,\n\tHasGenerated,\n\tMakeColumnConfig,\n} from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport type { SQL } from '~/sql/index.ts';\nimport { getColumnNameAndConfig, type Writable } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreEnumColumnBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> =\n\tSingleStoreEnumColumnBuilder<{\n\t\tname: TName;\n\t\tdataType: 'string';\n\t\tcolumnType: 'SingleStoreEnumColumn';\n\t\tdata: TEnum[number];\n\t\tdriverParam: string;\n\t\tenumValues: TEnum;\n\t\tgenerated: undefined;\n\t}>;\n\nexport class SingleStoreEnumColumnBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreEnumColumn'>>\n\textends SingleStoreColumnBuilder<T, { enumValues: T['enumValues'] }>\n{\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\toverride generatedAlwaysAs(\n\t\tas: SQL<unknown> | (() => SQL) | T['data'],\n\t\tconfig?: Partial<GeneratedColumnConfig<unknown>>,\n\t): HasGenerated<this, {}> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tstatic override readonly [entityKind]: string = 'SingleStoreEnumColumnBuilder';\n\n\tconstructor(name: T['name'], values: T['enumValues']) {\n\t\tsuper(name, 'string', 'SingleStoreEnumColumn');\n\t\tthis.config.enumValues = values;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreEnumColumn<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }> {\n\t\treturn new SingleStoreEnumColumn<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreEnumColumn<T extends ColumnBaseConfig<'string', 'SingleStoreEnumColumn'>>\n\textends SingleStoreColumn<T, { enumValues: T['enumValues'] }>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreEnumColumn';\n\n\toverride readonly enumValues = this.config.enumValues;\n\n\tgetSQLType(): string {\n\t\treturn `enum(${this.enumValues!.map((value) => `'${value}'`).join(',')})`;\n\t}\n}\n\nexport function singlestoreEnum<U extends string, T extends Readonly<[U, ...U[]]>>(\n\tvalues: T | Writable<T>,\n): SingleStoreEnumColumnBuilderInitial<'', Writable<T>>;\nexport function singlestoreEnum<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(\n\tname: TName,\n\tvalues: T | Writable<T>,\n): SingleStoreEnumColumnBuilderInitial<TName, Writable<T>>;\nexport function singlestoreEnum(\n\ta?: string | readonly [string, ...string[]] | [string, ...string[]],\n\tb?: readonly [string, ...string[]] | [string, ...string[]],\n): any {\n\tconst { name, config: values } = getColumnNameAndConfig<readonly [string, ...string[]] | [string, ...string[]]>(a, b);\n\n\tif (values.length === 0) {\n\t\tthrow new Error(`You have an empty array for \"${name}\" enum values`);\n\t}\n\n\treturn new SingleStoreEnumColumnBuilder(name, values as any);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,oBAA2B;AAG3B,mBAAsD;AACtD,oBAA4D;AAarD,MAAM,qCACJ,uCACT;AAAA;AAAA,EAEU,kBACR,IACA,QACyB;AACzB,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AAAA,EACA,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAyB;AACrD,UAAM,MAAM,UAAU,uBAAuB;AAC7C,SAAK,OAAO,aAAa;AAAA,EAC1B;AAAA;AAAA,EAGS,MACR,OAC2F;AAC3F,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,8BACJ,gCACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAE9B,aAAa,KAAK,OAAO;AAAA,EAE3C,aAAqB;AACpB,WAAO,QAAQ,KAAK,WAAY,IAAI,CAAC,UAAU,IAAI,KAAK,GAAG,EAAE,KAAK,GAAG,CAAC;AAAA,EACvE;AACD;AASO,SAAS,gBACf,GACA,GACM;AACN,QAAM,EAAE,MAAM,QAAQ,OAAO,QAAI,qCAA+E,GAAG,CAAC;AAEpH,MAAI,OAAO,WAAW,GAAG;AACxB,UAAM,IAAI,MAAM,gCAAgC,IAAI,eAAe;AAAA,EACpE;AAEA,SAAO,IAAI,6BAA6B,MAAM,MAAa;AAC5D;","names":[]}

View File

@ -0,0 +1,31 @@
import type { ColumnBuilderBaseConfig, GeneratedColumnConfig, HasGenerated } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import type { SQL } from "../../sql/index.cjs";
import { type Writable } from "../../utils.cjs";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.cjs";
export type SingleStoreEnumColumnBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = SingleStoreEnumColumnBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreEnumColumn';
data: TEnum[number];
driverParam: string;
enumValues: TEnum;
generated: undefined;
}>;
export declare class SingleStoreEnumColumnBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreEnumColumn'>> extends SingleStoreColumnBuilder<T, {
enumValues: T['enumValues'];
}> {
generatedAlwaysAs(as: SQL<unknown> | (() => SQL) | T['data'], config?: Partial<GeneratedColumnConfig<unknown>>): HasGenerated<this, {}>;
static readonly [entityKind]: string;
constructor(name: T['name'], values: T['enumValues']);
}
export declare class SingleStoreEnumColumn<T extends ColumnBaseConfig<'string', 'SingleStoreEnumColumn'>> extends SingleStoreColumn<T, {
enumValues: T['enumValues'];
}> {
static readonly [entityKind]: string;
readonly enumValues: T["enumValues"];
getSQLType(): string;
}
export declare function singlestoreEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T | Writable<T>): SingleStoreEnumColumnBuilderInitial<'', Writable<T>>;
export declare function singlestoreEnum<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(name: TName, values: T | Writable<T>): SingleStoreEnumColumnBuilderInitial<TName, Writable<T>>;

View File

@ -0,0 +1,31 @@
import type { ColumnBuilderBaseConfig, GeneratedColumnConfig, HasGenerated } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import type { SQL } from "../../sql/index.js";
import { type Writable } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
export type SingleStoreEnumColumnBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> = SingleStoreEnumColumnBuilder<{
name: TName;
dataType: 'string';
columnType: 'SingleStoreEnumColumn';
data: TEnum[number];
driverParam: string;
enumValues: TEnum;
generated: undefined;
}>;
export declare class SingleStoreEnumColumnBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreEnumColumn'>> extends SingleStoreColumnBuilder<T, {
enumValues: T['enumValues'];
}> {
generatedAlwaysAs(as: SQL<unknown> | (() => SQL) | T['data'], config?: Partial<GeneratedColumnConfig<unknown>>): HasGenerated<this, {}>;
static readonly [entityKind]: string;
constructor(name: T['name'], values: T['enumValues']);
}
export declare class SingleStoreEnumColumn<T extends ColumnBaseConfig<'string', 'SingleStoreEnumColumn'>> extends SingleStoreColumn<T, {
enumValues: T['enumValues'];
}> {
static readonly [entityKind]: string;
readonly enumValues: T["enumValues"];
getSQLType(): string;
}
export declare function singlestoreEnum<U extends string, T extends Readonly<[U, ...U[]]>>(values: T | Writable<T>): SingleStoreEnumColumnBuilderInitial<'', Writable<T>>;
export declare function singlestoreEnum<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(name: TName, values: T | Writable<T>): SingleStoreEnumColumnBuilderInitial<TName, Writable<T>>;

View File

@ -0,0 +1,41 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreEnumColumnBuilder extends SingleStoreColumnBuilder {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
generatedAlwaysAs(as, config) {
throw new Error("Method not implemented.");
}
static [entityKind] = "SingleStoreEnumColumnBuilder";
constructor(name, values) {
super(name, "string", "SingleStoreEnumColumn");
this.config.enumValues = values;
}
/** @internal */
build(table) {
return new SingleStoreEnumColumn(
table,
this.config
);
}
}
class SingleStoreEnumColumn extends SingleStoreColumn {
static [entityKind] = "SingleStoreEnumColumn";
enumValues = this.config.enumValues;
getSQLType() {
return `enum(${this.enumValues.map((value) => `'${value}'`).join(",")})`;
}
}
function singlestoreEnum(a, b) {
const { name, config: values } = getColumnNameAndConfig(a, b);
if (values.length === 0) {
throw new Error(`You have an empty array for "${name}" enum values`);
}
return new SingleStoreEnumColumnBuilder(name, values);
}
export {
SingleStoreEnumColumn,
SingleStoreEnumColumnBuilder,
singlestoreEnum
};
//# sourceMappingURL=enum.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/enum.ts"],"sourcesContent":["import type {\n\tColumnBuilderBaseConfig,\n\tColumnBuilderRuntimeConfig,\n\tGeneratedColumnConfig,\n\tHasGenerated,\n\tMakeColumnConfig,\n} from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport type { SQL } from '~/sql/index.ts';\nimport { getColumnNameAndConfig, type Writable } from '~/utils.ts';\nimport { SingleStoreColumn, SingleStoreColumnBuilder } from './common.ts';\n\nexport type SingleStoreEnumColumnBuilderInitial<TName extends string, TEnum extends [string, ...string[]]> =\n\tSingleStoreEnumColumnBuilder<{\n\t\tname: TName;\n\t\tdataType: 'string';\n\t\tcolumnType: 'SingleStoreEnumColumn';\n\t\tdata: TEnum[number];\n\t\tdriverParam: string;\n\t\tenumValues: TEnum;\n\t\tgenerated: undefined;\n\t}>;\n\nexport class SingleStoreEnumColumnBuilder<T extends ColumnBuilderBaseConfig<'string', 'SingleStoreEnumColumn'>>\n\textends SingleStoreColumnBuilder<T, { enumValues: T['enumValues'] }>\n{\n\t// eslint-disable-next-line @typescript-eslint/no-unused-vars\n\toverride generatedAlwaysAs(\n\t\tas: SQL<unknown> | (() => SQL) | T['data'],\n\t\tconfig?: Partial<GeneratedColumnConfig<unknown>>,\n\t): HasGenerated<this, {}> {\n\t\tthrow new Error('Method not implemented.');\n\t}\n\tstatic override readonly [entityKind]: string = 'SingleStoreEnumColumnBuilder';\n\n\tconstructor(name: T['name'], values: T['enumValues']) {\n\t\tsuper(name, 'string', 'SingleStoreEnumColumn');\n\t\tthis.config.enumValues = values;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreEnumColumn<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }> {\n\t\treturn new SingleStoreEnumColumn<MakeColumnConfig<T, TTableName> & { enumValues: T['enumValues'] }>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreEnumColumn<T extends ColumnBaseConfig<'string', 'SingleStoreEnumColumn'>>\n\textends SingleStoreColumn<T, { enumValues: T['enumValues'] }>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreEnumColumn';\n\n\toverride readonly enumValues = this.config.enumValues;\n\n\tgetSQLType(): string {\n\t\treturn `enum(${this.enumValues!.map((value) => `'${value}'`).join(',')})`;\n\t}\n}\n\nexport function singlestoreEnum<U extends string, T extends Readonly<[U, ...U[]]>>(\n\tvalues: T | Writable<T>,\n): SingleStoreEnumColumnBuilderInitial<'', Writable<T>>;\nexport function singlestoreEnum<TName extends string, U extends string, T extends Readonly<[U, ...U[]]>>(\n\tname: TName,\n\tvalues: T | Writable<T>,\n): SingleStoreEnumColumnBuilderInitial<TName, Writable<T>>;\nexport function singlestoreEnum(\n\ta?: string | readonly [string, ...string[]] | [string, ...string[]],\n\tb?: readonly [string, ...string[]] | [string, ...string[]],\n): any {\n\tconst { name, config: values } = getColumnNameAndConfig<readonly [string, ...string[]] | [string, ...string[]]>(a, b);\n\n\tif (values.length === 0) {\n\t\tthrow new Error(`You have an empty array for \"${name}\" enum values`);\n\t}\n\n\treturn new SingleStoreEnumColumnBuilder(name, values as any);\n}\n"],"mappings":"AAQA,SAAS,kBAAkB;AAG3B,SAAS,8BAA6C;AACtD,SAAS,mBAAmB,gCAAgC;AAarD,MAAM,qCACJ,yBACT;AAAA;AAAA,EAEU,kBACR,IACA,QACyB;AACzB,UAAM,IAAI,MAAM,yBAAyB;AAAA,EAC1C;AAAA,EACA,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAAyB;AACrD,UAAM,MAAM,UAAU,uBAAuB;AAC7C,SAAK,OAAO,aAAa;AAAA,EAC1B;AAAA;AAAA,EAGS,MACR,OAC2F;AAC3F,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,8BACJ,kBACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAE9B,aAAa,KAAK,OAAO;AAAA,EAE3C,aAAqB;AACpB,WAAO,QAAQ,KAAK,WAAY,IAAI,CAAC,UAAU,IAAI,KAAK,GAAG,EAAE,KAAK,GAAG,CAAC;AAAA,EACvE;AACD;AASO,SAAS,gBACf,GACA,GACM;AACN,QAAM,EAAE,MAAM,QAAQ,OAAO,IAAI,uBAA+E,GAAG,CAAC;AAEpH,MAAI,OAAO,WAAW,GAAG;AACxB,UAAM,IAAI,MAAM,gCAAgC,IAAI,eAAe;AAAA,EACpE;AAEA,SAAO,IAAI,6BAA6B,MAAM,MAAa;AAC5D;","names":[]}

View File

@ -0,0 +1,72 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var float_exports = {};
__export(float_exports, {
SingleStoreFloat: () => SingleStoreFloat,
SingleStoreFloatBuilder: () => SingleStoreFloatBuilder,
float: () => float
});
module.exports = __toCommonJS(float_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreFloatBuilder extends import_common.SingleStoreColumnBuilderWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreFloatBuilder";
constructor(name, config) {
super(name, "number", "SingleStoreFloat");
this.config.precision = config?.precision;
this.config.scale = config?.scale;
this.config.unsigned = config?.unsigned;
}
/** @internal */
build(table) {
return new SingleStoreFloat(
table,
this.config
);
}
}
class SingleStoreFloat extends import_common.SingleStoreColumnWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreFloat";
precision = this.config.precision;
scale = this.config.scale;
unsigned = this.config.unsigned;
getSQLType() {
let type = "";
if (this.precision !== void 0 && this.scale !== void 0) {
type += `float(${this.precision},${this.scale})`;
} else if (this.precision === void 0) {
type += "float";
} else {
type += `float(${this.precision},0)`;
}
return this.unsigned ? `${type} unsigned` : type;
}
}
function float(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
return new SingleStoreFloatBuilder(name, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreFloat,
SingleStoreFloatBuilder,
float
});
//# sourceMappingURL=float.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/float.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';\n\nexport type SingleStoreFloatBuilderInitial<TName extends string> = SingleStoreFloatBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SingleStoreFloat';\n\tdata: number;\n\tdriverParam: number | string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreFloatBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreFloat'>>\n\textends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreFloatConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreFloatBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreFloatConfig | undefined) {\n\t\tsuper(name, 'number', 'SingleStoreFloat');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreFloat<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreFloat<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreFloat<T extends ColumnBaseConfig<'number', 'SingleStoreFloat'>>\n\textends SingleStoreColumnWithAutoIncrement<T, SingleStoreFloatConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreFloat';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `float(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'float';\n\t\t} else {\n\t\t\ttype += `float(${this.precision},0)`;\n\t\t}\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface SingleStoreFloatConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function float(): SingleStoreFloatBuilderInitial<''>;\nexport function float(\n\tconfig?: SingleStoreFloatConfig,\n): SingleStoreFloatBuilderInitial<''>;\nexport function float<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreFloatConfig,\n): SingleStoreFloatBuilderInitial<TName>;\nexport function float(a?: string | SingleStoreFloatConfig, b?: SingleStoreFloatConfig) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreFloatConfig>(a, b);\n\treturn new SingleStoreFloatBuilder(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,mBAAuC;AACvC,oBAA8F;AAYvF,MAAM,gCACJ,wDACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA4C;AACxE,UAAM,MAAM,UAAU,kBAAkB;AACxC,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACoD;AACpD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,yBACJ,iDACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAErD,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,SAAS,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAC9C,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,SAAS,KAAK,SAAS;AAAA,IAChC;AACA,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,MAAM,GAAqC,GAA4B;AACtF,QAAM,EAAE,MAAM,OAAO,QAAI,qCAA+C,GAAG,CAAC;AAC5E,SAAO,IAAI,wBAAwB,MAAM,MAAM;AAChD;","names":[]}

View File

@ -0,0 +1,32 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.cjs";
export type SingleStoreFloatBuilderInitial<TName extends string> = SingleStoreFloatBuilder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreFloat';
data: number;
driverParam: number | string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreFloatBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreFloat'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreFloatConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreFloatConfig | undefined);
}
export declare class SingleStoreFloat<T extends ColumnBaseConfig<'number', 'SingleStoreFloat'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreFloatConfig> {
static readonly [entityKind]: string;
readonly precision: number | undefined;
readonly scale: number | undefined;
readonly unsigned: boolean | undefined;
getSQLType(): string;
}
export interface SingleStoreFloatConfig {
precision?: number;
scale?: number;
unsigned?: boolean;
}
export declare function float(): SingleStoreFloatBuilderInitial<''>;
export declare function float(config?: SingleStoreFloatConfig): SingleStoreFloatBuilderInitial<''>;
export declare function float<TName extends string>(name: TName, config?: SingleStoreFloatConfig): SingleStoreFloatBuilderInitial<TName>;

View File

@ -0,0 +1,32 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
export type SingleStoreFloatBuilderInitial<TName extends string> = SingleStoreFloatBuilder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreFloat';
data: number;
driverParam: number | string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreFloatBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreFloat'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreFloatConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config: SingleStoreFloatConfig | undefined);
}
export declare class SingleStoreFloat<T extends ColumnBaseConfig<'number', 'SingleStoreFloat'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreFloatConfig> {
static readonly [entityKind]: string;
readonly precision: number | undefined;
readonly scale: number | undefined;
readonly unsigned: boolean | undefined;
getSQLType(): string;
}
export interface SingleStoreFloatConfig {
precision?: number;
scale?: number;
unsigned?: boolean;
}
export declare function float(): SingleStoreFloatBuilderInitial<''>;
export declare function float(config?: SingleStoreFloatConfig): SingleStoreFloatBuilderInitial<''>;
export declare function float<TName extends string>(name: TName, config?: SingleStoreFloatConfig): SingleStoreFloatBuilderInitial<TName>;

View File

@ -0,0 +1,46 @@
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
class SingleStoreFloatBuilder extends SingleStoreColumnBuilderWithAutoIncrement {
static [entityKind] = "SingleStoreFloatBuilder";
constructor(name, config) {
super(name, "number", "SingleStoreFloat");
this.config.precision = config?.precision;
this.config.scale = config?.scale;
this.config.unsigned = config?.unsigned;
}
/** @internal */
build(table) {
return new SingleStoreFloat(
table,
this.config
);
}
}
class SingleStoreFloat extends SingleStoreColumnWithAutoIncrement {
static [entityKind] = "SingleStoreFloat";
precision = this.config.precision;
scale = this.config.scale;
unsigned = this.config.unsigned;
getSQLType() {
let type = "";
if (this.precision !== void 0 && this.scale !== void 0) {
type += `float(${this.precision},${this.scale})`;
} else if (this.precision === void 0) {
type += "float";
} else {
type += `float(${this.precision},0)`;
}
return this.unsigned ? `${type} unsigned` : type;
}
}
function float(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
return new SingleStoreFloatBuilder(name, config);
}
export {
SingleStoreFloat,
SingleStoreFloatBuilder,
float
};
//# sourceMappingURL=float.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/float.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';\n\nexport type SingleStoreFloatBuilderInitial<TName extends string> = SingleStoreFloatBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SingleStoreFloat';\n\tdata: number;\n\tdriverParam: number | string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreFloatBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreFloat'>>\n\textends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreFloatConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreFloatBuilder';\n\n\tconstructor(name: T['name'], config: SingleStoreFloatConfig | undefined) {\n\t\tsuper(name, 'number', 'SingleStoreFloat');\n\t\tthis.config.precision = config?.precision;\n\t\tthis.config.scale = config?.scale;\n\t\tthis.config.unsigned = config?.unsigned;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreFloat<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreFloat<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreFloat<T extends ColumnBaseConfig<'number', 'SingleStoreFloat'>>\n\textends SingleStoreColumnWithAutoIncrement<T, SingleStoreFloatConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreFloat';\n\n\treadonly precision: number | undefined = this.config.precision;\n\treadonly scale: number | undefined = this.config.scale;\n\treadonly unsigned: boolean | undefined = this.config.unsigned;\n\n\tgetSQLType(): string {\n\t\tlet type = '';\n\t\tif (this.precision !== undefined && this.scale !== undefined) {\n\t\t\ttype += `float(${this.precision},${this.scale})`;\n\t\t} else if (this.precision === undefined) {\n\t\t\ttype += 'float';\n\t\t} else {\n\t\t\ttype += `float(${this.precision},0)`;\n\t\t}\n\t\treturn this.unsigned ? `${type} unsigned` : type;\n\t}\n}\n\nexport interface SingleStoreFloatConfig {\n\tprecision?: number;\n\tscale?: number;\n\tunsigned?: boolean;\n}\n\nexport function float(): SingleStoreFloatBuilderInitial<''>;\nexport function float(\n\tconfig?: SingleStoreFloatConfig,\n): SingleStoreFloatBuilderInitial<''>;\nexport function float<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreFloatConfig,\n): SingleStoreFloatBuilderInitial<TName>;\nexport function float(a?: string | SingleStoreFloatConfig, b?: SingleStoreFloatConfig) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreFloatConfig>(a, b);\n\treturn new SingleStoreFloatBuilder(name, config);\n}\n"],"mappings":"AAEA,SAAS,kBAAkB;AAE3B,SAAS,8BAA8B;AACvC,SAAS,2CAA2C,0CAA0C;AAYvF,MAAM,gCACJ,0CACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA4C;AACxE,UAAM,MAAM,UAAU,kBAAkB;AACxC,SAAK,OAAO,YAAY,QAAQ;AAChC,SAAK,OAAO,QAAQ,QAAQ;AAC5B,SAAK,OAAO,WAAW,QAAQ;AAAA,EAChC;AAAA;AAAA,EAGS,MACR,OACoD;AACpD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,yBACJ,mCACT;AAAA,EACC,QAA0B,UAAU,IAAY;AAAA,EAEvC,YAAgC,KAAK,OAAO;AAAA,EAC5C,QAA4B,KAAK,OAAO;AAAA,EACxC,WAAgC,KAAK,OAAO;AAAA,EAErD,aAAqB;AACpB,QAAI,OAAO;AACX,QAAI,KAAK,cAAc,UAAa,KAAK,UAAU,QAAW;AAC7D,cAAQ,SAAS,KAAK,SAAS,IAAI,KAAK,KAAK;AAAA,IAC9C,WAAW,KAAK,cAAc,QAAW;AACxC,cAAQ;AAAA,IACT,OAAO;AACN,cAAQ,SAAS,KAAK,SAAS;AAAA,IAChC;AACA,WAAO,KAAK,WAAW,GAAG,IAAI,cAAc;AAAA,EAC7C;AACD;AAgBO,SAAS,MAAM,GAAqC,GAA4B;AACtF,QAAM,EAAE,MAAM,OAAO,IAAI,uBAA+C,GAAG,CAAC;AAC5E,SAAO,IAAI,wBAAwB,MAAM,MAAM;AAChD;","names":[]}

View File

@ -0,0 +1,71 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var columns_exports = {};
module.exports = __toCommonJS(columns_exports);
__reExport(columns_exports, require("./bigint.cjs"), module.exports);
__reExport(columns_exports, require("./binary.cjs"), module.exports);
__reExport(columns_exports, require("./boolean.cjs"), module.exports);
__reExport(columns_exports, require("./char.cjs"), module.exports);
__reExport(columns_exports, require("./common.cjs"), module.exports);
__reExport(columns_exports, require("./custom.cjs"), module.exports);
__reExport(columns_exports, require("./date.cjs"), module.exports);
__reExport(columns_exports, require("./datetime.cjs"), module.exports);
__reExport(columns_exports, require("./decimal.cjs"), module.exports);
__reExport(columns_exports, require("./double.cjs"), module.exports);
__reExport(columns_exports, require("./enum.cjs"), module.exports);
__reExport(columns_exports, require("./float.cjs"), module.exports);
__reExport(columns_exports, require("./int.cjs"), module.exports);
__reExport(columns_exports, require("./json.cjs"), module.exports);
__reExport(columns_exports, require("./mediumint.cjs"), module.exports);
__reExport(columns_exports, require("./real.cjs"), module.exports);
__reExport(columns_exports, require("./serial.cjs"), module.exports);
__reExport(columns_exports, require("./smallint.cjs"), module.exports);
__reExport(columns_exports, require("./text.cjs"), module.exports);
__reExport(columns_exports, require("./time.cjs"), module.exports);
__reExport(columns_exports, require("./timestamp.cjs"), module.exports);
__reExport(columns_exports, require("./tinyint.cjs"), module.exports);
__reExport(columns_exports, require("./varbinary.cjs"), module.exports);
__reExport(columns_exports, require("./varchar.cjs"), module.exports);
__reExport(columns_exports, require("./year.cjs"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./bigint.cjs"),
...require("./binary.cjs"),
...require("./boolean.cjs"),
...require("./char.cjs"),
...require("./common.cjs"),
...require("./custom.cjs"),
...require("./date.cjs"),
...require("./datetime.cjs"),
...require("./decimal.cjs"),
...require("./double.cjs"),
...require("./enum.cjs"),
...require("./float.cjs"),
...require("./int.cjs"),
...require("./json.cjs"),
...require("./mediumint.cjs"),
...require("./real.cjs"),
...require("./serial.cjs"),
...require("./smallint.cjs"),
...require("./text.cjs"),
...require("./time.cjs"),
...require("./timestamp.cjs"),
...require("./tinyint.cjs"),
...require("./varbinary.cjs"),
...require("./varchar.cjs"),
...require("./year.cjs")
});
//# sourceMappingURL=index.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/index.ts"],"sourcesContent":["export * from './bigint.ts';\nexport * from './binary.ts';\nexport * from './boolean.ts';\nexport * from './char.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './date.ts';\nexport * from './datetime.ts';\nexport * from './decimal.ts';\nexport * from './double.ts';\nexport * from './enum.ts';\nexport * from './float.ts';\nexport * from './int.ts';\nexport * from './json.ts';\nexport * from './mediumint.ts';\nexport * from './real.ts';\nexport * from './serial.ts';\nexport * from './smallint.ts';\nexport * from './text.ts';\nexport * from './time.ts';\nexport * from './timestamp.ts';\nexport * from './tinyint.ts';\nexport * from './varbinary.ts';\nexport * from './varchar.ts';\nexport * from './year.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,wBAAd;AACA,4BAAc,wBADd;AAEA,4BAAc,yBAFd;AAGA,4BAAc,sBAHd;AAIA,4BAAc,wBAJd;AAKA,4BAAc,wBALd;AAMA,4BAAc,sBANd;AAOA,4BAAc,0BAPd;AAQA,4BAAc,yBARd;AASA,4BAAc,wBATd;AAUA,4BAAc,sBAVd;AAWA,4BAAc,uBAXd;AAYA,4BAAc,qBAZd;AAaA,4BAAc,sBAbd;AAcA,4BAAc,2BAdd;AAeA,4BAAc,sBAfd;AAgBA,4BAAc,wBAhBd;AAiBA,4BAAc,0BAjBd;AAkBA,4BAAc,sBAlBd;AAmBA,4BAAc,sBAnBd;AAoBA,4BAAc,2BApBd;AAqBA,4BAAc,yBArBd;AAsBA,4BAAc,2BAtBd;AAuBA,4BAAc,yBAvBd;AAwBA,4BAAc,sBAxBd;","names":[]}

View File

@ -0,0 +1,25 @@
export * from "./bigint.cjs";
export * from "./binary.cjs";
export * from "./boolean.cjs";
export * from "./char.cjs";
export * from "./common.cjs";
export * from "./custom.cjs";
export * from "./date.cjs";
export * from "./datetime.cjs";
export * from "./decimal.cjs";
export * from "./double.cjs";
export * from "./enum.cjs";
export * from "./float.cjs";
export * from "./int.cjs";
export * from "./json.cjs";
export * from "./mediumint.cjs";
export * from "./real.cjs";
export * from "./serial.cjs";
export * from "./smallint.cjs";
export * from "./text.cjs";
export * from "./time.cjs";
export * from "./timestamp.cjs";
export * from "./tinyint.cjs";
export * from "./varbinary.cjs";
export * from "./varchar.cjs";
export * from "./year.cjs";

View File

@ -0,0 +1,25 @@
export * from "./bigint.js";
export * from "./binary.js";
export * from "./boolean.js";
export * from "./char.js";
export * from "./common.js";
export * from "./custom.js";
export * from "./date.js";
export * from "./datetime.js";
export * from "./decimal.js";
export * from "./double.js";
export * from "./enum.js";
export * from "./float.js";
export * from "./int.js";
export * from "./json.js";
export * from "./mediumint.js";
export * from "./real.js";
export * from "./serial.js";
export * from "./smallint.js";
export * from "./text.js";
export * from "./time.js";
export * from "./timestamp.js";
export * from "./tinyint.js";
export * from "./varbinary.js";
export * from "./varchar.js";
export * from "./year.js";

View File

@ -0,0 +1,26 @@
export * from "./bigint.js";
export * from "./binary.js";
export * from "./boolean.js";
export * from "./char.js";
export * from "./common.js";
export * from "./custom.js";
export * from "./date.js";
export * from "./datetime.js";
export * from "./decimal.js";
export * from "./double.js";
export * from "./enum.js";
export * from "./float.js";
export * from "./int.js";
export * from "./json.js";
export * from "./mediumint.js";
export * from "./real.js";
export * from "./serial.js";
export * from "./smallint.js";
export * from "./text.js";
export * from "./time.js";
export * from "./timestamp.js";
export * from "./tinyint.js";
export * from "./varbinary.js";
export * from "./varchar.js";
export * from "./year.js";
//# sourceMappingURL=index.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/index.ts"],"sourcesContent":["export * from './bigint.ts';\nexport * from './binary.ts';\nexport * from './boolean.ts';\nexport * from './char.ts';\nexport * from './common.ts';\nexport * from './custom.ts';\nexport * from './date.ts';\nexport * from './datetime.ts';\nexport * from './decimal.ts';\nexport * from './double.ts';\nexport * from './enum.ts';\nexport * from './float.ts';\nexport * from './int.ts';\nexport * from './json.ts';\nexport * from './mediumint.ts';\nexport * from './real.ts';\nexport * from './serial.ts';\nexport * from './smallint.ts';\nexport * from './text.ts';\nexport * from './time.ts';\nexport * from './timestamp.ts';\nexport * from './tinyint.ts';\nexport * from './varbinary.ts';\nexport * from './varchar.ts';\nexport * from './year.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}

View File

@ -0,0 +1,65 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var int_exports = {};
__export(int_exports, {
SingleStoreInt: () => SingleStoreInt,
SingleStoreIntBuilder: () => SingleStoreIntBuilder,
int: () => int
});
module.exports = __toCommonJS(int_exports);
var import_entity = require("../../entity.cjs");
var import_utils = require("../../utils.cjs");
var import_common = require("./common.cjs");
class SingleStoreIntBuilder extends import_common.SingleStoreColumnBuilderWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreIntBuilder";
constructor(name, config) {
super(name, "number", "SingleStoreInt");
this.config.unsigned = config ? config.unsigned : false;
}
/** @internal */
build(table) {
return new SingleStoreInt(
table,
this.config
);
}
}
class SingleStoreInt extends import_common.SingleStoreColumnWithAutoIncrement {
static [import_entity.entityKind] = "SingleStoreInt";
getSQLType() {
return `int${this.config.unsigned ? " unsigned" : ""}`;
}
mapFromDriverValue(value) {
if (typeof value === "string") {
return Number(value);
}
return value;
}
}
function int(a, b) {
const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);
return new SingleStoreIntBuilder(name, config);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
SingleStoreInt,
SingleStoreIntBuilder,
int
});
//# sourceMappingURL=int.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/singlestore-core/columns/int.ts"],"sourcesContent":["import type { ColumnBuilderBaseConfig, ColumnBuilderRuntimeConfig, MakeColumnConfig } from '~/column-builder.ts';\nimport type { ColumnBaseConfig } from '~/column.ts';\nimport { entityKind } from '~/entity.ts';\nimport type { AnySingleStoreTable } from '~/singlestore-core/table.ts';\nimport { getColumnNameAndConfig } from '~/utils.ts';\nimport { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from './common.ts';\n\nexport type SingleStoreIntBuilderInitial<TName extends string> = SingleStoreIntBuilder<{\n\tname: TName;\n\tdataType: 'number';\n\tcolumnType: 'SingleStoreInt';\n\tdata: number;\n\tdriverParam: number | string;\n\tenumValues: undefined;\n\tgenerated: undefined;\n}>;\n\nexport class SingleStoreIntBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreInt'>>\n\textends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreIntConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreIntBuilder';\n\n\tconstructor(name: T['name'], config?: SingleStoreIntConfig) {\n\t\tsuper(name, 'number', 'SingleStoreInt');\n\t\tthis.config.unsigned = config ? config.unsigned : false;\n\t}\n\n\t/** @internal */\n\toverride build<TTableName extends string>(\n\t\ttable: AnySingleStoreTable<{ name: TTableName }>,\n\t): SingleStoreInt<MakeColumnConfig<T, TTableName>> {\n\t\treturn new SingleStoreInt<MakeColumnConfig<T, TTableName>>(\n\t\t\ttable,\n\t\t\tthis.config as ColumnBuilderRuntimeConfig<any, any>,\n\t\t);\n\t}\n}\n\nexport class SingleStoreInt<T extends ColumnBaseConfig<'number', 'SingleStoreInt'>>\n\textends SingleStoreColumnWithAutoIncrement<T, SingleStoreIntConfig>\n{\n\tstatic override readonly [entityKind]: string = 'SingleStoreInt';\n\n\tgetSQLType(): string {\n\t\treturn `int${this.config.unsigned ? ' unsigned' : ''}`;\n\t}\n\n\toverride mapFromDriverValue(value: number | string): number {\n\t\tif (typeof value === 'string') {\n\t\t\treturn Number(value);\n\t\t}\n\t\treturn value;\n\t}\n}\n\nexport interface SingleStoreIntConfig {\n\tunsigned?: boolean;\n}\n\nexport function int(): SingleStoreIntBuilderInitial<''>;\nexport function int(\n\tconfig?: SingleStoreIntConfig,\n): SingleStoreIntBuilderInitial<''>;\nexport function int<TName extends string>(\n\tname: TName,\n\tconfig?: SingleStoreIntConfig,\n): SingleStoreIntBuilderInitial<TName>;\nexport function int(a?: string | SingleStoreIntConfig, b?: SingleStoreIntConfig) {\n\tconst { name, config } = getColumnNameAndConfig<SingleStoreIntConfig>(a, b);\n\treturn new SingleStoreIntBuilder(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,oBAA2B;AAE3B,mBAAuC;AACvC,oBAA8F;AAYvF,MAAM,8BACJ,wDACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,YAAY,MAAiB,QAA+B;AAC3D,UAAM,MAAM,UAAU,gBAAgB;AACtC,SAAK,OAAO,WAAW,SAAS,OAAO,WAAW;AAAA,EACnD;AAAA;AAAA,EAGS,MACR,OACkD;AAClD,WAAO,IAAI;AAAA,MACV;AAAA,MACA,KAAK;AAAA,IACN;AAAA,EACD;AACD;AAEO,MAAM,uBACJ,iDACT;AAAA,EACC,QAA0B,wBAAU,IAAY;AAAA,EAEhD,aAAqB;AACpB,WAAO,MAAM,KAAK,OAAO,WAAW,cAAc,EAAE;AAAA,EACrD;AAAA,EAES,mBAAmB,OAAgC;AAC3D,QAAI,OAAO,UAAU,UAAU;AAC9B,aAAO,OAAO,KAAK;AAAA,IACpB;AACA,WAAO;AAAA,EACR;AACD;AAcO,SAAS,IAAI,GAAmC,GAA0B;AAChF,QAAM,EAAE,MAAM,OAAO,QAAI,qCAA6C,GAAG,CAAC;AAC1E,SAAO,IAAI,sBAAsB,MAAM,MAAM;AAC9C;","names":[]}

View File

@ -0,0 +1,28 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.cjs";
import type { ColumnBaseConfig } from "../../column.cjs";
import { entityKind } from "../../entity.cjs";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.cjs";
export type SingleStoreIntBuilderInitial<TName extends string> = SingleStoreIntBuilder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreInt';
data: number;
driverParam: number | string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreIntBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreInt'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreIntConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config?: SingleStoreIntConfig);
}
export declare class SingleStoreInt<T extends ColumnBaseConfig<'number', 'SingleStoreInt'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreIntConfig> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: number | string): number;
}
export interface SingleStoreIntConfig {
unsigned?: boolean;
}
export declare function int(): SingleStoreIntBuilderInitial<''>;
export declare function int(config?: SingleStoreIntConfig): SingleStoreIntBuilderInitial<''>;
export declare function int<TName extends string>(name: TName, config?: SingleStoreIntConfig): SingleStoreIntBuilderInitial<TName>;

View File

@ -0,0 +1,28 @@
import type { ColumnBuilderBaseConfig } from "../../column-builder.js";
import type { ColumnBaseConfig } from "../../column.js";
import { entityKind } from "../../entity.js";
import { SingleStoreColumnBuilderWithAutoIncrement, SingleStoreColumnWithAutoIncrement } from "./common.js";
export type SingleStoreIntBuilderInitial<TName extends string> = SingleStoreIntBuilder<{
name: TName;
dataType: 'number';
columnType: 'SingleStoreInt';
data: number;
driverParam: number | string;
enumValues: undefined;
generated: undefined;
}>;
export declare class SingleStoreIntBuilder<T extends ColumnBuilderBaseConfig<'number', 'SingleStoreInt'>> extends SingleStoreColumnBuilderWithAutoIncrement<T, SingleStoreIntConfig> {
static readonly [entityKind]: string;
constructor(name: T['name'], config?: SingleStoreIntConfig);
}
export declare class SingleStoreInt<T extends ColumnBaseConfig<'number', 'SingleStoreInt'>> extends SingleStoreColumnWithAutoIncrement<T, SingleStoreIntConfig> {
static readonly [entityKind]: string;
getSQLType(): string;
mapFromDriverValue(value: number | string): number;
}
export interface SingleStoreIntConfig {
unsigned?: boolean;
}
export declare function int(): SingleStoreIntBuilderInitial<''>;
export declare function int(config?: SingleStoreIntConfig): SingleStoreIntBuilderInitial<''>;
export declare function int<TName extends string>(name: TName, config?: SingleStoreIntConfig): SingleStoreIntBuilderInitial<TName>;

Some files were not shown because too many files have changed in this diff Show More