dbstate

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoMigrationTable = errors.New("no '_migrations' table")

Functions

func Diff

func Diff(db *sqlx.DB, ss *Snapshot, ignores map[string][]string) (string, error)

func HasMigrationTable added in v0.0.3

func HasMigrationTable(db *sqlx.DB) error

Types

type Procedure

type Procedure struct {
	Name        string `db:"Procedure"`
	Mode        string `db:"sql_mode"`
	Create      string `db:"Create Procedure"`
	Charset     string `db:"character_set_client"`
	Collation   string `db:"collation_connection"`
	DBCollation string `db:"Database Collation"`
}

func GetProcedures

func GetProcedures(db *sqlx.DB) ([]*Procedure, error)

GetProcedures returns stored procedure informatins

type Records

type Records struct {
	Columns []string
	Rows    []Row
}

func GetRecords

func GetRecords(db *sqlx.DB, table string) (*Records, error)

type Row

type Row []any

func (Row) String

func (r Row) String() string

type Snapshot

type Snapshot struct {
	Tables     map[string]*Table
	Records    map[string]*Records
	Procedures map[string]*Procedure
}

func TakeSnapshot

func TakeSnapshot(db *sqlx.DB) (*Snapshot, error)

type Table

type Table struct {
	Name   string `db:"Table"`
	Create string `db:"Create Table"`
	Refs   []string
}

func GetTables

func GetTables(db *sqlx.DB) ([]*Table, error)

GetTables returns table informations

Jump to

Keyboard shortcuts

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