Files
evento/node_modules/kysely/dist/esm/parser/fetch-parser.js
2026-03-18 14:55:56 -03:00

16 lines
592 B
JavaScript

/// <reference types="./fetch-parser.d.ts" />
import { FetchNode } from '../operation-node/fetch-node.js';
import { isBigInt, isNumber } from '../util/object-utils.js';
export function parseFetch(rowCount, modifier) {
if (!isNumber(rowCount) && !isBigInt(rowCount)) {
throw new Error(`Invalid fetch row count: ${rowCount}`);
}
if (!isFetchModifier(modifier)) {
throw new Error(`Invalid fetch modifier: ${modifier}`);
}
return FetchNode.create(rowCount, modifier);
}
function isFetchModifier(value) {
return value === 'only' || value === 'with ties';
}