@leonardovida-md/drizzle-neo-duckdb 1.1.3 → 1.2.0

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.
package/dist/helpers.mjs CHANGED
@@ -115,6 +115,13 @@ function buildStructLiteral(value, schema) {
115
115
  });
116
116
  return sql`struct_pack(${sql.join(parts, sql.raw(", "))})`;
117
117
  }
118
+ function buildMapLiteral(value, valueType) {
119
+ const keys = Object.keys(value);
120
+ const vals = Object.values(value);
121
+ const keyList = buildListLiteral(keys, "TEXT");
122
+ const valList = buildListLiteral(vals, valueType?.endsWith("[]") ? valueType.slice(0, -2) : valueType);
123
+ return sql`map(${keyList}, ${valList})`;
124
+ }
118
125
  var duckDbList = (name, elementType) => customType({
119
126
  dataType() {
120
127
  return `${elementType}[]`;
@@ -160,6 +167,9 @@ var duckDbMap = (name, valueType) => customType({
160
167
  return `MAP (STRING, ${valueType})`;
161
168
  },
162
169
  toDriver(value) {
170
+ if (Object.keys(value).length === 0) {
171
+ return buildMapLiteral(value, valueType);
172
+ }
163
173
  return wrapMap(value, valueType);
164
174
  },
165
175
  fromDriver(value) {
package/dist/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export * from './pool.ts';
8
8
  export * from './olap.ts';
9
9
  export * from './value-wrappers.ts';
10
10
  export * from './options.ts';
11
+ export * from './operators.ts';