schema

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2015 License: BSD-2-Clause Imports: 2 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
	Previously  string
	Type        string
	Length      int
	IncludeName string
}

type Index

type Index struct {
	Columns []string
	Unique  bool
}

type ManyRelationship

type ManyRelationship struct {
	Parent      *Table
	Child       *Table
	ChildColumn *Column
	Alias       string
}

type OneRelationship

type OneRelationship struct {
	Parent      *Table
	Child       *Table
	ChildColumn *Column
	Alias       string
}

type Schema

type Schema struct {
	Tables map[string]*Table
	Views  []View
	DBMS   string
}

type Table

type Table struct {
	Name    string
	Columns []Column
	Index   []Index

	// One table record has other records in another table relating to it
	HasMany []ManyRelationship
	ChildOf []ManyRelationship

	// One table record may have a single related table record
	HasOne    []OneRelationship
	BelongsTo []OneRelationship
}

func (*Table) AddIndex

func (t *Table) AddIndex(i ...Index) *Table

func (*Table) FindColumn

func (t *Table) FindColumn(name string) *Column

func (*Table) PrimaryKeyColumn

func (t *Table) PrimaryKeyColumn() *Column

type View

type View struct {
	SQL string
}

Jump to

Keyboard shortcuts

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