sql-code-generator
Version:
Generate code from your SQL schema and queries for type safety and development speed.
39 lines (38 loc) • 1.3 kB
TypeScript
import { TypeDefinitionOfQuery, TypeDefinitionOfResourceFunction, TypeDefinitionOfResourceTable, TypeDefinitionOfResourceView } from './objects';
export declare enum DatabaseLanguage {
MYSQL = "mysql",
POSTGRES = "postgres"
}
export declare enum DefinitionType {
RESOURCE = "resource",
QUERY = "query"
}
export declare enum DataType {
STRING = "string",
STRING_ARRAY = "string[]",// postgres supports arrays
NUMBER = "number",
NUMBER_ARRAY = "number[]",// postgres supports arrays
JSON = "Record<string, any>",
JSON_ARRAY = "Record<string, any>[]",// postgres supports arrays
DATE = "Date",
BUFFER = "Buffer",// e.g., for binary
BOOLEAN = "boolean",
NULL = "null",
UNDEFINED = "undefined"
}
export declare enum ResourceType {
TABLE = "TABLE",
FUNCTION = "FUNCTION",
PROCEDURE = "PROCEDURE",
VIEW = "VIEW"
}
export declare enum QuerySection {
SELECT_EXPRESSIONS = "SELECT_EXPRESSIONS",
TABLE_REFERENCES = "TABLE_REFERENCES",
WHERE_CONDITIONS = "WHERE_CONDITIONS"
}
export type TypeDefinition = TypeDefinitionOfQuery | TypeDefinitionOfResourceTable | TypeDefinitionOfResourceFunction | TypeDefinitionOfResourceView;
export interface GeneratedOutputPaths {
types: string;
queryFunctions: string | undefined;
}