rawsql-ts
Version:
[beta]High-performance SQL parser and AST analyzer written in TypeScript. Provides fast parsing and advanced transformation capabilities.
53 lines (52 loc) • 2.55 kB
TypeScript
import type { SelectQuery, InsertQueryConversionOptions, UpdateQueryConversionOptions, DeleteQueryConversionOptions, MergeQueryConversionOptions } from "./SelectQuery";
import { SimpleSelectQuery } from "./SimpleSelectQuery";
import { SqlParameterValue } from "./ValueComponent";
import { SqlComponent } from "./SqlComponent";
import { TupleExpression } from "./ValueComponent";
import type { InsertQuery } from "./InsertQuery";
import type { UpdateQuery } from "./UpdateQuery";
import type { DeleteQuery } from "./DeleteQuery";
import type { MergeQuery } from "./MergeQuery";
/**
* Represents a VALUES query in SQL.
*/
export declare class ValuesQuery extends SqlComponent implements SelectQuery {
static kind: symbol;
readonly __selectQueryType: 'SelectQuery';
headerComments: string[] | null;
tuples: TupleExpression[];
/**
* Column aliases for the VALUES query.
* These represent the logical column names for each value tuple.
* Note: This property is optional and is not referenced during SQL output, but is used when converting to a SimpleSelectQuery.
*/
columnAliases: string[] | null;
constructor(tuples: TupleExpression[], columnAliases?: string[] | null);
toSimpleQuery(): SimpleSelectQuery;
/**
* Converts this VALUES query into an INSERT statement definition.
* @remarks The conversion may reorder the generated SELECT clause to align with the requested column order.
*/
toInsertQuery(options: InsertQueryConversionOptions): InsertQuery;
/**
* Converts this VALUES query into an UPDATE statement definition.
* @remarks The conversion may reorder the generated SELECT clause to align with the requested column order.
*/
toUpdateQuery(options: UpdateQueryConversionOptions): UpdateQuery;
/**
* Converts this VALUES query into a DELETE statement definition.
* @remarks The conversion may reorder the generated SELECT clause to align with the requested column order.
*/
toDeleteQuery(options: DeleteQueryConversionOptions): DeleteQuery;
/**
* Converts this VALUES query into a MERGE statement definition.
* @remarks The conversion may reorder the generated SELECT clause to align with the requested column order.
*/
toMergeQuery(options: MergeQueryConversionOptions): MergeQuery;
/**
* Sets the value of a parameter by name in this query.
* @param name Parameter name
* @param value Value to set
*/
setParameter(name: string, value: SqlParameterValue): this;
}