postgres

package module
v0.0.0-...-de5c544 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package postgres parses PostgreSQL statements into github.com/aita/sqlkit/sql queries. It is the PostgreSQL frontend for github.com/aita/sqlkit/x/sqlparse, backed by pg_query_go (the real PostgreSQL grammar via libpg_query).

It lives in its own module so the pg_query_go (cgo) dependency stays isolated from callers that only need the sqlparse abstraction or the sql package.

q, err := postgres.ParseOne("SELECT id FROM users WHERE active")
text, args, err := q.ToSQL(sql.PostgreSQLDialect{})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(text string) ([]sql.Query, error)

Parse parses one or more PostgreSQL statements using a default Parser.

func ParseOne

func ParseOne(text string) (sql.Query, error)

ParseOne parses exactly one PostgreSQL statement.

Types

type Parser

type Parser struct{}

Parser parses PostgreSQL SQL text into sqlkit/sql queries. The zero value is ready to use; it implements sqlparse.Parser.

func New

func New() Parser

New returns a PostgreSQL Parser.

func (Parser) Parse

func (Parser) Parse(text string) ([]sql.Query, error)

Parse parses one or more PostgreSQL statements in source order.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL