Documentation
¶
Index ¶
- func TestColumnSuite(t *testing.T)
- type AlterationType
- type Catalog
- func (c *Catalog) AddEnum(schemaName string, enum *Enum) error
- func (c *Catalog) AddTable(schemaName string, table *Table) error
- func (c *Catalog) AlterTable(schemaName, tableName string, alteration TableAlteration) error
- func (c *Catalog) CreateSchema(name string) (*Schema, error)
- func (c *Catalog) DropTable(schemaName, tableName string) error
- func (c *Catalog) GetSchema(name string) (*Schema, error)
- func (c *Catalog) GetTable(schemaName, tableName string) (*Table, error)
- func (c *Catalog) ListTables(schemaName string) ([]*Table, error)
- func (c *Catalog) RenameTable(schemaName, oldName, newName string) error
- type Column
- func (c *Column) Clone() *Column
- func (c *Column) SetArray() *Column
- func (c *Column) SetCreatedBy(migrationFile string) *Column
- func (c *Column) SetDefault(defaultValue string) *Column
- func (c *Column) SetLength(length int32) *Column
- func (c *Column) SetModifiedBy(migrationFile string) *Column
- func (c *Column) SetNotNull() *Column
- func (c *Column) SetPrecisionScale(precision, scale int32) *Column
- func (c *Column) SetPrimaryKey() *Column
- func (c *Column) SetUnique() *Column
- func (c *Column) ValidatePrimaryKeyDatatype(databaseType, migrationFile string) error
- type Enum
- type Index
- type Schema
- type Table
- func (t *Table) AddColumn(column *Column) error
- func (t *Table) AddIndex(index *Index) error
- func (t *Table) Clone() *Table
- func (t *Table) DropColumn(name string) error
- func (t *Table) DropIndex(name string) error
- func (t *Table) GetColumn(name string) (*Column, error)
- func (t *Table) GetPrimaryKeyColumns() []*Column
- func (t *Table) ModifyColumn(name string, newColumn *Column) error
- func (t *Table) RenameColumn(oldName, newName string) error
- func (t *Table) SetCreatedBy(migrationFile string) *Table
- type TableAlteration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestColumnSuite ¶
TestColumnSuite provides organized tests for Column functionality
Types ¶
type AlterationType ¶
type AlterationType int
const ( AddColumn AlterationType = iota DropColumn ModifyColumn RenameColumn AddIndex DropIndex )
type Catalog ¶
type Catalog struct {
DefaultSchema string
Schemas map[string]*Schema
// contains filtered or unexported fields
}
func NewCatalog ¶
func (*Catalog) AlterTable ¶
func (c *Catalog) AlterTable( schemaName, tableName string, alteration TableAlteration, ) error
func (*Catalog) RenameTable ¶
type Column ¶
type Column struct {
Name string
DataType string
IsNullable bool
IsArray bool
Length *int32
Precision *int32
Scale *int32
DefaultVal *string
CreatedBy string // migration file that added this column
ModifiedBy string // migration file that last modified this column
IsPrimaryKey bool
IsUnique bool
}
func (*Column) SetCreatedBy ¶
func (*Column) SetDefault ¶
func (*Column) SetModifiedBy ¶
func (*Column) SetNotNull ¶
func (*Column) SetPrecisionScale ¶
func (*Column) SetPrimaryKey ¶
func (*Column) ValidatePrimaryKeyDatatype ¶
type Table ¶
type Table struct {
Schema string
Name string
Columns []*Column
Indexes []*Index
CreatedBy string // migration file that created this table
}
func (*Table) DropColumn ¶
func (*Table) GetPrimaryKeyColumns ¶
func (*Table) RenameColumn ¶
func (*Table) SetCreatedBy ¶
type TableAlteration ¶
Click to show internal directories.
Click to hide internal directories.