sqlparser

package
v3.30.2 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseSQLMigration

func ParseSQLMigration(r io.Reader, direction Direction, debug bool) (stmts []string, useTx bool, err error)

Split given SQL script into individual statements and return SQL statements for given direction (up=true, down=false).

The base case is to simply split on semicolons, as these naturally terminate a statement.

However, more complex cases like pl/pgsql can have semicolons within a statement. For these cases, we provide the explicit annotations 'StatementBegin' and 'StatementEnd' to allow the script to tell us to ignore semicolons.

Types

type Direction added in v3.10.0

type Direction string
const (
	DirectionUp   Direction = "up"
	DirectionDown Direction = "down"
)

func FromBool added in v3.10.0

func FromBool(b bool) Direction

func (Direction) String added in v3.15.1

func (d Direction) String() string

func (Direction) ToBool added in v3.15.1

func (d Direction) ToBool() bool

type ParsedSQL added in v3.16.0

type ParsedSQL struct {
	UseTx    bool
	Up, Down []string
}

func ParseAllFromFS added in v3.16.0

func ParseAllFromFS(fsys fs.FS, filename string, debug bool) (*ParsedSQL, error)

Jump to

Keyboard shortcuts

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