Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlterColumnBuilder ¶
type AlterColumnBuilder interface { AlterType(typeName string) AlterColumnBuilder AlterDefault(expression string) AlterColumnBuilder DropDefault() AlterColumnBuilder SetNullable() AlterColumnBuilder DropNullable() AlterColumnBuilder SetAutoIncrement() AlterColumnBuilder DropAutoIncrement() AlterColumnBuilder }
type Builder ¶
type Builder interface { Begin() Rollback() Commit() string CreateTable(name string, columns []ColumnDefinition, constraints []ConstraintDefinition) TableBuilder AlterTable(name string) TableBuilder DropTable(name string) Builder TruncateTable(name string) Builder }
func NewBuilderPostgreSQL ¶
func NewBuilderPostgreSQL() Builder
type ColumnBuilder ¶
type ColumnBuilder interface { WithName(name string) ColumnBuilder WithType(typeName string) ColumnBuilder WithDefault(expression string) ColumnBuilder IsNullable(enableNullable bool) ColumnBuilder IsPrimaryKey(enablePrimaryKey bool) ColumnBuilder IsUnique(enableUnique bool) ColumnBuilder IsForeignKey(enableForeign bool, referenceTableName string, referenceColumnNames ...string) ColumnBuilder IsCheck(expression string) ColumnBuilder IsAutoIncrement(enableAutoIncrement bool) ColumnBuilder Build() ColumnDefinition }
type ColumnDefinition ¶
type ConstraintBuilder ¶
type ConstraintBuilder interface { WithName(name string) ConstraintBuilder WithColumns(columnNames ...string) ConstraintBuilder IsPrimaryKey(enablePrimary bool) ConstraintBuilder IsUnique(enableUnique bool) ConstraintBuilder IsForeignKey(enableForeign bool, referenceTableName string, referenceColumnNames ...string) ConstraintBuilder IsCheck(expression string) ConstraintBuilder Build() ConstraintDefinition }
type ConstraintDefinition ¶
type ConstraintDefinitionType ¶
type ConstraintDefinitionType uint8
const ( ConstraintPrimaryKey ConstraintDefinitionType = iota ConstraintUnique ConstraintForeignKey ConstraintCheck )
type IndexBuilder ¶
type IndexBuilder interface { WithName(name string) IndexBuilder WithColumns(columnNames ...string) IndexBuilder IsUnique(enableUnique bool) IndexBuilder On(partialCondition string) IndexBuilder Build() IndexDefinition }
type IndexDefinition ¶
type TableBuilder ¶
type TableBuilder interface { Rename(newTableName string) TableBuilder AddColumn(column ColumnDefinition) TableBuilder AddConstraint(constraint ConstraintDefinition) TableBuilder AddIndex(index IndexDefinition) TableBuilder AlterColumn(columnName string, callback func(alterColumnBuilder AlterColumnBuilder)) TableBuilder DropColumn(columnName string) TableBuilder DropConstraint(constraintName string) TableBuilder DropIndex(indexName string) TableBuilder RenameColumn(oldColumnName string, newColumnName string) TableBuilder RenameConstraint(oldConstraintName string, newConstraintName string) TableBuilder RenameIndex(oldIndexName string, newIndexName string) TableBuilder }
Click to show internal directories.
Click to hide internal directories.