model

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2023 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 Enum added in v1.2.0

type Enum struct {
	Name   string
	Values EnumValueList
	Enum   *tree.CreateType
}

Enum represents the declarative state of a `CREATE TYPE _ AS ENUM` statement

func NewEnum added in v1.2.0

func NewEnum(ct *tree.CreateType) (*Enum, error)

NewEnum parses a CREATE TYPE statement and returns an Enum

type EnumList added in v1.2.0

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

func (*EnumList) All added in v1.2.0

func (el *EnumList) All() []*Enum

func (*EnumList) Find added in v1.2.0

func (el *EnumList) Find(name string) (*Enum, bool)

Find enum by name

type EnumValueList added in v1.2.0

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

func (*EnumValueList) All added in v1.2.0

func (ev *EnumValueList) All() []string

func (*EnumValueList) Find added in v1.2.0

func (ev *EnumValueList) Find(v string) 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
	Enums  *EnumList
}

Model is the declarative representation of a sql schema

func NewModel

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

NewModel parses a set of `CREATE (TABLE|ENUM)` 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