model

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2022 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
}

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