Documentation
¶
Index ¶
- Constants
- Variables
- type BaseGrammar
- func (g *BaseGrammar) Columnize(columns []string) string
- func (g *BaseGrammar) CompileAutoIncrementStartingValues(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileChange(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileDropColumn(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileDropForeign(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileDropFulltext(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileDropIndex(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileDropPrimary(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileDropSpatialIndex(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileDropUnique(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileForeign(blueprint *Blueprint, command *Command) (string, error)
- func (g *BaseGrammar) CompileFullText(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileIndex(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompilePrimary(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileRenameColumn(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileRenameIndex(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileSpatialIndex(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileTableComment(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileUnique(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CompileVectorIndex(_ *Blueprint, _ *Command) (string, error)
- func (g *BaseGrammar) CreateForeignKeyName(blueprint *Blueprint, command *Command) string
- func (g *BaseGrammar) CreateIndexName(blueprint *Blueprint, idxType string, columns ...string) string
- func (g *BaseGrammar) GetDefaultValue(value any) string
- func (g *BaseGrammar) GetFluentCommands() []func(blueprint *Blueprint, command *Command) string
- func (g *BaseGrammar) GetTableFluentCommands() []func(blueprint *Blueprint) string
- func (g *BaseGrammar) GetValue(value any) string
- func (g *BaseGrammar) PrefixArray(prefix string, items []string) []string
- func (g *BaseGrammar) QuoteString(s string) string
- func (g *BaseGrammar) Wrap(ident string, quote string) string
- func (g *BaseGrammar) WrapColumnize(columns []string, quote string) string
- func (g *BaseGrammar) WrapIndexName(index string, quote string) string
- func (g *BaseGrammar) WrapTable(table string, quote string) string
- type Blueprint
- func (b *Blueprint) AddImpliedCommands()
- func (b *Blueprint) After(column string, callback func(*Blueprint))
- func (b *Blueprint) AutoIncrementStartingValues(value int)
- func (b *Blueprint) BigIncrements(name string) ColumnDefinition
- func (b *Blueprint) BigInteger(name string) ColumnDefinition
- func (b *Blueprint) Binary(name string, length ...int) ColumnDefinition
- func (b *Blueprint) Boolean(name string) ColumnDefinition
- func (b *Blueprint) Build(ctx core.Context) error
- func (b *Blueprint) Char(name string, length ...int) ColumnDefinition
- func (b *Blueprint) Charset(charset string)
- func (b *Blueprint) Cidr(name string) ColumnDefinition
- func (b *Blueprint) Collation(collation string)
- func (b *Blueprint) Column(name string, columnType string) ColumnDefinition
- func (b *Blueprint) Comment(comment string)
- func (b *Blueprint) Create()
- func (b *Blueprint) Date(name string) ColumnDefinition
- func (b *Blueprint) DateTime(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) DateTimeTz(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) Datetimes(precision ...int)
- func (b *Blueprint) Decimal(name string, params ...int) ColumnDefinition
- func (b *Blueprint) Double(name string) ColumnDefinition
- func (b *Blueprint) Drop()
- func (b *Blueprint) DropColumn(column string, otherColumns ...string)
- func (b *Blueprint) DropConstrainedForeignID(name string)
- func (b *Blueprint) DropForeign(index any)
- func (b *Blueprint) DropFulltext(index any)
- func (b *Blueprint) DropIfExists()
- func (b *Blueprint) DropIndex(index any)
- func (b *Blueprint) DropMorphs(name string, indexName ...string)
- func (b *Blueprint) DropPrimary(index any)
- func (b *Blueprint) DropSoftDeletes(name ...string)
- func (b *Blueprint) DropSoftDeletesTz(name ...string)
- func (b *Blueprint) DropSpatialIndex(index any)
- func (b *Blueprint) DropTimestamps()
- func (b *Blueprint) DropTimestampsTz()
- func (b *Blueprint) DropUnique(index any)
- func (b *Blueprint) Engine(engine string)
- func (b *Blueprint) Enum(name string, allowed []string) ColumnDefinition
- func (b *Blueprint) Float(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) Foreign(column string) ForeignKeyDefinition
- func (b *Blueprint) ForeignColumns(columns ...string) ForeignKeyDefinition
- func (b *Blueprint) ForeignID(name string) ForeignIDColumnDefinition
- func (b *Blueprint) ForeignULID(name string, length ...int) ForeignIDColumnDefinition
- func (b *Blueprint) ForeignUUID(name string) ForeignIDColumnDefinition
- func (b *Blueprint) FullText(column string, otherColumns ...string) IndexDefinition
- func (b *Blueprint) Geography(name string, subtype string, srid ...int) ColumnDefinition
- func (b *Blueprint) Geometry(name string, subtype string, srid ...int) ColumnDefinition
- func (b *Blueprint) GetAddedColumns() []*Column
- func (b *Blueprint) GetChangedColumns() []*Column
- func (b *Blueprint) GetFluentStatements() []string
- func (b *Blueprint) ID(name ...string) ColumnDefinition
- func (b *Blueprint) IPAddress(name string) ColumnDefinition
- func (b *Blueprint) Increments(name string) ColumnDefinition
- func (b *Blueprint) Index(column string, otherColumns ...string) IndexDefinition
- func (b *Blueprint) Inet(name string) ColumnDefinition
- func (b *Blueprint) InnoDB()
- func (b *Blueprint) Integer(name string) ColumnDefinition
- func (b *Blueprint) IntegerIncrements(name string) ColumnDefinition
- func (b *Blueprint) IsCreating() bool
- func (b *Blueprint) JSON(name string) ColumnDefinition
- func (b *Blueprint) JSONB(name string) ColumnDefinition
- func (b *Blueprint) LongText(name string) ColumnDefinition
- func (b *Blueprint) MacAddr(name string) ColumnDefinition
- func (b *Blueprint) MacAddr8(name string) ColumnDefinition
- func (b *Blueprint) MacAddress(name string) ColumnDefinition
- func (b *Blueprint) MediumIncrements(name string) ColumnDefinition
- func (b *Blueprint) MediumInteger(name string) ColumnDefinition
- func (b *Blueprint) MediumText(name string) ColumnDefinition
- func (b *Blueprint) Morphs(name string, indexName ...string)
- func (b *Blueprint) NullableMorphs(name string, indexName ...string)
- func (b *Blueprint) NullableNumericMorphs(name string, indexName ...string)
- func (b *Blueprint) NullableTimestamps(precision ...int)
- func (b *Blueprint) NullableTimestampsTz(precision ...int)
- func (b *Blueprint) NullableULIDMorphs(name string, indexName ...string)
- func (b *Blueprint) NullableUUIDMorphs(name string, indexName ...string)
- func (b *Blueprint) NumericMorphs(name string, indexName ...string)
- func (b *Blueprint) Point(name string, srid ...int) ColumnDefinition
- func (b *Blueprint) Primary(column string, otherColumns ...string) IndexDefinition
- func (b *Blueprint) RawColumn(name string, definition string) ColumnDefinition
- func (b *Blueprint) RawIndex(expression string, name string) IndexDefinition
- func (b *Blueprint) RemoveColumn(name string)
- func (b *Blueprint) Rename(to string)
- func (b *Blueprint) RenameColumn(oldColumn string, newColumn string)
- func (b *Blueprint) RenameIndex(oldIndexName string, newIndexName string)
- func (b *Blueprint) Set(name string, allowed []string) ColumnDefinition
- func (b *Blueprint) SetBuilder(builder Builder)
- func (b *Blueprint) SetDialect(d dialect.Dialect)
- func (b *Blueprint) SetGrammar(g Grammar)
- func (b *Blueprint) SetName(name string)
- func (b *Blueprint) SmallIncrements(name string) ColumnDefinition
- func (b *Blueprint) SmallInteger(name string) ColumnDefinition
- func (b *Blueprint) SoftDeletes(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) SoftDeletesDatetime(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) SoftDeletesTz(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) SpatialIndex(column string, otherColumns ...string) IndexDefinition
- func (b *Blueprint) String(name string, length ...int) ColumnDefinition
- func (b *Blueprint) TSVector(name string) ColumnDefinition
- func (b *Blueprint) Temporary()
- func (b *Blueprint) Text(name string) ColumnDefinition
- func (b *Blueprint) Time(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) TimeTz(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) Timestamp(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) TimestampTz(name string, precision ...int) ColumnDefinition
- func (b *Blueprint) Timestamps(precision ...int)
- func (b *Blueprint) TimestampsTz(precision ...int)
- func (b *Blueprint) TinyIncrements(name string) ColumnDefinition
- func (b *Blueprint) TinyInteger(name string) ColumnDefinition
- func (b *Blueprint) TinyText(name string) ColumnDefinition
- func (b *Blueprint) ToSQL() ([]string, error)
- func (b *Blueprint) ULID(name string) ColumnDefinition
- func (b *Blueprint) ULIDMorphs(name string, indexName ...string)
- func (b *Blueprint) UUID(name string) ColumnDefinition
- func (b *Blueprint) UUIDMorphs(name string, indexName ...string)
- func (b *Blueprint) Unique(column string, otherColumns ...string) IndexDefinition
- func (b *Blueprint) UnsignedBigInteger(name string) ColumnDefinition
- func (b *Blueprint) UnsignedInteger(name string) ColumnDefinition
- func (b *Blueprint) UnsignedMediumInteger(name string) ColumnDefinition
- func (b *Blueprint) UnsignedSmallInteger(name string) ColumnDefinition
- func (b *Blueprint) UnsignedTinyInteger(name string) ColumnDefinition
- func (b *Blueprint) Vector(name string, dimensions ...int) ColumnDefinition
- func (b *Blueprint) VectorIndex(column string) IndexDefinition
- func (b *Blueprint) Year(name string) ColumnDefinition
- type Builder
- type Column
- func (c *Column) AddCommand(command string)
- func (c *Column) After(column string) ColumnDefinition
- func (c *Column) Always(value ...bool) ColumnDefinition
- func (c *Column) AutoIncrement() ColumnDefinition
- func (c *Column) Change() ColumnDefinition
- func (c *Column) Charset(charset string) ColumnDefinition
- func (c *Column) Collation(collation string) ColumnDefinition
- func (c *Column) Comment(comment string) ColumnDefinition
- func (c *Column) Default(value any) ColumnDefinition
- func (c *Column) First() ColumnDefinition
- func (c *Column) Fixed() ColumnDefinition
- func (c *Column) GeneratedAs(expression ...string) ColumnDefinition
- func (c *Column) HasCommand(command string) bool
- func (c *Column) Index(params ...any) ColumnDefinition
- func (c *Column) Invisible() ColumnDefinition
- func (c *Column) Nullable(value ...bool) ColumnDefinition
- func (c *Column) OnUpdate(value any) ColumnDefinition
- func (c *Column) Primary(value ...bool) ColumnDefinition
- func (c *Column) RenameTo(name string) ColumnDefinition
- func (c *Column) StoredAs(expression string) ColumnDefinition
- func (c *Column) Unique(params ...any) ColumnDefinition
- func (c *Column) Unsigned() ColumnDefinition
- func (c *Column) UseCurrent() ColumnDefinition
- func (c *Column) UseCurrentOnUpdate() ColumnDefinition
- func (c *Column) VirtualAs(expression string) ColumnDefinition
- type ColumnDefinition
- type Command
- type Expression
- type ForeignIDColumnDefinition
- type ForeignKeyDefinition
- type Grammar
- type IndexDefinition
Constants ¶
View Source
const ( ColumnTypeBoolean string = "boolean" ColumnTypeChar string = "char" ColumnTypeString string = "string" ColumnTypeLongText string = "longText" ColumnTypeMediumText string = "mediumText" ColumnTypeText string = "text" ColumnTypeTinyText string = "tinyText" ColumnTypeBigInteger string = "bigInteger" ColumnTypeInteger string = "integer" ColumnTypeMediumInteger string = "mediumInteger" ColumnTypeSmallInteger string = "smallInteger" ColumnTypeTinyInteger string = "tinyInteger" ColumnTypeDecimal string = "decimal" ColumnTypeDouble string = "double" ColumnTypeFloat string = "float" ColumnTypeDateTime string = "dateTime" ColumnTypeDateTimeTz string = "dateTimeTz" ColumnTypeDate string = "date" ColumnTypeTime string = "time" ColumnTypeTimeTz string = "timeTz" ColumnTypeTimestamp string = "timestamp" ColumnTypeTimestampTz string = "timestampTz" ColumnTypeYear string = "year" ColumnTypeBinary string = "binary" ColumnTypeJSON string = "json" ColumnTypeJSONB string = "jsonb" ColumnTypeGeography string = "geography" ColumnTypeGeometry string = "geometry" ColumnTypePoint string = "point" ColumnTypeUUID string = "uuid" ColumnTypeULID string = "ulid" ColumnTypeEnum string = "enum" ColumnTypeSet string = "set" ColumnTypeIPAddress string = "ipAddress" ColumnTypeMacAddress string = "macAddress" ColumnTypeVector string = "vector" ColumnTypeTSVector string = "tsvector" ColumnTypeCidr string = "cidr" ColumnTypeInet string = "inet" ColumnTypeMacaddr string = "macaddr" ColumnTypeMacaddr8 string = "macaddr8" ColumnTypeRaw string = "raw" )
View Source
const ( CommandAdd string = "add" CommandCreate string = "create" CommandChange string = "change" CommandDrop string = "drop" CommandDropIfExists string = "dropIfExists" CommandRename string = "rename" CommandDropColumn string = "dropColumn" CommandRenameColumn string = "renameColumn" CommandIndex string = "index" CommandUnique string = "unique" CommandPrimary string = "primary" CommandFullText string = "fulltext" CommandSpatialIndex string = "spatialIndex" CommandVectorIndex string = "vectorIndex" CommandDropIndex string = "dropIndex" CommandDropUnique string = "dropUnique" CommandDropPrimary string = "dropPrimary" CommandDropFullText string = "dropFulltext" CommandDropSpatialIndex string = "dropSpatialIndex" CommandRenameIndex string = "renameIndex" CommandForeign string = "foreign" CommandDropForeign string = "dropForeign" CommandTableComment string = "tableComment" CommandAutoIncrementStartingValues string = "autoIncrementStartingValues" )
Variables ¶
View Source
var DefaultMorphKeyType = "int"
DefaultMorphKeyType controls the key type used by Morphs/NullableMorphs ("int", "uuid", "ulid").
Functions ¶
This section is empty.
Types ¶
type BaseGrammar ¶
type BaseGrammar struct{}
func (*BaseGrammar) Columnize ¶
func (g *BaseGrammar) Columnize(columns []string) string
func (*BaseGrammar) CompileAutoIncrementStartingValues ¶ added in v0.4.2
func (g *BaseGrammar) CompileAutoIncrementStartingValues(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileChange ¶
func (g *BaseGrammar) CompileChange(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileDropColumn ¶
func (g *BaseGrammar) CompileDropColumn(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileDropForeign ¶
func (g *BaseGrammar) CompileDropForeign(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileDropFulltext ¶
func (g *BaseGrammar) CompileDropFulltext(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileDropIndex ¶
func (g *BaseGrammar) CompileDropIndex(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileDropPrimary ¶
func (g *BaseGrammar) CompileDropPrimary(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileDropSpatialIndex ¶ added in v0.4.2
func (g *BaseGrammar) CompileDropSpatialIndex(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileDropUnique ¶
func (g *BaseGrammar) CompileDropUnique(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileForeign ¶
func (g *BaseGrammar) CompileForeign(blueprint *Blueprint, command *Command) (string, error)
func (*BaseGrammar) CompileFullText ¶
func (g *BaseGrammar) CompileFullText(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileIndex ¶
func (g *BaseGrammar) CompileIndex(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompilePrimary ¶
func (g *BaseGrammar) CompilePrimary(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileRenameColumn ¶
func (g *BaseGrammar) CompileRenameColumn(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileRenameIndex ¶
func (g *BaseGrammar) CompileRenameIndex(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileSpatialIndex ¶ added in v0.4.2
func (g *BaseGrammar) CompileSpatialIndex(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileTableComment ¶ added in v0.4.2
func (g *BaseGrammar) CompileTableComment(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileUnique ¶
func (g *BaseGrammar) CompileUnique(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CompileVectorIndex ¶ added in v0.4.2
func (g *BaseGrammar) CompileVectorIndex(_ *Blueprint, _ *Command) (string, error)
func (*BaseGrammar) CreateForeignKeyName ¶
func (g *BaseGrammar) CreateForeignKeyName(blueprint *Blueprint, command *Command) string
func (*BaseGrammar) CreateIndexName ¶
func (g *BaseGrammar) CreateIndexName(blueprint *Blueprint, idxType string, columns ...string) string
func (*BaseGrammar) GetDefaultValue ¶
func (g *BaseGrammar) GetDefaultValue(value any) string
func (*BaseGrammar) GetFluentCommands ¶
func (g *BaseGrammar) GetFluentCommands() []func(blueprint *Blueprint, command *Command) string
func (*BaseGrammar) GetTableFluentCommands ¶
func (g *BaseGrammar) GetTableFluentCommands() []func(blueprint *Blueprint) string
func (*BaseGrammar) GetValue ¶
func (g *BaseGrammar) GetValue(value any) string
func (*BaseGrammar) PrefixArray ¶
func (g *BaseGrammar) PrefixArray(prefix string, items []string) []string
func (*BaseGrammar) QuoteString ¶
func (g *BaseGrammar) QuoteString(s string) string
func (*BaseGrammar) WrapColumnize ¶
func (g *BaseGrammar) WrapColumnize(columns []string, quote string) string
func (*BaseGrammar) WrapIndexName ¶
func (g *BaseGrammar) WrapIndexName(index string, quote string) string
type Blueprint ¶
type Blueprint struct {
Dialect dialect.Dialect
Columns []*Column
Commands []*Command
Grammar Grammar
Builder Builder
Name string
CharsetVal string
CollationVal string
EngineVal string
CommentVal string
TemporaryVal bool
AutoIncrementStartingValuesVal *int
// contains filtered or unexported fields
}
Blueprint represents a schema blueprint for creating or altering a database table.
func NewBlueprintForTesting ¶
NewBlueprintForTesting creates a new blueprint for testing purposes.
func (*Blueprint) AddImpliedCommands ¶
func (b *Blueprint) AddImpliedCommands()
func (*Blueprint) AutoIncrementStartingValues ¶
func (*Blueprint) BigIncrements ¶
func (b *Blueprint) BigIncrements(name string) ColumnDefinition
func (*Blueprint) BigInteger ¶
func (b *Blueprint) BigInteger(name string) ColumnDefinition
func (*Blueprint) Boolean ¶
func (b *Blueprint) Boolean(name string) ColumnDefinition
func (*Blueprint) Cidr ¶
func (b *Blueprint) Cidr(name string) ColumnDefinition
func (*Blueprint) Column ¶
func (b *Blueprint) Column(name string, columnType string) ColumnDefinition
func (*Blueprint) Date ¶
func (b *Blueprint) Date(name string) ColumnDefinition
func (*Blueprint) DateTime ¶
func (b *Blueprint) DateTime(name string, precision ...int) ColumnDefinition
func (*Blueprint) DateTimeTz ¶
func (b *Blueprint) DateTimeTz(name string, precision ...int) ColumnDefinition
func (*Blueprint) Decimal ¶
func (b *Blueprint) Decimal(name string, params ...int) ColumnDefinition
func (*Blueprint) Double ¶
func (b *Blueprint) Double(name string) ColumnDefinition
func (*Blueprint) DropColumn ¶
func (*Blueprint) DropConstrainedForeignID ¶ added in v0.4.2
func (*Blueprint) DropForeign ¶
func (*Blueprint) DropFulltext ¶
func (*Blueprint) DropIfExists ¶
func (b *Blueprint) DropIfExists()
func (*Blueprint) DropMorphs ¶ added in v0.4.2
func (*Blueprint) DropPrimary ¶
func (*Blueprint) DropSoftDeletes ¶ added in v0.4.2
func (*Blueprint) DropSoftDeletesTz ¶ added in v0.4.2
func (*Blueprint) DropSpatialIndex ¶ added in v0.4.2
func (*Blueprint) DropTimestamps ¶
func (b *Blueprint) DropTimestamps()
func (*Blueprint) DropTimestampsTz ¶
func (b *Blueprint) DropTimestampsTz()
func (*Blueprint) DropUnique ¶
func (*Blueprint) Foreign ¶
func (b *Blueprint) Foreign(column string) ForeignKeyDefinition
func (*Blueprint) ForeignColumns ¶
func (b *Blueprint) ForeignColumns(columns ...string) ForeignKeyDefinition
func (*Blueprint) ForeignID ¶ added in v0.4.2
func (b *Blueprint) ForeignID(name string) ForeignIDColumnDefinition
func (*Blueprint) ForeignULID ¶ added in v0.4.2
func (b *Blueprint) ForeignULID(name string, length ...int) ForeignIDColumnDefinition
func (*Blueprint) ForeignUUID ¶ added in v0.4.2
func (b *Blueprint) ForeignUUID(name string) ForeignIDColumnDefinition
func (*Blueprint) FullText ¶
func (b *Blueprint) FullText(column string, otherColumns ...string) IndexDefinition
func (*Blueprint) Geography ¶
func (b *Blueprint) Geography(name string, subtype string, srid ...int) ColumnDefinition
func (*Blueprint) Geometry ¶
func (b *Blueprint) Geometry(name string, subtype string, srid ...int) ColumnDefinition
func (*Blueprint) GetAddedColumns ¶
func (*Blueprint) GetChangedColumns ¶
func (*Blueprint) GetFluentStatements ¶
func (*Blueprint) ID ¶
func (b *Blueprint) ID(name ...string) ColumnDefinition
func (*Blueprint) IPAddress ¶
func (b *Blueprint) IPAddress(name string) ColumnDefinition
func (*Blueprint) Increments ¶
func (b *Blueprint) Increments(name string) ColumnDefinition
func (*Blueprint) Index ¶
func (b *Blueprint) Index(column string, otherColumns ...string) IndexDefinition
func (*Blueprint) Inet ¶
func (b *Blueprint) Inet(name string) ColumnDefinition
func (*Blueprint) Integer ¶
func (b *Blueprint) Integer(name string) ColumnDefinition
func (*Blueprint) IntegerIncrements ¶ added in v0.4.2
func (b *Blueprint) IntegerIncrements(name string) ColumnDefinition
func (*Blueprint) IsCreating ¶
func (*Blueprint) JSON ¶
func (b *Blueprint) JSON(name string) ColumnDefinition
func (*Blueprint) JSONB ¶
func (b *Blueprint) JSONB(name string) ColumnDefinition
func (*Blueprint) LongText ¶
func (b *Blueprint) LongText(name string) ColumnDefinition
func (*Blueprint) MacAddr ¶
func (b *Blueprint) MacAddr(name string) ColumnDefinition
func (*Blueprint) MacAddr8 ¶
func (b *Blueprint) MacAddr8(name string) ColumnDefinition
func (*Blueprint) MacAddress ¶
func (b *Blueprint) MacAddress(name string) ColumnDefinition
func (*Blueprint) MediumIncrements ¶
func (b *Blueprint) MediumIncrements(name string) ColumnDefinition
func (*Blueprint) MediumInteger ¶
func (b *Blueprint) MediumInteger(name string) ColumnDefinition
func (*Blueprint) MediumText ¶
func (b *Blueprint) MediumText(name string) ColumnDefinition
func (*Blueprint) NullableMorphs ¶ added in v0.4.2
func (*Blueprint) NullableNumericMorphs ¶ added in v0.4.2
func (*Blueprint) NullableTimestamps ¶ added in v0.4.2
func (*Blueprint) NullableTimestampsTz ¶ added in v0.4.2
func (*Blueprint) NullableULIDMorphs ¶ added in v0.4.2
func (*Blueprint) NullableUUIDMorphs ¶ added in v0.4.2
func (*Blueprint) NumericMorphs ¶ added in v0.4.2
func (*Blueprint) Primary ¶
func (b *Blueprint) Primary(column string, otherColumns ...string) IndexDefinition
func (*Blueprint) RawColumn ¶ added in v0.4.2
func (b *Blueprint) RawColumn(name string, definition string) ColumnDefinition
func (*Blueprint) RawIndex ¶ added in v0.4.2
func (b *Blueprint) RawIndex(expression string, name string) IndexDefinition
func (*Blueprint) RemoveColumn ¶ added in v0.4.2
func (*Blueprint) RenameColumn ¶
func (*Blueprint) RenameIndex ¶
func (*Blueprint) SetBuilder ¶
func (*Blueprint) SetDialect ¶
func (*Blueprint) SetGrammar ¶
func (*Blueprint) SmallIncrements ¶
func (b *Blueprint) SmallIncrements(name string) ColumnDefinition
func (*Blueprint) SmallInteger ¶
func (b *Blueprint) SmallInteger(name string) ColumnDefinition
func (*Blueprint) SoftDeletes ¶ added in v0.4.2
func (b *Blueprint) SoftDeletes(name string, precision ...int) ColumnDefinition
func (*Blueprint) SoftDeletesDatetime ¶ added in v0.4.2
func (b *Blueprint) SoftDeletesDatetime(name string, precision ...int) ColumnDefinition
func (*Blueprint) SoftDeletesTz ¶ added in v0.4.2
func (b *Blueprint) SoftDeletesTz(name string, precision ...int) ColumnDefinition
func (*Blueprint) SpatialIndex ¶ added in v0.4.2
func (b *Blueprint) SpatialIndex(column string, otherColumns ...string) IndexDefinition
func (*Blueprint) TSVector ¶
func (b *Blueprint) TSVector(name string) ColumnDefinition
func (*Blueprint) Text ¶
func (b *Blueprint) Text(name string) ColumnDefinition
func (*Blueprint) TimeTz ¶
func (b *Blueprint) TimeTz(name string, precision ...int) ColumnDefinition
func (*Blueprint) Timestamp ¶
func (b *Blueprint) Timestamp(name string, precision ...int) ColumnDefinition
func (*Blueprint) TimestampTz ¶
func (b *Blueprint) TimestampTz(name string, precision ...int) ColumnDefinition
func (*Blueprint) Timestamps ¶
func (*Blueprint) TimestampsTz ¶
func (*Blueprint) TinyIncrements ¶
func (b *Blueprint) TinyIncrements(name string) ColumnDefinition
func (*Blueprint) TinyInteger ¶
func (b *Blueprint) TinyInteger(name string) ColumnDefinition
func (*Blueprint) TinyText ¶
func (b *Blueprint) TinyText(name string) ColumnDefinition
func (*Blueprint) ULID ¶
func (b *Blueprint) ULID(name string) ColumnDefinition
func (*Blueprint) ULIDMorphs ¶ added in v0.4.2
func (*Blueprint) UUID ¶
func (b *Blueprint) UUID(name string) ColumnDefinition
func (*Blueprint) UUIDMorphs ¶ added in v0.4.2
func (*Blueprint) Unique ¶
func (b *Blueprint) Unique(column string, otherColumns ...string) IndexDefinition
func (*Blueprint) UnsignedBigInteger ¶
func (b *Blueprint) UnsignedBigInteger(name string) ColumnDefinition
func (*Blueprint) UnsignedInteger ¶
func (b *Blueprint) UnsignedInteger(name string) ColumnDefinition
func (*Blueprint) UnsignedMediumInteger ¶
func (b *Blueprint) UnsignedMediumInteger(name string) ColumnDefinition
func (*Blueprint) UnsignedSmallInteger ¶
func (b *Blueprint) UnsignedSmallInteger(name string) ColumnDefinition
func (*Blueprint) UnsignedTinyInteger ¶
func (b *Blueprint) UnsignedTinyInteger(name string) ColumnDefinition
func (*Blueprint) Vector ¶
func (b *Blueprint) Vector(name string, dimensions ...int) ColumnDefinition
func (*Blueprint) VectorIndex ¶ added in v0.4.2
func (b *Blueprint) VectorIndex(column string) IndexDefinition
func (*Blueprint) Year ¶
func (b *Blueprint) Year(name string) ColumnDefinition
type Column ¶
type Column struct {
Commands []string
Name string
RenameToVal string
ColumnType string
CharsetVal *string
CollationVal *string
CommentVal *string
DefaultValue any
OnUpdateValue any
UseCurrentVal bool
UseCurrentOnUpdateVal bool
NullableVal *bool
AutoIncrementVal *bool
UnsignedVal *bool
PrimaryVal *bool
IndexVal *bool
IndexName string
UniqueVal *bool
UniqueName string
Length *int
Precision *int
Total *int
Places *int
ChangeVal bool
Allowed []string // for enum type columns
Subtype *string // for geography and geometry types
Srid *int // for geography and geometry types
AfterVal *string
FirstVal bool
FixedVal *bool
RawDefinition *string
VirtualAsVal *string
StoredAsVal *string
InvisibleVal *bool
GeneratedAsVal *string
AlwaysVal *bool
}
Column represents a database column definition in a blueprint.
func (*Column) AddCommand ¶
func (*Column) After ¶
func (c *Column) After(column string) ColumnDefinition
func (*Column) Always ¶
func (c *Column) Always(value ...bool) ColumnDefinition
func (*Column) AutoIncrement ¶
func (c *Column) AutoIncrement() ColumnDefinition
func (*Column) Change ¶
func (c *Column) Change() ColumnDefinition
func (*Column) Charset ¶
func (c *Column) Charset(charset string) ColumnDefinition
func (*Column) Collation ¶
func (c *Column) Collation(collation string) ColumnDefinition
func (*Column) Comment ¶
func (c *Column) Comment(comment string) ColumnDefinition
func (*Column) Default ¶
func (c *Column) Default(value any) ColumnDefinition
func (*Column) First ¶
func (c *Column) First() ColumnDefinition
func (*Column) Fixed ¶ added in v0.4.2
func (c *Column) Fixed() ColumnDefinition
func (*Column) GeneratedAs ¶
func (c *Column) GeneratedAs(expression ...string) ColumnDefinition
func (*Column) HasCommand ¶
func (*Column) Index ¶
func (c *Column) Index(params ...any) ColumnDefinition
func (*Column) Invisible ¶
func (c *Column) Invisible() ColumnDefinition
func (*Column) Nullable ¶
func (c *Column) Nullable(value ...bool) ColumnDefinition
func (*Column) OnUpdate ¶
func (c *Column) OnUpdate(value any) ColumnDefinition
func (*Column) Primary ¶
func (c *Column) Primary(value ...bool) ColumnDefinition
func (*Column) RenameTo ¶
func (c *Column) RenameTo(name string) ColumnDefinition
func (*Column) StoredAs ¶
func (c *Column) StoredAs(expression string) ColumnDefinition
func (*Column) Unique ¶
func (c *Column) Unique(params ...any) ColumnDefinition
func (*Column) Unsigned ¶
func (c *Column) Unsigned() ColumnDefinition
func (*Column) UseCurrent ¶
func (c *Column) UseCurrent() ColumnDefinition
func (*Column) UseCurrentOnUpdate ¶
func (c *Column) UseCurrentOnUpdate() ColumnDefinition
func (*Column) VirtualAs ¶
func (c *Column) VirtualAs(expression string) ColumnDefinition
type ColumnDefinition ¶
type ColumnDefinition interface {
AutoIncrement() ColumnDefinition
Change() ColumnDefinition
Charset(charset string) ColumnDefinition
Collation(collation string) ColumnDefinition
Comment(comment string) ColumnDefinition
Default(value any) ColumnDefinition
Fixed() ColumnDefinition
Index(params ...any) ColumnDefinition
Nullable(value ...bool) ColumnDefinition
OnUpdate(value any) ColumnDefinition
Primary(value ...bool) ColumnDefinition
Unique(params ...any) ColumnDefinition
Unsigned() ColumnDefinition
UseCurrent() ColumnDefinition
UseCurrentOnUpdate() ColumnDefinition
After(column string) ColumnDefinition
First() ColumnDefinition
VirtualAs(expression string) ColumnDefinition
StoredAs(expression string) ColumnDefinition
Invisible() ColumnDefinition
GeneratedAs(expression ...string) ColumnDefinition
Always(value ...bool) ColumnDefinition
RenameTo(name string) ColumnDefinition
}
ColumnDefinition defines the interface for defining a column in a database table.
type Command ¶
type Command struct {
Name string
To string
From string
Column *Column
Columns []string
Algorithm string
OperatorClass string
On string
OnDelete string
OnUpdate string
References []string
Index string
Comment string
Value int
Deferrable *bool
InitiallyImmediate *bool
Language string
}
Command represents a database command to be executed in a blueprint.
type Expression ¶
type Expression string
Expression is a type for expressions that can be used as default values for columns.
func (Expression) String ¶
func (e Expression) String() string
type ForeignIDColumnDefinition ¶ added in v0.4.2
type ForeignIDColumnDefinition interface {
ColumnDefinition
Constrained(table ...string) ForeignKeyDefinition
}
ForeignIDColumnDefinition extends ColumnDefinition with FK constraint helpers.
type ForeignKeyDefinition ¶
type ForeignKeyDefinition interface {
References(columns ...string) ForeignKeyDefinition
On(table string) ForeignKeyDefinition
OnDelete(action string) ForeignKeyDefinition
OnUpdate(action string) ForeignKeyDefinition
Name(name string) ForeignKeyDefinition
CascadeOnDelete() ForeignKeyDefinition
CascadeOnUpdate() ForeignKeyDefinition
RestrictOnDelete() ForeignKeyDefinition
RestrictOnUpdate() ForeignKeyDefinition
NullOnDelete() ForeignKeyDefinition
NullOnUpdate() ForeignKeyDefinition
NoActionOnDelete() ForeignKeyDefinition
NoActionOnUpdate() ForeignKeyDefinition
Deferrable(deferrable ...bool) ForeignKeyDefinition
InitiallyImmediate(immediate ...bool) ForeignKeyDefinition
}
type Grammar ¶
type Grammar interface {
CompileTableExists(schema string, table string) (string, error)
CompileTables(schema string) (string, error)
CompileColumns(schema, table string) (string, error)
CompileIndexes(schema, table string) (string, error)
CompileCreate(bp *Blueprint) (string, error)
CompileAdd(bp *Blueprint) (string, error)
CompileChange(bp *Blueprint, command *Command) (string, error)
CompileDrop(bp *Blueprint) (string, error)
CompileDropIfExists(bp *Blueprint) (string, error)
CompileRename(bp *Blueprint, command *Command) (string, error)
CompileDropColumn(blueprint *Blueprint, command *Command) (string, error)
CompileRenameColumn(blueprint *Blueprint, command *Command) (string, error)
CompileIndex(blueprint *Blueprint, command *Command) (string, error)
CompileUnique(blueprint *Blueprint, command *Command) (string, error)
CompilePrimary(blueprint *Blueprint, command *Command) (string, error)
CompileFullText(blueprint *Blueprint, command *Command) (string, error)
CompileSpatialIndex(blueprint *Blueprint, command *Command) (string, error)
CompileVectorIndex(blueprint *Blueprint, command *Command) (string, error)
CompileDropIndex(blueprint *Blueprint, command *Command) (string, error)
CompileDropUnique(blueprint *Blueprint, command *Command) (string, error)
CompileDropFulltext(blueprint *Blueprint, command *Command) (string, error)
CompileDropPrimary(blueprint *Blueprint, command *Command) (string, error)
CompileDropSpatialIndex(blueprint *Blueprint, command *Command) (string, error)
CompileRenameIndex(blueprint *Blueprint, command *Command) (string, error)
CompileForeign(blueprint *Blueprint, command *Command) (string, error)
CompileDropForeign(blueprint *Blueprint, command *Command) (string, error)
CompileTableComment(blueprint *Blueprint, command *Command) (string, error)
CompileAutoIncrementStartingValues(blueprint *Blueprint, command *Command) (string, error)
GetFluentCommands() []func(blueprint *Blueprint, command *Command) string
GetTableFluentCommands() []func(blueprint *Blueprint) string
CreateIndexName(blueprint *Blueprint, idxType string, columns ...string) string
GetType(column *Column) string
}
type IndexDefinition ¶
type IndexDefinition interface {
Name(name string) IndexDefinition
Algorithm(algorithm string) IndexDefinition
Deferrable(deferrable ...bool) IndexDefinition
InitiallyImmediate(immediate ...bool) IndexDefinition
Language(language string) IndexDefinition
}
Click to show internal directories.
Click to hide internal directories.