sqlparser

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package sqlparser provides helpers and caching for pg_query_go PostgreSQL AST parsing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectCreatedTables

func CollectCreatedTables(tree *pg_query.ParseResult) map[string]bool

CollectCreatedTables extracts table names (in lowercase) defined via CREATE TABLE in an AST parse tree.

func ExtractFromTableNames

func ExtractFromTableNames(stmt *pg_query.SelectStmt) []string

ExtractFromTableNames extracts all table names referenced in a SelectStmt's FromClause.

func ExtractLockingInfo

func ExtractLockingInfo(stmt *pg_query.SelectStmt) (hasLocking bool, isForUpdate bool, isSkipLocked bool, isNoWait bool)

ExtractLockingInfo inspects a SelectStmt's LockingClause. Returns hasLocking, isForUpdate, isSkipLocked, isNoWait.

func HasSelectStar

func HasSelectStar(stmt *pg_query.SelectStmt) bool

HasSelectStar checks if a SelectStmt projects a wildcard (*) or alias.*. Ignores aggregate functions like COUNT(*).

func Parse

func Parse(query string) (*pg_query.ParseResult, error)

Parse parses a SQL query into a PostgreSQL AST with caching for speed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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