drizzle-orm
Version:
Drizzle ORM package for SQL databases
36 lines • 964 B
JavaScript
import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { MySqlColumn, MySqlColumnBuilder } from "./common.js";
class MySqlCharBuilder extends MySqlColumnBuilder {
static [entityKind] = "MySqlCharBuilder";
constructor(name, config) {
super(name, "string", "MySqlChar");
this.config.length = config.length;
this.config.enum = config.enum;
}
/** @internal */
build(table) {
return new MySqlChar(
table,
this.config
);
}
}
class MySqlChar extends MySqlColumn {
static [entityKind] = "MySqlChar";
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 MySqlCharBuilder(name, config);
}
export {
MySqlChar,
MySqlCharBuilder,
char
};
//# sourceMappingURL=char.js.map