@jsorm/compiler
v0.2.4
Published
Shared SQL AST → SQL string compilation for JSORM providers
Readme
@jsorm/compiler
Shared layer that compiles query AST to SQL for all providers.
import { Compiler, postgresDialect } from "@jsorm/compiler";
const compiler = new Compiler(metadataRegistry, postgresDialect);
const { sql, params } = await compiler.compile(ast);Responsibilities
Compiler— compiles AST (get,first,count,exists,create,createMany,update,updateMany,delete,deleteMany,cursor) to{ sql, params }- Dialects —
postgresDialect,sqliteDialect,mysqlDialect(andDialectConfigtype) - Predicates and relations —
compileWhere(),compileSelect() - Result mapping —
mapRow(),mapRows(),mapRelationRows(),buildPaginationMeta(),buildCursorMeta() - Schema —
buildColumnDef(),buildCreateTableStatement(),buildCreateJunctionTableStatement(),syncSchema(),detectExistingTables(),getMissingTables() - Cursors —
encodeCursor(),decodeCursor(),extractCursorValues()
Consumed by providers. Does not contain drivers, connections, execute queries, or define models (defineModel lives in @jsorm/core).
