@514labs/moose-lib 0.6.247 → 0.6.248-ci-1-g0f01aa3d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -421,6 +421,22 @@ var handleDefault = (t, checker) => {
421
421
  }
422
422
  return defaultType.value;
423
423
  };
424
+ var handleMaterialized = (t, checker) => {
425
+ const materializedType = getTaggedType(
426
+ t,
427
+ checker,
428
+ "_clickhouse_materialized"
429
+ );
430
+ if (materializedType === null) {
431
+ return null;
432
+ }
433
+ if (!materializedType.isStringLiteral()) {
434
+ throw new UnsupportedFeature(
435
+ 'ClickHouseMaterialized must use a string literal, e.g. ClickHouseMaterialized<"toDate(timestamp)">'
436
+ );
437
+ }
438
+ return materializedType.value;
439
+ };
424
440
  var handleTtl = (t, checker) => {
425
441
  const ttlType = getTaggedType(t, checker, "_clickhouse_ttl");
426
442
  if (ttlType === null) {
@@ -911,13 +927,21 @@ var toColumns = (t, checker) => {
911
927
  isJwt,
912
928
  node?.type
913
929
  );
930
+ const defaultValue = defaultExpression ?? handleDefault(type, checker);
931
+ const materializedValue = handleMaterialized(type, checker);
932
+ if (defaultValue && materializedValue) {
933
+ throw new UnsupportedFeature(
934
+ `Column '${prop.name}' cannot have both ClickHouseDefault and ClickHouseMaterialized. Use one or the other.`
935
+ );
936
+ }
914
937
  return {
915
938
  name: prop.name,
916
939
  data_type: dataType,
917
940
  primary_key: isKey,
918
941
  required: !nullable,
919
942
  unique: false,
920
- default: defaultExpression ?? handleDefault(type, checker),
943
+ default: defaultValue,
944
+ materialized: materializedValue,
921
945
  ttl: handleTtl(type, checker),
922
946
  codec: handleCodec(type, checker),
923
947
  annotations