UNPKG

json-to-sql-parser

Version:

A TypeScript library that converts JSON-based query specifications into safe SQL queries

33 lines 2.03 kB
import { Dialect } from "../constants/dialects"; import type { ExpressionType } from "../constants/field-types"; import { type FunctionDefinition } from "../functions"; import type { AnyExpression, Condition, ExpressionObject, ScalarExpression, ScalarPrimitive } from "../schemas"; import type { Config, FieldPath, ParserState } from "../types"; export declare function parseFieldPath(field: string, rootTable: string, config: Config): FieldPath; type ResolveFunction = { args: AnyExpression[]; functionName: string; definition: FunctionDefinition; }; export declare function resolveFunction(functionExpression: Record<string, AnyExpression[]>): ResolveFunction; export declare function jsonAccessPath(path: string, jsonAccess: string[], jsonExtractText?: boolean): string; export declare function getExpressionType(expression: AnyExpression, state: ParserState): ExpressionType; export declare function castValue(value: string, targetType: ExpressionType, dialect: Dialect): string; export declare const aliasValue: (expression: string, alias: string) => string; export declare function getTargetFieldType(targetFieldType: ExpressionType, hasJsonAccess: boolean, fieldType: ExpressionType, config: Config): ExpressionType; export declare function parseField(field: string, state: ParserState): { select: { alias: string; targetType: ExpressionType; field: string; }; fieldPath: FieldPath; }; export declare function parseScalarValue(value: ScalarPrimitive): string; export declare function parseScalarExpression(expression: ScalarExpression, dialect: Dialect): string; export declare function parseExpressionObject(expression: ExpressionObject, state: ParserState): string; export declare function parseExpression(expression: AnyExpression, state: ParserState): string; export declare function mergeConditions(parsedConditions: string[]): string; export declare function parseCondition(condition: Condition, state: ParserState): string; export {}; //# sourceMappingURL=index.d.ts.map