schema

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 7 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) 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) ToGo

func (b *Blueprint) ToGo() string

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) 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 {
	// 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) Run

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 DB added in v0.5.0

type DB = helpers.QueryExecer

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

func (b *IndexBuilder) ToGo() string

func (*IndexBuilder) ToSQL

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

func (*IndexBuilder) Unique

func (b *IndexBuilder) Unique() *IndexBuilder

type Runner

type Runner interface {
	Run(ctx context.Context, tx 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 DB) error

func (RunnerFunc) Run

func (f RunnerFunc) Run(ctx context.Context, tx 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) Run

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