Documentation ¶
Index ¶
- func Drop(table string) builder.ToSQLer
- func DropIfExists(table string) builder.ToSQLer
- type Blueprint
- func (t *Blueprint) AddColumn(c *ColumnBuilder)
- func (t *Blueprint) Blob(name string) *ColumnBuilder
- func (t *Blueprint) Bool(name string) *ColumnBuilder
- func (t *Blueprint) Date(name string) *ColumnBuilder
- func (t *Blueprint) DateTime(name string) *ColumnBuilder
- func (t *Blueprint) DropColumn(column string)
- func (t *Blueprint) Float(name string) *ColumnBuilder
- func (t *Blueprint) ForeignKey(localKey, relatedTable, relatedKey string)
- func (t *Blueprint) GetBlueprint() *Blueprint
- func (t *Blueprint) Index(name string) *IndexBuilder
- func (t *Blueprint) Int(name string) *ColumnBuilder
- func (t *Blueprint) JSON(name string) *ColumnBuilder
- func (t *Blueprint) Merge(newBlueprint *Blueprint)
- func (t *Blueprint) OfType(datatype dialects.DataType, name string) *ColumnBuilder
- func (t *Blueprint) String(name string) *ColumnBuilder
- func (t *Blueprint) TableName() string
- func (b *Blueprint) ToGo() string
- func (t *Blueprint) UInt(name string) *ColumnBuilder
- func (t *Blueprint) Update(oldBlueprint, newBlueprint *Blueprint) bool
- type BlueprintType
- type Blueprinter
- type ColumnBuilder
- func (b *ColumnBuilder) After(column string) *ColumnBuilder
- func (b *ColumnBuilder) AutoIncrement() *ColumnBuilder
- func (b *ColumnBuilder) Change() *ColumnBuilder
- func (b *ColumnBuilder) Default(v any) *ColumnBuilder
- func (b *ColumnBuilder) DefaultCurrentTime() *ColumnBuilder
- func (b *ColumnBuilder) Equals(newB *ColumnBuilder) bool
- func (b *ColumnBuilder) Index() *ColumnBuilder
- func (b *ColumnBuilder) Name() string
- func (b *ColumnBuilder) NotNullable() *ColumnBuilder
- func (b *ColumnBuilder) Nullable() *ColumnBuilder
- func (b *ColumnBuilder) Primary() *ColumnBuilder
- func (b *ColumnBuilder) ToGo() string
- func (b *ColumnBuilder) ToSQL(d dialects.Dialect) (string, []any, error)
- func (b *ColumnBuilder) Type(datatype dialects.DataType) *ColumnBuilder
- func (b *ColumnBuilder) Unique() *ColumnBuilder
- type CreateTableBuilder
- func (b *CreateTableBuilder) AddColumns(columns ...*ColumnBuilder) *CreateTableBuilder
- func (b *CreateTableBuilder) Columns(columns ...*ColumnBuilder) *CreateTableBuilder
- func (b *CreateTableBuilder) ToGo() string
- func (b *CreateTableBuilder) ToSQL(d dialects.Dialect) (string, []any, error)
- func (b *CreateTableBuilder) Type() BlueprintType
- type ForeignKeyBuilder
- type IndexBuilder
- type UpdateTableBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DropIfExists ¶
Types ¶
type Blueprint ¶
type Blueprint struct {
// contains filtered or unexported fields
}
func NewBlueprint ¶
func (*Blueprint) AddColumn ¶
func (t *Blueprint) AddColumn(c *ColumnBuilder)
func (*Blueprint) Blob ¶ added in v0.17.1
func (t *Blueprint) Blob(name string) *ColumnBuilder
func (*Blueprint) Bool ¶
func (t *Blueprint) Bool(name string) *ColumnBuilder
func (*Blueprint) Date ¶
func (t *Blueprint) Date(name string) *ColumnBuilder
func (*Blueprint) DateTime ¶
func (t *Blueprint) DateTime(name string) *ColumnBuilder
func (*Blueprint) DropColumn ¶
func (*Blueprint) Float ¶
func (t *Blueprint) Float(name string) *ColumnBuilder
func (*Blueprint) ForeignKey ¶
func (*Blueprint) GetBlueprint ¶
func (*Blueprint) Index ¶
func (t *Blueprint) Index(name string) *IndexBuilder
func (*Blueprint) Int ¶
func (t *Blueprint) Int(name string) *ColumnBuilder
func (*Blueprint) JSON ¶
func (t *Blueprint) JSON(name string) *ColumnBuilder
func (*Blueprint) OfType ¶
func (t *Blueprint) OfType(datatype dialects.DataType, name string) *ColumnBuilder
func (*Blueprint) String ¶
func (t *Blueprint) String(name string) *ColumnBuilder
func (*Blueprint) UInt ¶
func (t *Blueprint) UInt(name string) *ColumnBuilder
type BlueprintType ¶
type BlueprintType int
const ( BlueprintTypeCreate BlueprintType = iota BlueprintTypeUpdate )
type Blueprinter ¶
type Blueprinter interface { GetBlueprint() *Blueprint Type() BlueprintType }
type ColumnBuilder ¶
type ColumnBuilder struct {
// contains filtered or unexported fields
}
func (*ColumnBuilder) After ¶
func (b *ColumnBuilder) After(column string) *ColumnBuilder
func (*ColumnBuilder) AutoIncrement ¶
func (b *ColumnBuilder) AutoIncrement() *ColumnBuilder
func (*ColumnBuilder) Change ¶
func (b *ColumnBuilder) Change() *ColumnBuilder
func (*ColumnBuilder) Default ¶
func (b *ColumnBuilder) Default(v any) *ColumnBuilder
func (*ColumnBuilder) DefaultCurrentTime ¶
func (b *ColumnBuilder) DefaultCurrentTime() *ColumnBuilder
func (*ColumnBuilder) Equals ¶
func (b *ColumnBuilder) Equals(newB *ColumnBuilder) bool
func (*ColumnBuilder) Index ¶
func (b *ColumnBuilder) Index() *ColumnBuilder
func (*ColumnBuilder) Name ¶
func (b *ColumnBuilder) Name() string
func (*ColumnBuilder) NotNullable ¶
func (b *ColumnBuilder) NotNullable() *ColumnBuilder
func (*ColumnBuilder) Nullable ¶
func (b *ColumnBuilder) Nullable() *ColumnBuilder
func (*ColumnBuilder) Primary ¶
func (b *ColumnBuilder) Primary() *ColumnBuilder
func (*ColumnBuilder) ToGo ¶
func (b *ColumnBuilder) ToGo() string
func (*ColumnBuilder) Type ¶
func (b *ColumnBuilder) Type(datatype dialects.DataType) *ColumnBuilder
func (*ColumnBuilder) Unique ¶
func (b *ColumnBuilder) Unique() *ColumnBuilder
type CreateTableBuilder ¶
type CreateTableBuilder struct {
*Blueprint
}
func Create ¶
func Create(name string, cb func(b *Blueprint)) *CreateTableBuilder
func (*CreateTableBuilder) AddColumns ¶
func (b *CreateTableBuilder) AddColumns(columns ...*ColumnBuilder) *CreateTableBuilder
func (*CreateTableBuilder) Columns ¶
func (b *CreateTableBuilder) Columns(columns ...*ColumnBuilder) *CreateTableBuilder
func (*CreateTableBuilder) ToGo ¶
func (b *CreateTableBuilder) ToGo() string
func (*CreateTableBuilder) Type ¶
func (b *CreateTableBuilder) Type() BlueprintType
type ForeignKeyBuilder ¶
type ForeignKeyBuilder struct {
// contains filtered or unexported fields
}
type IndexBuilder ¶
type IndexBuilder struct {
// contains filtered or unexported fields
}
func (*IndexBuilder) AddColumn ¶
func (b *IndexBuilder) AddColumn(c string) *IndexBuilder
type UpdateTableBuilder ¶
type UpdateTableBuilder struct {
*Blueprint
}
func Table ¶
func Table(name string, cb func(table *Blueprint)) *UpdateTableBuilder
func (*UpdateTableBuilder) ToGo ¶
func (b *UpdateTableBuilder) ToGo() string
func (*UpdateTableBuilder) Type ¶
func (b *UpdateTableBuilder) Type() BlueprintType
Click to show internal directories.
Click to hide internal directories.