schema

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: MIT Imports: 8 Imported by: 3

Documentation

Index

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 NewBlueprint(name string) *Blueprint

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

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 (t *Blueprint) ForeignKey(localKey, relatedTable, relatedKey string)

func (*Blueprint) GetBlueprint

func (t *Blueprint) GetBlueprint() *Blueprint

func (*Blueprint) GoString added in v0.10.0

func (b *Blueprint) GoString() string

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

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

func (*Blueprint) OfType

func (t *Blueprint) OfType(datatype dialects.DataType, name string) *ColumnBuilder

func (*Blueprint) PrimaryKey

func (t *Blueprint) PrimaryKey(columns ...string)

func (*Blueprint) String

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

func (*Blueprint) TableName

func (t *Blueprint) TableName() string

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

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) GoString added in v0.10.0

func (b *ColumnBuilder) GoString() string

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) SQLString added in v0.10.0

func (b *ColumnBuilder) SQLString(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 {
	// 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) GoString added in v0.10.0

func (b *CreateTableBuilder) GoString() string

func (*CreateTableBuilder) IfNotExists

func (b *CreateTableBuilder) IfNotExists() *CreateTableBuilder

func (*CreateTableBuilder) Run

func (*CreateTableBuilder) SQLString added in v0.10.0

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

func (*CreateTableBuilder) Type

type ForeignKeyBuilder

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

func (*ForeignKeyBuilder) SQLString added in v0.10.0

func (b *ForeignKeyBuilder) SQLString(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) GoString added in v0.10.0

func (b *IndexBuilder) GoString() string

func (*IndexBuilder) SQLString added in v0.10.0

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

func (*IndexBuilder) Unique

func (b *IndexBuilder) Unique() *IndexBuilder

type Runner

type Runner interface {
	Run(ctx context.Context, tx database.DB) error
}

func Drop

func Drop(table string) Runner

func DropIfExists

func DropIfExists(table string) Runner

func Run

func Run(f RunnerFunc) Runner

type RunnerFunc

type RunnerFunc func(ctx context.Context, tx database.DB) error

func (RunnerFunc) Run

func (f RunnerFunc) Run(ctx context.Context, tx database.DB) error

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) GoString added in v0.10.0

func (b *UpdateTableBuilder) GoString() string

func (*UpdateTableBuilder) Run

func (*UpdateTableBuilder) SQLString added in v0.10.0

func (b *UpdateTableBuilder) SQLString(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