Documentation
¶
Overview ¶
Package gooseparser parses Goose-format SQL migration files into forward and backward SQL strings for use in RunSQL migration operations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractDescription ¶
ExtractDescription strips the leading numeric prefix and file extension from a Goose migration filename, returning just the description part. For example, "20240101120000_initial.sql" returns "initial".
func ExtractVersionID ¶
ExtractVersionID parses the numeric prefix from a Goose migration filename as an int64. This matches the version_id stored in goose_db_version. For example, "00001_initial.sql" returns 1.
Types ¶
type Migration ¶
type Migration struct {
// ForwardSQL is the SQL from the -- +goose Up section.
ForwardSQL string
// BackwardSQL is the SQL from the -- +goose Down section.
// Empty if no Down section is present.
BackwardSQL string
}
Migration holds the parsed content of a Goose SQL migration file.
Click to show internal directories.
Click to hide internal directories.