Skip to content

Commit 6d6a826

Browse files
adding between logic
1 parent 4555f6f commit 6d6a826

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Magic.IndexedDb/wwwroot/magicLinqToIndexedDb.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,19 @@ function runIndexedQuery(table, indexedConditions, queryAdditions = []) {
222222
case QUERY_OPERATIONS.STARTS_WITH:
223223
query = table.where(firstCondition.property).startsWith(firstCondition.value);
224224
break;
225+
226+
case "between":
227+
if (Array.isArray(firstCondition.value) && firstCondition.value.length === 2) {
228+
query = table.where(firstCondition.property).between(
229+
firstCondition.value[0],
230+
firstCondition.value[1],
231+
true, true // inclusive bounds
232+
);
233+
} else {
234+
throw new Error("Invalid 'between' value format. Expected [min, max]");
235+
}
236+
break;
237+
225238
default:
226239
throw new Error(`Unsupported indexed query operation: ${firstCondition.operation}`);
227240
}

0 commit comments

Comments
 (0)