schema

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Drop

func Drop(table string) builder.ToSQLer

func DropIfExists

func DropIfExists(table string) builder.ToSQLer

Types

type Blueprint

type Blueprint struct {
	// contains filtered or unexported fields
}

func NewBlueprint

func NewBlueprint(name string) *Blueprint

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 (t *Blueprint) DropColumn(column string)

func (*Blueprint) Float

func (t *Blueprint) Float(name string) *ColumnBuilder

func (*Blueprint) ForeignKey

func (t *Blueprint) ForeignKey(localKey, relatedTable, relatedKey string)

func (*Blueprint) GetBlueprint

func (t *Blueprint) GetBlueprint() *Blueprint

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) Merge

func (t *Blueprint) Merge(newBlueprint *Blueprint)

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) TableName

func (t *Blueprint) TableName() string

func (*Blueprint) ToGo

func (b *Blueprint) ToGo() string

func (*Blueprint) UInt

func (t *Blueprint) UInt(name string) *ColumnBuilder

func (*Blueprint) Update

func (t *Blueprint) Update(oldBlueprint, newBlueprint *Blueprint) bool

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 NewColumn

func NewColumn(name string, datatype dialects.DataType) *ColumnBuilder

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) ToSQL

func (b *ColumnBuilder) ToSQL(d dialects.Dialect) (string, []any, error)

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) ToSQL

func (b *CreateTableBuilder) ToSQL(d dialects.Dialect) (string, []any, error)

func (*CreateTableBuilder) Type

type ForeignKeyBuilder

type ForeignKeyBuilder struct {
	// contains filtered or unexported fields
}

func (*ForeignKeyBuilder) ToSQL

func (b *ForeignKeyBuilder) ToSQL(d dialects.Dialect) (string, []any, error)

type IndexBuilder

type IndexBuilder struct {
	// contains filtered or unexported fields
}

func (*IndexBuilder) AddColumn

func (b *IndexBuilder) AddColumn(c string) *IndexBuilder

func (*IndexBuilder) ToSQL

func (b *IndexBuilder) ToSQL(d dialects.Dialect) (string, []any, error)

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) ToSQL

func (b *UpdateTableBuilder) ToSQL(d dialects.Dialect) (string, []any, error)

func (*UpdateTableBuilder) Type

Jump to

Keyboard shortcuts

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