Versions in this module Expand all Collapse all v0 v0.0.3 May 23, 2023 Changes in this version type Column + TableOID int64 v0.0.2 May 22, 2023 Changes in this version type Column + OID int64 v0.0.1 May 19, 2023 Changes in this version + var ErrLocked = errors.New("sql/schema: lock is held by other session") + func IsNotExistError(err error) bool + func ReplaceOrAppend(attrs *[]Attr, v Attr) + type AddAttr struct + A Attr + type AddCheck struct + C *Check + type AddColumn struct + C *Column + type AddForeignKey struct + F *ForeignKey + type AddIndex struct + Extra []Clause + I *Index + type AddPrimaryKey struct + P *Index + type AddSchema struct + Extra []Clause + S *Schema + type AddTable struct + Extra []Clause + T *Table + type Attr interface + func RemoveAttr(attrs []Attr) []Attr + type BinaryOption func(*BinaryType) + func BinarySize(size int) BinaryOption + type BinaryType struct + Size *int + T string + type BoolType struct + T string + type Change interface + type ChangeKind uint + const ChangeAttr + const ChangeCharset + const ChangeCollate + const ChangeColumn + const ChangeComment + const ChangeDefault + const ChangeDeleteAction + const ChangeGenerated + const ChangeNull + const ChangeParts + const ChangeRefColumn + const ChangeRefTable + const ChangeType + const ChangeUnique + const ChangeUpdateAction + const NoChange + func (i ChangeKind) String() string + func (k ChangeKind) Is(c ChangeKind) bool + type Changes []Change + func (c *Changes) RemoveIndex(indexes ...int) + func (c Changes) IndexAddColumn(name string) int + func (c Changes) IndexAddIndex(name string) int + func (c Changes) IndexAddTable(name string) int + func (c Changes) IndexDropColumn(name string) int + func (c Changes) IndexDropIndex(name string) int + func (c Changes) IndexDropTable(name string) int + func (c Changes) IndexModifyColumn(name string) int + func (c Changes) LastIndexAddTable(name string) int + func (c Changes) LastIndexDropTable(name string) int + type Charset struct + V string + type Check struct + Attrs []Attr + Expr string + Name string + func NewCheck() *Check + func (c *Check) AddAttrs(attrs ...Attr) *Check + func (c *Check) SetExpr(expr string) *Check + func (c *Check) SetName(name string) *Check + type Clause interface + type Collation struct + V string + type Column struct + Attrs []Attr + Default Expr + ForeignKeys []*ForeignKey + Indexes []*Index + Name string + Number int16 + Type *ColumnType + func NewBinaryColumn(name, typ string, opts ...BinaryOption) *Column + func NewBoolColumn(name, typ string) *Column + func NewColumn(name string) *Column + func NewDecimalColumn(name, typ string, opts ...DecimalOption) *Column + func NewEnumColumn(name string, opts ...EnumOption) *Column + func NewFloatColumn(name, typ string, opts ...FloatOption) *Column + func NewIntColumn(name, typ string) *Column + func NewJSONColumn(name, typ string) *Column + func NewNullBinaryColumn(name, typ string, opts ...BinaryOption) *Column + func NewNullBoolColumn(name, typ string) *Column + func NewNullColumn(name string) *Column + func NewNullDecimalColumn(name, typ string, opts ...DecimalOption) *Column + func NewNullEnumColumn(name string, opts ...EnumOption) *Column + func NewNullFloatColumn(name, typ string, opts ...FloatOption) *Column + func NewNullIntColumn(name, typ string) *Column + func NewNullJSONColumn(name, typ string) *Column + func NewNullSpatialColumn(name, typ string) *Column + func NewNullStringColumn(name, typ string, opts ...StringOption) *Column + func NewNullTimeColumn(name, typ string) *Column + func NewNullUintColumn(name, typ string) *Column + func NewSpatialColumn(name, typ string) *Column + func NewStringColumn(name, typ string, opts ...StringOption) *Column + func NewTimeColumn(name, typ string, opts ...TimeOption) *Column + func NewUintColumn(name, typ string) *Column + func (c *Column) AddAttrs(attrs ...Attr) *Column + func (c *Column) SetCharset(v string) *Column + func (c *Column) SetCollation(v string) *Column + func (c *Column) SetComment(v string) *Column + func (c *Column) SetDefault(x Expr) *Column + func (c *Column) SetGeneratedExpr(x *GeneratedExpr) *Column + func (c *Column) SetNull(b bool) *Column + func (c *Column) SetType(t Type) *Column + func (c *Column) UnsetCharset() *Column + func (c *Column) UnsetCollation() *Column + type ColumnType struct + Null bool + Raw string + Type Type + type Comment struct + Text string + type DecimalOption func(*DecimalType) + func DecimalPrecision(precision int) DecimalOption + func DecimalScale(scale int) DecimalOption + func DecimalUnsigned(unsigned bool) DecimalOption + type DecimalType struct + Precision int + Scale int + T string + Unsigned bool + type DiffOption func(*DiffOptions) + func DiffSkipChanges(changes ...Change) DiffOption + type DiffOptions struct + Extra any + SkipChanges []Change + func NewDiffOptions(opts ...DiffOption) *DiffOptions + func (o *DiffOptions) AddOrSkip(changes Changes, c Change) Changes + func (o *DiffOptions) Skipped(c Change) bool + type Differ interface + RealmDiff func(from, to *Realm, opts ...DiffOption) ([]Change, error) + SchemaDiff func(from, to *Schema, opts ...DiffOption) ([]Change, error) + TableDiff func(from, to *Table, opts ...DiffOption) ([]Change, error) + type DropAttr struct + A Attr + type DropCheck struct + C *Check + type DropColumn struct + C *Column + type DropForeignKey struct + F *ForeignKey + type DropIndex struct + Extra []Clause + I *Index + type DropPrimaryKey struct + P *Index + type DropSchema struct + Extra []Clause + S *Schema + type DropTable struct + Extra []Clause + T *Table + type EnumOption func(*EnumType) + func EnumName(name string) EnumOption + func EnumSchema(s *Schema) EnumOption + func EnumValues(values ...string) EnumOption + type EnumType struct + Schema *Schema + T string + Values []string + type ExecQuerier interface + ExecContext func(ctx context.Context, query string, args ...any) (sql.Result, error) + QueryContext func(ctx context.Context, query string, args ...any) (*sql.Rows, error) + type Expr interface + type FloatOption func(*FloatType) + func FloatPrecision(precision int) FloatOption + func FloatUnsigned(unsigned bool) FloatOption + type FloatType struct + Precision int + T string + Unsigned bool + type ForeignKey struct + Columns []*Column + OnDelete ReferenceOption + OnUpdate ReferenceOption + RefColumns []*Column + RefTable *Table + Symbol string + Table *Table + func NewForeignKey(symbol string) *ForeignKey + func (f *ForeignKey) AddColumns(columns ...*Column) *ForeignKey + func (f *ForeignKey) AddRefColumns(columns ...*Column) *ForeignKey + func (f *ForeignKey) Column(name string) (*Column, bool) + func (f *ForeignKey) RefColumn(name string) (*Column, bool) + func (f *ForeignKey) SetOnDelete(o ReferenceOption) *ForeignKey + func (f *ForeignKey) SetOnUpdate(o ReferenceOption) *ForeignKey + func (f *ForeignKey) SetRefTable(t *Table) *ForeignKey + func (f *ForeignKey) SetTable(t *Table) *ForeignKey + type GeneratedExpr struct + Expr string + Type string + type IfExists struct + type IfNotExists struct + type Index struct + Attrs []Attr + Name string + Parts []*IndexPart + Table *Table + Unique bool + func NewIndex(name string) *Index + func NewPrimaryKey(columns ...*Column) *Index + func NewUniqueIndex(name string) *Index + func (i *Index) AddAttrs(attrs ...Attr) *Index + func (i *Index) AddColumns(columns ...*Column) *Index + func (i *Index) AddExprs(exprs ...Expr) *Index + func (i *Index) AddParts(parts ...*IndexPart) *Index + func (i *Index) SetComment(v string) *Index + func (i *Index) SetName(name string) *Index + func (i *Index) SetTable(t *Table) *Index + func (i *Index) SetUnique(b bool) *Index + type IndexPart struct + Attrs []Attr + C *Column + Desc bool + SeqNo int + X Expr + func NewColumnPart(c *Column) *IndexPart + func NewExprPart(x Expr) *IndexPart + func NewIndexPart() *IndexPart + func (p *IndexPart) AddAttrs(attrs ...Attr) *IndexPart + func (p *IndexPart) SetColumn(c *Column) *IndexPart + func (p *IndexPart) SetDesc(b bool) *IndexPart + func (p *IndexPart) SetExpr(x Expr) *IndexPart + type InspectMode uint + const InspectSchemas + const InspectTables + func (m InspectMode) Is(i InspectMode) bool + type InspectOptions struct + Exclude []string + Mode InspectMode + Tables []string + type InspectRealmOption struct + Exclude []string + Mode InspectMode + Schemas []string + type Inspector interface + InspectRealm func(ctx context.Context, opts *InspectRealmOption) (*Realm, error) + InspectSchema func(ctx context.Context, name string, opts *InspectOptions) (*Schema, error) + type IntegerType struct + Attrs []Attr + T string + Unsigned bool + type JSONType struct + T string + type Literal struct + V string + type Locker interface + Lock func(ctx context.Context, name string, timeout time.Duration) (UnlockFunc, error) + type ModifyAttr struct + From Attr + To Attr + type ModifyCheck struct + Change ChangeKind + From *Check + To *Check + type ModifyColumn struct + Change ChangeKind + From *Column + To *Column + type ModifyForeignKey struct + Change ChangeKind + From *ForeignKey + To *ForeignKey + type ModifyIndex struct + Change ChangeKind + From *Index + To *Index + type ModifyPrimaryKey struct + Change ChangeKind + From *Index + To *Index + type ModifySchema struct + Changes []Change + S *Schema + type ModifyTable struct + Changes []Change + T *Table + type Normalizer interface + NormalizeRealm func(context.Context, *Realm) (*Realm, error) + NormalizeSchema func(context.Context, *Schema) (*Schema, error) + type NotExistError struct + Err error + func (e NotExistError) Error() string + type RawExpr struct + X string + type Realm struct + Attrs []Attr + Schemas []*Schema + func NewRealm(schemas ...*Schema) *Realm + func (r *Realm) AddSchemas(schemas ...*Schema) *Realm + func (r *Realm) Schema(name string) (*Schema, bool) + func (r *Realm) SetCharset(v string) *Realm + func (r *Realm) SetCollation(v string) *Realm + func (r *Realm) UnsetCharset() *Realm + func (r *Realm) UnsetCollation() *Realm + type ReferenceOption string + const Cascade + const NoAction + const Restrict + const SetDefault + const SetNull + type RenameColumn struct + From *Column + To *Column + type RenameIndex struct + From *Index + To *Index + type RenameTable struct + From *Table + To *Table + type Schema struct + Attrs []Attr + Name string + Realm *Realm + Tables []*Table + func New(name string) *Schema + func (s *Schema) AddAttrs(attrs ...Attr) *Schema + func (s *Schema) AddTables(tables ...*Table) *Schema + func (s *Schema) SetCharset(v string) *Schema + func (s *Schema) SetCollation(v string) *Schema + func (s *Schema) SetComment(v string) *Schema + func (s *Schema) SetRealm(r *Realm) *Schema + func (s *Schema) Table(name string) (*Table, bool) + func (s *Schema) UnsetCharset() *Schema + func (s *Schema) UnsetCollation() *Schema + type SpatialType struct + T string + type StringOption func(*StringType) + func StringSize(size int) StringOption + type StringType struct + Size int + T string + type Table struct + Attrs []Attr + Columns []*Column + ForeignKeys []*ForeignKey + Indexes []*Index + Name string + PrimaryKey *Index + Schema *Schema + func NewTable(name string) *Table + func (t *Table) AddAttrs(attrs ...Attr) *Table + func (t *Table) AddChecks(checks ...*Check) *Table + func (t *Table) AddColumns(columns ...*Column) *Table + func (t *Table) AddForeignKeys(fks ...*ForeignKey) *Table + func (t *Table) AddIndexes(indexes ...*Index) *Table + func (t *Table) Column(name string) (*Column, bool) + func (t *Table) ForeignKey(symbol string) (*ForeignKey, bool) + func (t *Table) Index(name string) (*Index, bool) + func (t *Table) SetCharset(v string) *Table + func (t *Table) SetCollation(v string) *Table + func (t *Table) SetComment(v string) *Table + func (t *Table) SetPrimaryKey(pk *Index) *Table + func (t *Table) SetSchema(s *Schema) *Table + func (t *Table) UnsetCharset() *Table + func (t *Table) UnsetCollation() *Table + type TimeOption func(*TimeType) + func TimePrecision(precision int) TimeOption + type TimeType struct + Precision *int + T string + type Type interface + type UUIDType struct + T string + type UnlockFunc func() error + type UnsupportedType struct + T string