model

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT 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 {
	Table *Table
	Name  string
	Tree  *tree.ColumnTableDef
}

type ColumnList

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

func (*ColumnList) All

func (cd *ColumnList) All() []*Column

func (*ColumnList) Find

func (cd *ColumnList) Find(name string) (*Column, bool)

type Constraint

type Constraint struct {
	Table *Table
	Tree  tree.ConstraintTableDef
	Name  string
}

func (*Constraint) Equal added in v1.1.0

func (c *Constraint) Equal(n *Constraint) bool

type ConstraintList

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

func (*ConstraintList) All

func (il *ConstraintList) All() []*Constraint

func (*ConstraintList) Find

func (il *ConstraintList) Find(name string) (*Constraint, bool)

type Index

type Index struct {
	Table *Table
	Name  string
	Tree  *tree.CreateIndex
}

type IndexList

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

IndexList ,,,

func (*IndexList) All

func (il *IndexList) All() []*Index

func (*IndexList) Find

func (il *IndexList) Find(name string) (*Index, bool)

type Model

type Model struct {
	Tables *TableList
}

Model is the declarative representation of a sql schema

func NewModel

func NewModel(sql string) (*Model, error)

NewModel parses a set of `CREATE TABLE` statements to produce a model

type Table

type Table struct {
	Name        string
	Tree        *tree.CreateTable
	Columns     *ColumnList
	Indexes     *IndexList
	Constraints *ConstraintList
}

Table represents the declarative state of a `CREATE TABLE` statement

func NewTable

func NewTable(ct *tree.CreateTable) (*Table, error)

NewTable parses a `CREATE TABLE` statement to produce a declarative representation of the table state

type TableList

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

func (*TableList) All

func (tl *TableList) All() []*Table

func (*TableList) Find

func (tl *TableList) Find(name string) (*Table, bool)

Find table by name

Jump to

Keyboard shortcuts

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