parser

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

SQL Parser Setup Guide

This guide explains how to set up the SQL parser for Go using ANTLR4.

Prerequisites

  • Install ANTLR4 tools
    pip install antlr4-tools
    

Download Grammar Files

Generate Go Parser Code

  • Run the following command to generate Go code with visitor support:
    antlr4 -Dlanguage=Go -visitor -package grammar -o grammar YOURLexer.g4 YOURParser.g4
    
    • -Dlanguage=Go: Generates Go code.
    • -visitor: Enables visitor pattern generation.
    • -package grammar: Sets the Go package name to grammar.
    • -o grammar: Outputs generated files to the grammar directory.

References

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Access

type Access interface {
	Kind() AccessKind
	Action() Action
	QualifiedName() string
}

type AccessKind

type AccessKind int
const (
	TableAccessKind AccessKind = iota
	SchemaAccessKind
	CatalogAccessKind
)

type AccessReceiver

type AccessReceiver interface {
	ParseAccess(sql string) ([]Access, error)
}

type Action

type Action int
const (
	SELECT Action = iota
	INSERT
	CREATE
	DROP
	DELETE
	USE
	ALTER
	GRANT
	REVOKE
	SHOW
	IMPERSONATE
	EXECUTE
	UPDATE
	READ_SYSTEM_INFORMATION
	WRITE_SYSTEM_INFORMATION
)

type TableAccess

type TableAccess struct {
	Catalog string
	Schema  string
	Table   string
	Act     Action
}

func (*TableAccess) Action

func (t *TableAccess) Action() Action

func (*TableAccess) Kind

func (t *TableAccess) Kind() AccessKind

func (*TableAccess) QualifiedName

func (t *TableAccess) QualifiedName() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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