Skip to content
lestrrat-goPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

14 Commits

Folders and files

Repository files navigation

rasql-pg

rasql-pg implements PostgreSQL-specific parts of rasql. It provides the PostgreSQL work in idiomatic pure Go for Go 1.26+.

This module does not rely on rasql proper, so as to not have circular dependencies.

As of this writing, it only supports PostgreSQL 18.

query currently parses typed subsets of PostgreSQL SELECT and DDL statements. It supports target lists, relation lists, expressions, WHERE, ORDER BY, LIMIT/OFFSET, and core CREATE TABLE, ALTER TABLE, DROP, CREATE INDEX, and CREATE VIEW forms. Unsupported grammar branches return an error instead of an incomplete result.

Parse returns an editable query with concrete Statement interface values in Query.Statements. ParseStatement requires one statement and returns that concrete value directly. A caller can use a type switch for SelectStatement, the supported DDL structs, or the DDLStatement interface.

Serialize writes an editable query as canonical SQL, with semicolons between statements. SerializeStatement writes one statement without a trailing semicolon.

All parsed AST nodes and child collections are editable. Repeated children use slices, which callers can traverse directly or through slices.Values.

Grammar source

Run go generate at the module root to obtain a temporary copy at .tmp/postgresql-18.4.y. The tool downloads PostgreSQL 18.4's official source archive and verifies both its SHA-256 and the extracted src/backend/parser/gram.y SHA-256 before replacing the local file. The grammar source is not stored in Git.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages