CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
text.cjs97 linesDownload Raw Back to columns
1"use strict";2var __defProp = Object.defineProperty;3var __getOwnPropDesc = Object.getOwnPropertyDescriptor;4var __getOwnPropNames = Object.getOwnPropertyNames;5var __hasOwnProp = Object.prototype.hasOwnProperty;6var __export = (target, all) => {7  for (var name in all)8    __defProp(target, name, { get: all[name], enumerable: true });9};10var __copyProps = (to, from, except, desc) => {11  if (from && typeof from === "object" || typeof from === "function") {12    for (let key of __getOwnPropNames(from))13      if (!__hasOwnProp.call(to, key) && key !== except)14        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });15  }16  return to;17};18var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);19var text_exports = {};20__export(text_exports, {21  SQLiteText: () => SQLiteText,22  SQLiteTextBuilder: () => SQLiteTextBuilder,23  SQLiteTextJson: () => SQLiteTextJson,24  SQLiteTextJsonBuilder: () => SQLiteTextJsonBuilder,25  text: () => text26});27module.exports = __toCommonJS(text_exports);28var import_entity = require("../../entity.cjs");29var import_utils = require("../../utils.cjs");30var import_common = require("./common.cjs");31class SQLiteTextBuilder extends import_common.SQLiteColumnBuilder {32  static [import_entity.entityKind] = "SQLiteTextBuilder";33  constructor(name, config) {34    super(name, "string", "SQLiteText");35    this.config.enumValues = config.enum;36    this.config.length = config.length;37  }38  /** @internal */39  build(table) {40    return new SQLiteText(41      table,42      this.config43    );44  }45}46class SQLiteText extends import_common.SQLiteColumn {47  static [import_entity.entityKind] = "SQLiteText";48  enumValues = this.config.enumValues;49  length = this.config.length;50  constructor(table, config) {51    super(table, config);52  }53  getSQLType() {54    return `text${this.config.length ? `(${this.config.length})` : ""}`;55  }56}57class SQLiteTextJsonBuilder extends import_common.SQLiteColumnBuilder {58  static [import_entity.entityKind] = "SQLiteTextJsonBuilder";59  constructor(name) {60    super(name, "json", "SQLiteTextJson");61  }62  /** @internal */63  build(table) {64    return new SQLiteTextJson(65      table,66      this.config67    );68  }69}70class SQLiteTextJson extends import_common.SQLiteColumn {71  static [import_entity.entityKind] = "SQLiteTextJson";72  getSQLType() {73    return "text";74  }75  mapFromDriverValue(value) {76    return JSON.parse(value);77  }78  mapToDriverValue(value) {79    return JSON.stringify(value);80  }81}82function text(a, b = {}) {83  const { name, config } = (0, import_utils.getColumnNameAndConfig)(a, b);84  if (config.mode === "json") {85    return new SQLiteTextJsonBuilder(name);86  }87  return new SQLiteTextBuilder(name, config);88}89// Annotate the CommonJS export names for ESM import in node:900 && (module.exports = {91  SQLiteText,92  SQLiteTextBuilder,93  SQLiteTextJson,94  SQLiteTextJsonBuilder,95  text96});97//# sourceMappingURL=text.cjs.map