sql_schema

package
v0.0.0-...-bb33fa6 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCurrentSchema

func GetCurrentSchema(db *sql.DB) ([]byte, error)

func InitMetadata

func InitMetadata(db *sql.DB) error

func MapSchema

func MapSchema(schema []Table) map[string]Table

func Migration

func Migration(db *sql.DB, currentSchema []Table, newSchema []Table) error

func SchemaUpgrade

func SchemaUpgrade(db *sql.DB, currentSchema []Table, newSchema []Table) error

func SetSchema

func SetSchema(db *sql.DB, data io.Reader) error

func Transaction

func Transaction(db *sql.DB, handler func() error) error

func Verify

func Verify(tables []Table) error

Types

type SameFields

type SameFields struct {
	Current TableField
	New     TableField
}

type SameTables

type SameTables struct {
	Current Table
	New     Table
}

type Table

type Table struct {
	Name       string       `json:"name"`
	Fields     []TableField `json:"fields"`
	PrimaryKey []string     `json:"primary_key"`
}

func Parse

func Parse(schemaData []byte) ([]Table, error)

type TableField

type TableField struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Nullable bool   `json:"nullable"`
}

Jump to

Keyboard shortcuts

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