schema

package
v0.0.0-...-1e4b8bd Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Name string
	// Unsigned is true if the column is of integer or decimal types and is
	// unsigned.
	Unsigned bool
}

Column carries two key column parameters that are not available in the binary log of older versions of MySQL.

type Manager

type Manager struct {
	Schema *Schema
	// contains filtered or unexported fields
}

Manager maintains table schemas.

func NewManager

func NewManager(db *sql.DB) *Manager

NewManager creates a new schema manager.

func (*Manager) Manage

func (m *Manager) Manage(database, table string) error

Manage adds given tables to a list of managed tables and updates its details.

func (*Manager) ProcessQuery

func (m *Manager) ProcessQuery(database, query string) error

ProcessQuery accepts an SQL query and updates schema if required.

type Schema

type Schema struct {
	// contains filtered or unexported fields
}

Schema contains table definitions.

func NewSchema

func NewSchema() *Schema

NewSchema creates a new managed schema object.

func (Schema) Table

func (s Schema) Table(database, table string) *Table

Table returns table details for a given database and table name pair. If the table can't be found nil is returned.

func (Schema) Update

func (s Schema) Update(database, table string, cols []Column)

Update sets new column definitions for a given database and table name pair.

type Table

type Table struct {
	// contains filtered or unexported fields
}

Table is a list of columns.

func (Table) Column

func (t Table) Column(i int) *Column

Column returns column details for the given column index. If index is out of range nil is returned.

Jump to

Keyboard shortcuts

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