Documentation ¶
Index ¶
- type Blueprint
- func (t *Blueprint) AddColumn(c *ColumnBuilder) *Blueprint
- 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) Float32(name string) *ColumnBuilder
- func (t *Blueprint) Float64(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) Int16(name string) *ColumnBuilder
- func (t *Blueprint) Int32(name string) *ColumnBuilder
- func (t *Blueprint) Int64(name string) *ColumnBuilder
- func (t *Blueprint) Int8(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) PrimaryKey(columns ...string)
- func (t *Blueprint) String(name string) *ColumnBuilder
- func (t *Blueprint) TableName() string
- func (t *Blueprint) Text(name string) *ColumnBuilder
- func (b *Blueprint) ToGo() string
- func (t *Blueprint) UInt(name string) *ColumnBuilder
- func (t *Blueprint) UInt16(name string) *ColumnBuilder
- func (t *Blueprint) UInt32(name string) *ColumnBuilder
- func (t *Blueprint) UInt64(name string) *ColumnBuilder
- func (t *Blueprint) UInt8(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) GetBlueprint() *Blueprint
- func (b *CreateTableBuilder) IfNotExists() *CreateTableBuilder
- func (b *CreateTableBuilder) Run(ctx context.Context, tx database.DB) error
- 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 Runner
- type RunnerFunc
- type UpdateTableBuilder
- func (b *UpdateTableBuilder) GetBlueprint() *Blueprint
- func (b *UpdateTableBuilder) Run(ctx context.Context, tx database.DB) error
- func (b *UpdateTableBuilder) ToGo() string
- func (b *UpdateTableBuilder) ToSQL(d dialects.Dialect) (string, []any, error)
- func (b *UpdateTableBuilder) Type() BlueprintType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blueprint ¶
type Blueprint struct {
// contains filtered or unexported fields
}
func NewBlueprint ¶
func (*Blueprint) AddColumn ¶
func (t *Blueprint) AddColumn(c *ColumnBuilder) *Blueprint
func (*Blueprint) Blob ¶
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) Float32 ¶
func (t *Blueprint) Float32(name string) *ColumnBuilder
func (*Blueprint) Float64 ¶
func (t *Blueprint) Float64(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) Int16 ¶
func (t *Blueprint) Int16(name string) *ColumnBuilder
func (*Blueprint) Int32 ¶
func (t *Blueprint) Int32(name string) *ColumnBuilder
func (*Blueprint) Int64 ¶
func (t *Blueprint) Int64(name string) *ColumnBuilder
func (*Blueprint) Int8 ¶
func (t *Blueprint) Int8(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) PrimaryKey ¶
func (*Blueprint) String ¶
func (t *Blueprint) String(name string) *ColumnBuilder
func (*Blueprint) Text ¶ added in v0.5.3
func (t *Blueprint) Text(name string) *ColumnBuilder
func (*Blueprint) UInt ¶
func (t *Blueprint) UInt(name string) *ColumnBuilder
func (*Blueprint) UInt16 ¶
func (t *Blueprint) UInt16(name string) *ColumnBuilder
func (*Blueprint) UInt32 ¶
func (t *Blueprint) UInt32(name string) *ColumnBuilder
func (*Blueprint) UInt64 ¶
func (t *Blueprint) UInt64(name string) *ColumnBuilder
func (*Blueprint) UInt8 ¶
func (t *Blueprint) UInt8(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 {
// contains filtered or unexported fields
}
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) GetBlueprint ¶
func (b *CreateTableBuilder) GetBlueprint() *Blueprint
func (*CreateTableBuilder) IfNotExists ¶
func (b *CreateTableBuilder) IfNotExists() *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
func (*IndexBuilder) ToGo ¶
func (b *IndexBuilder) ToGo() string
func (*IndexBuilder) Unique ¶
func (b *IndexBuilder) Unique() *IndexBuilder
type RunnerFunc ¶
type UpdateTableBuilder ¶
type UpdateTableBuilder struct {
// contains filtered or unexported fields
}
func Table ¶
func Table(name string, cb func(table *Blueprint)) *UpdateTableBuilder
func (*UpdateTableBuilder) GetBlueprint ¶
func (b *UpdateTableBuilder) GetBlueprint() *Blueprint
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.