MCPcopy Index your code
hub / github.com/drawdb-io/drawdb / getSQLiteType

Function getSQLiteType

src/utils/exportSQL/generic.js:369–400  ·  view source on GitHub ↗
(field)

Source from the content-addressed store, hash-verified

367}
368
369export function getSQLiteType(field) {
370 switch (field.type) {
371 case "INT":
372 case "SMALLINT":
373 case "BIGINT":
374 case "BOOLEAN":
375 return "INTEGER";
376 case "DECIMAL":
377 case "NUMERIC":
378 case "FLOAT":
379 case "DOUBLE":
380 case "REAL":
381 return "REAL";
382 case "CHAR":
383 case "VARCHAR":
384 case "UUID":
385 case "TEXT":
386 case "DATE":
387 case "TIME":
388 case "TIMESTAMP":
389 case "DATETIME":
390 case "BINARY":
391 case "VARBINARY":
392 return "TEXT";
393 case "ENUM":
394 return `TEXT CHECK("${field.name}" in (${field.values
395 .map((v) => `'${v}'`)
396 .join(", ")}))`;
397 default:
398 return "BLOB";
399 }
400}
401
402export function jsonToSQLite(obj) {
403 return obj.tables

Callers 1

jsonToSQLiteFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected