TenantAtlas/apps/platform/.pnpm-store/v10/files/0f/29e44acd8daf77c487f26ce525725e3a5cf5f628fb13584125f7b27784c886e1a71c5de1482920324a0b777cef24c8ee4da060fe99e695f35260278edeff9d
Ahmed Darrazi 9f74f7a658
Some checks failed
PR Fast Feedback / fast-feedback (pull_request) Failing after 51s
feat: compress governance operator outcomes
2026-04-19 14:15:11 +02:00

44 lines
1.3 KiB
Plaintext

import { entityKind } from "../../entity.js";
import { getColumnNameAndConfig } from "../../utils.js";
import { SingleStoreColumn, SingleStoreColumnBuilder } from "./common.js";
class SingleStoreVarBinaryBuilder extends SingleStoreColumnBuilder {
static [entityKind] = "SingleStoreVarBinaryBuilder";
/** @internal */
constructor(name, config) {
super(name, "string", "SingleStoreVarBinary");
this.config.length = config?.length;
}
/** @internal */
build(table) {
return new SingleStoreVarBinary(
table,
this.config
);
}
}
class SingleStoreVarBinary extends SingleStoreColumn {
static [entityKind] = "SingleStoreVarBinary";
length = this.config.length;
mapFromDriverValue(value) {
if (typeof value === "string") return value;
if (Buffer.isBuffer(value)) return value.toString();
const str = [];
for (const v of value) {
str.push(v === 49 ? "1" : "0");
}
return str.join("");
}
getSQLType() {
return this.length === void 0 ? `varbinary` : `varbinary(${this.length})`;
}
}
function varbinary(a, b) {
const { name, config } = getColumnNameAndConfig(a, b);
return new SingleStoreVarBinaryBuilder(name, config);
}
export {
SingleStoreVarBinary,
SingleStoreVarBinaryBuilder,
varbinary
};
//# sourceMappingURL=varbinary.js.map