sqlparser

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ParsedSQL

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

func ParseSQLMigration

func ParseSQLMigration(r io.Reader, logger *slog.Logger) (*ParsedSQL, 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.

func ParseSQLMigrationFromFS

func ParseSQLMigrationFromFS(logger *slog.Logger, fsys fs.FS, filename string) (*ParsedSQL, error)

Jump to

Keyboard shortcuts

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