Help us shape the future of Go! Take the 2026 Go Developer Survey

schema

package
v1.20.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandAdd          = "add"
	CommandComment      = "comment"
	CommandCreate       = "create"
	CommandDefault      = "default"
	CommandDrop         = "drop"
	CommandDropColumn   = "dropColumn"
	CommandDropForeign  = "dropForeign"
	CommandDropFullText = "dropFullText"
	CommandDropIfExists = "dropIfExists"
	CommandDropIndex    = "dropIndex"
	CommandDropPrimary  = "dropPrimary"
	CommandDropUnique   = "dropUnique"
	CommandForeign      = "foreign"
	CommandFullText     = "fullText"
	CommandIndex        = "index"
	CommandPrimary      = "primary"
	CommandRename       = "rename"
	CommandRenameColumn = "renameColumn"
	CommandRenameIndex  = "renameIndex"
	CommandTableComment = "tableComment"
	CommandUnique       = "unique"
	DefaultStringLength = 255
	DefaultUlidLength   = 26
)

Variables

This section is empty.

Functions

func ColumnDefaultValue

func ColumnDefaultValue(def any) string

func ColumnType

func ColumnType(grammar driver.Grammar, column driver.ColumnDefinition) string

func MorphUsingInts

func MorphUsingInts()

MorphUsingInts sets the default morph key type to int (default)

func MorphUsingUlids

func MorphUsingUlids()

MorphUsingUlids sets the default morph key type to ULID

func MorphUsingUuids

func MorphUsingUuids()

MorphUsingUuids sets the default morph key type to UUID

func NewColumnDefinition

func NewColumnDefinition(name string, ttype string) driver.ColumnDefinition

func NewForeignKeyDefinition

func NewForeignKeyDefinition(command *driver.Command) schema.ForeignKeyDefinition

func NewIndexDefinition

func NewIndexDefinition(command *driver.Command) schema.IndexDefinition

func SetDefaultMorphKeyType

func SetDefaultMorphKeyType(keyType MorphKeyType)

SetDefaultMorphKeyType sets the default morph key type

func SetDefaultStringLength

func SetDefaultStringLength(length int) error

func SetDefaultTimePrecision

func SetDefaultTimePrecision(precision int) error

Types

type Blueprint

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

func NewBlueprint

func NewBlueprint(schema schema.Schema, prefix, table string) *Blueprint

func (*Blueprint) BigIncrements

func (r *Blueprint) BigIncrements(column string) driver.ColumnDefinition

func (*Blueprint) BigInteger

func (r *Blueprint) BigInteger(column string) driver.ColumnDefinition

func (*Blueprint) Binary

func (r *Blueprint) Binary(column string, length ...int) driver.ColumnDefinition

func (*Blueprint) Boolean

func (r *Blueprint) Boolean(column string) driver.ColumnDefinition

func (*Blueprint) Build

func (r *Blueprint) Build(query orm.Query, grammar driver.Grammar) error

func (*Blueprint) Char

func (r *Blueprint) Char(column string, length ...int) driver.ColumnDefinition

func (*Blueprint) Charset

func (r *Blueprint) Charset(charset string)

func (*Blueprint) Collation

func (r *Blueprint) Collation(collation string)

func (*Blueprint) Column

func (r *Blueprint) Column(column, ttype string) driver.ColumnDefinition

func (*Blueprint) Comment

func (r *Blueprint) Comment(comment string)

func (*Blueprint) CompileStatements

func (r *Blueprint) CompileStatements(grammar driver.Grammar) ([]driver.SchemaStatement, error)

func (*Blueprint) Computed

func (r *Blueprint) Computed(column string, expression any) driver.ColumnDefinition

func (*Blueprint) Create

func (r *Blueprint) Create()

func (*Blueprint) Date

func (r *Blueprint) Date(column string) driver.ColumnDefinition

func (*Blueprint) DateTime

func (r *Blueprint) DateTime(column string, precision ...int) driver.ColumnDefinition

func (*Blueprint) DateTimeTz

func (r *Blueprint) DateTimeTz(column string, precision ...int) driver.ColumnDefinition

func (*Blueprint) DateTimes

func (r *Blueprint) DateTimes(precision ...int)

func (*Blueprint) Decimal

func (r *Blueprint) Decimal(column string) driver.ColumnDefinition

func (*Blueprint) DescribeBlueprint

func (r *Blueprint) DescribeBlueprint() driver.BlueprintDescription

func (*Blueprint) Double

func (r *Blueprint) Double(column string) driver.ColumnDefinition

func (*Blueprint) Drop

func (r *Blueprint) Drop()

func (*Blueprint) DropColumn

func (r *Blueprint) DropColumn(column ...string)

func (*Blueprint) DropConstrainedForeignId

func (r *Blueprint) DropConstrainedForeignId(column string)

func (*Blueprint) DropForeign

func (r *Blueprint) DropForeign(column ...string)

func (*Blueprint) DropForeignByName

func (r *Blueprint) DropForeignByName(name string)

func (*Blueprint) DropFullText

func (r *Blueprint) DropFullText(column ...string)

func (*Blueprint) DropFullTextByName

func (r *Blueprint) DropFullTextByName(name string)

func (*Blueprint) DropIfExists

func (r *Blueprint) DropIfExists()

func (*Blueprint) DropIndex

func (r *Blueprint) DropIndex(column ...string)

func (*Blueprint) DropIndexByName

func (r *Blueprint) DropIndexByName(name string)

func (*Blueprint) DropMorphs

func (r *Blueprint) DropMorphs(name string, indexName ...string)

func (*Blueprint) DropPrimary

func (r *Blueprint) DropPrimary(column ...string)

func (*Blueprint) DropRememberToken

func (r *Blueprint) DropRememberToken()

func (*Blueprint) DropSoftDeletes

func (r *Blueprint) DropSoftDeletes(column ...string)

func (*Blueprint) DropSoftDeletesTz

func (r *Blueprint) DropSoftDeletesTz(column ...string)

func (*Blueprint) DropSpatialIndex

func (r *Blueprint) DropSpatialIndex(columns ...string)

func (*Blueprint) DropTimestamps

func (r *Blueprint) DropTimestamps()

func (*Blueprint) DropTimestampsTz

func (r *Blueprint) DropTimestampsTz()

func (*Blueprint) DropUnique

func (r *Blueprint) DropUnique(column ...string)

func (*Blueprint) DropUniqueByName

func (r *Blueprint) DropUniqueByName(name string)

func (*Blueprint) Engine

func (r *Blueprint) Engine(engine string)

func (*Blueprint) Enum

func (r *Blueprint) Enum(column string, allowed []any) driver.ColumnDefinition

func (*Blueprint) Float

func (r *Blueprint) Float(column string, precision ...int) driver.ColumnDefinition

func (*Blueprint) Foreign

func (r *Blueprint) Foreign(column ...string) schema.ForeignKeyDefinition

func (*Blueprint) ForeignID

func (r *Blueprint) ForeignID(column string) schema.ForeignIDColumnDefinition

func (*Blueprint) ForeignUlid

func (r *Blueprint) ForeignUlid(column string, length ...int) schema.ForeignIDColumnDefinition

func (*Blueprint) ForeignUuid

func (r *Blueprint) ForeignUuid(column string) schema.ForeignIDColumnDefinition

func (*Blueprint) FullText

func (r *Blueprint) FullText(column ...string) schema.IndexDefinition

func (*Blueprint) Geography

func (r *Blueprint) Geography(column string, options ...any) driver.ColumnDefinition

func (*Blueprint) Geometry

func (r *Blueprint) Geometry(column string, options ...any) driver.ColumnDefinition

func (*Blueprint) GetAddedColumns

func (r *Blueprint) GetAddedColumns() []driver.ColumnDefinition

func (*Blueprint) GetCommands

func (r *Blueprint) GetCommands() []*driver.Command

func (*Blueprint) GetTableName

func (r *Blueprint) GetTableName() string

func (*Blueprint) HasCommand

func (r *Blueprint) HasCommand(command string) bool

func (*Blueprint) ID

func (r *Blueprint) ID(column ...string) driver.ColumnDefinition

func (*Blueprint) Increments

func (r *Blueprint) Increments(column string) driver.ColumnDefinition

func (*Blueprint) Index

func (r *Blueprint) Index(column ...string) schema.IndexDefinition

func (*Blueprint) InnoDb

func (r *Blueprint) InnoDb()

func (*Blueprint) Integer

func (r *Blueprint) Integer(column string) driver.ColumnDefinition

func (*Blueprint) IntegerIncrements

func (r *Blueprint) IntegerIncrements(column string) driver.ColumnDefinition

func (*Blueprint) IpAddress

func (r *Blueprint) IpAddress(column string) driver.ColumnDefinition

func (*Blueprint) Json

func (r *Blueprint) Json(column string) driver.ColumnDefinition

func (*Blueprint) Jsonb

func (r *Blueprint) Jsonb(column string) driver.ColumnDefinition

func (*Blueprint) LongText

func (r *Blueprint) LongText(column string) driver.ColumnDefinition

func (*Blueprint) MacAddress

func (r *Blueprint) MacAddress(column string) driver.ColumnDefinition

func (*Blueprint) MediumIncrements

func (r *Blueprint) MediumIncrements(column string) driver.ColumnDefinition

func (*Blueprint) MediumInteger

func (r *Blueprint) MediumInteger(column string) driver.ColumnDefinition

func (*Blueprint) MediumText

func (r *Blueprint) MediumText(column string) driver.ColumnDefinition

func (*Blueprint) Morphs

func (r *Blueprint) Morphs(name string, indexName ...string)

func (*Blueprint) NullableMorphs

func (r *Blueprint) NullableMorphs(name string, indexName ...string)

func (*Blueprint) NullableNumericMorphs

func (r *Blueprint) NullableNumericMorphs(name string, indexName ...string)

func (*Blueprint) NullableTimestamps

func (r *Blueprint) NullableTimestamps(precision ...int)

func (*Blueprint) NullableTimestampsTz

func (r *Blueprint) NullableTimestampsTz(precision ...int)

func (*Blueprint) NullableUlidMorphs

func (r *Blueprint) NullableUlidMorphs(name string, indexName ...string)

func (*Blueprint) NullableUuidMorphs

func (r *Blueprint) NullableUuidMorphs(name string, indexName ...string)

func (*Blueprint) NumericMorphs

func (r *Blueprint) NumericMorphs(name string, indexName ...string)

func (*Blueprint) Primary

func (r *Blueprint) Primary(column ...string)

func (*Blueprint) RawColumn

func (r *Blueprint) RawColumn(column, definition string) driver.ColumnDefinition

func (*Blueprint) RawIndex

func (r *Blueprint) RawIndex(expression, name string) contractsschema.IndexDefinition

func (*Blueprint) RememberToken

func (r *Blueprint) RememberToken() driver.ColumnDefinition

func (*Blueprint) Rename

func (r *Blueprint) Rename(to string)

func (*Blueprint) RenameColumn

func (r *Blueprint) RenameColumn(from, to string)

func (*Blueprint) RenameIndex

func (r *Blueprint) RenameIndex(from, to string)

func (*Blueprint) Set

func (r *Blueprint) Set(column string, allowed []any) driver.ColumnDefinition

func (*Blueprint) SetTable

func (r *Blueprint) SetTable(name string)

func (*Blueprint) SmallIncrements

func (r *Blueprint) SmallIncrements(column string) driver.ColumnDefinition

func (*Blueprint) SmallInteger

func (r *Blueprint) SmallInteger(column string) driver.ColumnDefinition

func (*Blueprint) SoftDeletes

func (r *Blueprint) SoftDeletes(column ...string) driver.ColumnDefinition

func (*Blueprint) SoftDeletesDatetime

func (r *Blueprint) SoftDeletesDatetime(column ...string)

func (*Blueprint) SoftDeletesTz

func (r *Blueprint) SoftDeletesTz(column ...string) driver.ColumnDefinition

func (*Blueprint) SpatialIndex

func (r *Blueprint) SpatialIndex(columns ...string) contractsschema.IndexDefinition

func (*Blueprint) String

func (r *Blueprint) String(column string, length ...int) driver.ColumnDefinition

func (*Blueprint) Temporary

func (r *Blueprint) Temporary()

func (*Blueprint) Text

func (r *Blueprint) Text(column string) driver.ColumnDefinition

func (*Blueprint) Time

func (r *Blueprint) Time(column string, precision ...int) driver.ColumnDefinition

func (*Blueprint) TimeTz

func (r *Blueprint) TimeTz(column string, precision ...int) driver.ColumnDefinition

func (*Blueprint) Timestamp

func (r *Blueprint) Timestamp(column string, precision ...int) driver.ColumnDefinition

func (*Blueprint) TimestampTz

func (r *Blueprint) TimestampTz(column string, precision ...int) driver.ColumnDefinition

func (*Blueprint) Timestamps

func (r *Blueprint) Timestamps(precision ...int)

func (*Blueprint) TimestampsTz

func (r *Blueprint) TimestampsTz(precision ...int)

func (*Blueprint) TinyIncrements

func (r *Blueprint) TinyIncrements(column string) driver.ColumnDefinition

func (*Blueprint) TinyInteger

func (r *Blueprint) TinyInteger(column string) driver.ColumnDefinition

func (*Blueprint) TinyText

func (r *Blueprint) TinyText(column string) driver.ColumnDefinition

func (*Blueprint) ToSql

func (r *Blueprint) ToSql(grammar driver.Grammar) ([]string, error)

func (*Blueprint) Ulid

func (r *Blueprint) Ulid(column string, length ...int) driver.ColumnDefinition

func (*Blueprint) UlidMorphs

func (r *Blueprint) UlidMorphs(name string, indexName ...string)

func (*Blueprint) Unique

func (r *Blueprint) Unique(column ...string) schema.IndexDefinition

func (*Blueprint) UnsignedBigInteger

func (r *Blueprint) UnsignedBigInteger(column string) driver.ColumnDefinition

func (*Blueprint) UnsignedInteger

func (r *Blueprint) UnsignedInteger(column string) driver.ColumnDefinition

func (*Blueprint) UnsignedMediumInteger

func (r *Blueprint) UnsignedMediumInteger(column string) driver.ColumnDefinition

func (*Blueprint) UnsignedSmallInteger

func (r *Blueprint) UnsignedSmallInteger(column string) driver.ColumnDefinition

func (*Blueprint) UnsignedTinyInteger

func (r *Blueprint) UnsignedTinyInteger(column string) driver.ColumnDefinition

func (*Blueprint) Uuid

func (r *Blueprint) Uuid(column string) driver.ColumnDefinition

func (*Blueprint) UuidMorphs

func (r *Blueprint) UuidMorphs(name string, indexName ...string)

func (*Blueprint) Vector

func (r *Blueprint) Vector(column string, dimensions ...int) driver.ColumnDefinition

func (*Blueprint) Year

func (r *Blueprint) Year(column string) driver.ColumnDefinition

type ColumnDefinition

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

func (*ColumnDefinition) After

func (*ColumnDefinition) Always

func (*ColumnDefinition) AutoIncrement

func (r *ColumnDefinition) AutoIncrement() driver.ColumnDefinition

func (*ColumnDefinition) Change

func (*ColumnDefinition) Charset

func (r *ColumnDefinition) Charset(charset string) driver.ColumnDefinition

func (*ColumnDefinition) Collation

func (r *ColumnDefinition) Collation(collation string) driver.ColumnDefinition

func (*ColumnDefinition) Comment

func (r *ColumnDefinition) Comment(comment string) driver.ColumnDefinition

func (*ColumnDefinition) Default

func (r *ColumnDefinition) Default(def any) driver.ColumnDefinition

func (*ColumnDefinition) DescribeColumn

func (r *ColumnDefinition) DescribeColumn() driver.ColumnDescription

func (*ColumnDefinition) First

func (*ColumnDefinition) Fixed

func (*ColumnDefinition) From

func (*ColumnDefinition) GeneratedAs

func (r *ColumnDefinition) GeneratedAs(expression ...string) driver.ColumnDefinition

func (*ColumnDefinition) GetAfter

func (r *ColumnDefinition) GetAfter() string

func (*ColumnDefinition) GetAllowed

func (r *ColumnDefinition) GetAllowed() []any

func (*ColumnDefinition) GetAutoIncrement

func (r *ColumnDefinition) GetAutoIncrement() bool

func (*ColumnDefinition) GetComment

func (r *ColumnDefinition) GetComment() string

func (*ColumnDefinition) GetDefault

func (r *ColumnDefinition) GetDefault() any

func (*ColumnDefinition) GetGeneratedAs

func (r *ColumnDefinition) GetGeneratedAs() string

func (*ColumnDefinition) GetLength

func (r *ColumnDefinition) GetLength() int

func (*ColumnDefinition) GetName

func (r *ColumnDefinition) GetName() string

func (*ColumnDefinition) GetNullable

func (r *ColumnDefinition) GetNullable() bool

func (*ColumnDefinition) GetOnUpdate

func (r *ColumnDefinition) GetOnUpdate() any

func (*ColumnDefinition) GetPlaces

func (r *ColumnDefinition) GetPlaces() int

func (*ColumnDefinition) GetPrecision

func (r *ColumnDefinition) GetPrecision() int

func (*ColumnDefinition) GetTotal

func (r *ColumnDefinition) GetTotal() int

func (*ColumnDefinition) GetType

func (r *ColumnDefinition) GetType() string

func (*ColumnDefinition) GetUnsigned

func (r *ColumnDefinition) GetUnsigned() bool

func (*ColumnDefinition) GetUseCurrent

func (r *ColumnDefinition) GetUseCurrent() bool

func (*ColumnDefinition) GetUseCurrentOnUpdate

func (r *ColumnDefinition) GetUseCurrentOnUpdate() bool

func (*ColumnDefinition) Instant

func (*ColumnDefinition) Invisible

func (r *ColumnDefinition) Invisible() driver.ColumnDefinition

func (*ColumnDefinition) IsAlways

func (r *ColumnDefinition) IsAlways() bool

func (*ColumnDefinition) IsChange

func (r *ColumnDefinition) IsChange() bool

func (*ColumnDefinition) IsFirst

func (r *ColumnDefinition) IsFirst() bool

func (*ColumnDefinition) IsSetComment

func (r *ColumnDefinition) IsSetComment() bool

func (*ColumnDefinition) IsSetGeneratedAs

func (r *ColumnDefinition) IsSetGeneratedAs() bool

func (*ColumnDefinition) Nullable

func (r *ColumnDefinition) Nullable(nullable ...bool) driver.ColumnDefinition

func (*ColumnDefinition) OnUpdate

func (r *ColumnDefinition) OnUpdate(value any) driver.ColumnDefinition

func (*ColumnDefinition) Persisted

func (r *ColumnDefinition) Persisted() driver.ColumnDefinition

func (*ColumnDefinition) Places

func (r *ColumnDefinition) Places(places int) driver.ColumnDefinition

func (*ColumnDefinition) Srid

func (*ColumnDefinition) StartingValue

func (r *ColumnDefinition) StartingValue(value uint64) driver.ColumnDefinition

func (*ColumnDefinition) StoredAs

func (r *ColumnDefinition) StoredAs(expression any) driver.ColumnDefinition

func (*ColumnDefinition) Total

func (r *ColumnDefinition) Total(total int) driver.ColumnDefinition

func (*ColumnDefinition) Unsigned

func (*ColumnDefinition) UseCurrent

func (r *ColumnDefinition) UseCurrent() driver.ColumnDefinition

func (*ColumnDefinition) UseCurrentOnUpdate

func (r *ColumnDefinition) UseCurrentOnUpdate() driver.ColumnDefinition

func (*ColumnDefinition) VirtualAs

func (r *ColumnDefinition) VirtualAs(expression any) driver.ColumnDefinition

type Expression

type Expression string

func (Expression) SQL

func (e Expression) SQL() string

type ForeignIDColumnDefinition

type ForeignIDColumnDefinition struct {
	*ColumnDefinition
	// contains filtered or unexported fields
}

func (*ForeignIDColumnDefinition) Constrained

func (r *ForeignIDColumnDefinition) Constrained(table, column, indexName string) schema.ForeignKeyDefinition

func (*ForeignIDColumnDefinition) References

func (r *ForeignIDColumnDefinition) References(column, indexName string) schema.ForeignKeyDefinition

type ForeignKeyDefinition

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

func (*ForeignKeyDefinition) CascadeOnDelete

func (r *ForeignKeyDefinition) CascadeOnDelete() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) CascadeOnUpdate

func (r *ForeignKeyDefinition) CascadeOnUpdate() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) Name

func (*ForeignKeyDefinition) NoActionOnDelete

func (r *ForeignKeyDefinition) NoActionOnDelete() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) NoActionOnUpdate

func (r *ForeignKeyDefinition) NoActionOnUpdate() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) NullOnDelete

func (*ForeignKeyDefinition) On

func (*ForeignKeyDefinition) References

func (r *ForeignKeyDefinition) References(columns ...string) schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) RestrictOnDelete

func (r *ForeignKeyDefinition) RestrictOnDelete() schema.ForeignKeyDefinition

func (*ForeignKeyDefinition) RestrictOnUpdate

func (r *ForeignKeyDefinition) RestrictOnUpdate() schema.ForeignKeyDefinition

type IndexDefinition

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

func (*IndexDefinition) Algorithm

func (r *IndexDefinition) Algorithm(algorithm string) schema.IndexDefinition

func (*IndexDefinition) Deferrable

func (r *IndexDefinition) Deferrable() schema.IndexDefinition

func (*IndexDefinition) InitiallyImmediate

func (r *IndexDefinition) InitiallyImmediate() schema.IndexDefinition

func (*IndexDefinition) Language

func (r *IndexDefinition) Language(name string) schema.IndexDefinition

func (*IndexDefinition) Name

type MorphKeyType

type MorphKeyType string

MorphKeyType represents the type of key used for morph relationships

const (
	MorphKeyTypeInt  MorphKeyType = "int"
	MorphKeyTypeUuid MorphKeyType = "uuid"
	MorphKeyTypeUlid MorphKeyType = "ulid"
)

func GetDefaultMorphKeyType

func GetDefaultMorphKeyType() MorphKeyType

GetDefaultMorphKeyType returns the current default morph key type

type Schema

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

func NewSchema

func NewSchema(config config.Config, log log.Log, orm contractsorm.Orm, databaseDriver driver.Driver, migrations []contractsschema.Migration, connections ...contractsdb.DB) (*Schema, error)

func (*Schema) Connection

func (r *Schema) Connection(name string) contractsschema.Schema

func (*Schema) Create

func (r *Schema) Create(table string, callback func(table contractsschema.Blueprint)) error

func (*Schema) CreateDatabase

func (r *Schema) CreateDatabase(name string) error

func (*Schema) DB

func (r *Schema) DB() db.Tx

func (*Schema) DefaultStringLength

func (r *Schema) DefaultStringLength(length int) error

func (*Schema) DefaultTimePrecision

func (r *Schema) DefaultTimePrecision(precision int) error

func (*Schema) DisableForeignKeyConstraints

func (r *Schema) DisableForeignKeyConstraints() error

func (*Schema) Drop

func (r *Schema) Drop(table string) error

func (*Schema) DropAllTables

func (r *Schema) DropAllTables() error

func (*Schema) DropAllTypes

func (r *Schema) DropAllTypes() error

func (*Schema) DropAllViews

func (r *Schema) DropAllViews() error

func (*Schema) DropColumns

func (r *Schema) DropColumns(table string, columns []string) error

func (*Schema) DropDatabaseIfExists

func (r *Schema) DropDatabaseIfExists(name string) error

func (*Schema) DropIfExists

func (r *Schema) DropIfExists(table string) error

func (*Schema) EnableForeignKeyConstraints

func (r *Schema) EnableForeignKeyConstraints() error

func (*Schema) Extend

func (*Schema) GetColumnListing

func (r *Schema) GetColumnListing(table string) []string

func (*Schema) GetColumnType

func (r *Schema) GetColumnType(table, column string, fullDefinition ...bool) (string, error)

func (*Schema) GetColumns

func (r *Schema) GetColumns(table string) ([]driver.Column, error)

func (*Schema) GetColumnsMetadata

func (r *Schema) GetColumnsMetadata(table string) ([]driver.ColumnMetadata, error)

func (*Schema) GetConnection

func (r *Schema) GetConnection() string

func (*Schema) GetCurrentSchemaListing

func (r *Schema) GetCurrentSchemaListing() ([]string, error)

func (*Schema) GetCurrentSchemaName

func (r *Schema) GetCurrentSchemaName() (string, error)

func (*Schema) GetForeignKeys

func (r *Schema) GetForeignKeys(table string) ([]driver.ForeignKey, error)

func (*Schema) GetIndexListing

func (r *Schema) GetIndexListing(table string) []string

func (*Schema) GetIndexes

func (r *Schema) GetIndexes(table string) ([]driver.Index, error)

func (*Schema) GetModel

func (r *Schema) GetModel(name string) any

GetModel retrieves a registered model by name. If the name doesn't contain a package (no dot), it automatically prepends "models." to the name. Returns nil if the model is not found in the registry.

func (*Schema) GetSchemas

func (r *Schema) GetSchemas() ([]driver.Schema, error)

func (*Schema) GetTableListing

func (r *Schema) GetTableListing(options ...any) []string

GetTableListing accepts Laravel's optional schema selector and schema-qualified flag.

func (*Schema) GetTables

func (r *Schema) GetTables(schemas ...string) ([]driver.Table, error)

func (*Schema) GetTypes

func (r *Schema) GetTypes(schemas ...string) ([]driver.Type, error)

func (*Schema) GetViews

func (r *Schema) GetViews(schemas ...string) ([]driver.View, error)

func (*Schema) GoTypes

func (r *Schema) GoTypes() []contractsschema.GoType

func (*Schema) HasColumn

func (r *Schema) HasColumn(table, column string) bool

func (*Schema) HasColumns

func (r *Schema) HasColumns(table string, columns []string) bool

func (*Schema) HasIndex

func (r *Schema) HasIndex(table string, index any, indexType ...string) bool

func (*Schema) HasTable

func (r *Schema) HasTable(reference string) bool

func (*Schema) HasType

func (r *Schema) HasType(name string) bool

func (*Schema) HasView

func (r *Schema) HasView(table string) bool

func (*Schema) Migrations

func (r *Schema) Migrations() []contractsschema.Migration

func (*Schema) Orm

func (r *Schema) Orm() contractsorm.Orm

func (*Schema) Prune

func (r *Schema) Prune() error

func (*Schema) Register

func (r *Schema) Register(migrations []contractsschema.Migration)

func (*Schema) Rename

func (r *Schema) Rename(from, to string) error

func (*Schema) SetConnection

func (r *Schema) SetConnection(name string)

func (*Schema) Sql

func (r *Schema) Sql(sql string, bindings ...any) error

func (*Schema) Table

func (r *Schema) Table(table string, callback func(table contractsschema.Blueprint)) error

func (*Schema) WhenTableDoesntHaveColumn

func (r *Schema) WhenTableDoesntHaveColumn(table, column string, callback func(contractsschema.Blueprint)) error

func (*Schema) WhenTableDoesntHaveIndex

func (r *Schema) WhenTableDoesntHaveIndex(table string, index any, callback func(contractsschema.Blueprint), indexType ...string) error

func (*Schema) WhenTableHasColumn

func (r *Schema) WhenTableHasColumn(table, column string, callback func(contractsschema.Blueprint)) error

func (*Schema) WhenTableHasIndex

func (r *Schema) WhenTableHasIndex(table string, index any, callback func(contractsschema.Blueprint), indexType ...string) error

func (*Schema) WithWriteConnection

func (r *Schema) WithWriteConnection(callback func(contractsschema.Schema) error) error

func (*Schema) WithoutForeignKeyConstraints

func (r *Schema) WithoutForeignKeyConstraints(callback func(contractsschema.Schema) error) (err error)

The callback's schema owns the pinned connection and restores its previous setting on exit.

type Wrap

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

func NewWrap

func NewWrap(prefix string) *Wrap

func (*Wrap) Column

func (r *Wrap) Column(column string) string

func (*Wrap) Columnize

func (r *Wrap) Columnize(columns []string) string

func (*Wrap) Columns

func (r *Wrap) Columns(columns []string) []string

func (*Wrap) GetPrefix

func (r *Wrap) GetPrefix() string

func (*Wrap) JsonFieldAndPath

func (r *Wrap) JsonFieldAndPath(column string) (string, string)

func (*Wrap) JsonPath

func (r *Wrap) JsonPath(value string) string

func (*Wrap) JsonPathAttributes

func (r *Wrap) JsonPathAttributes(path []string, quoter ...string) []string

func (*Wrap) Not

func (r *Wrap) Not(query string, isNot bool) string

func (*Wrap) PrefixArray

func (r *Wrap) PrefixArray(prefix string, values []string) []string

func (*Wrap) Quote

func (r *Wrap) Quote(value string) string

func (*Wrap) Quotes

func (r *Wrap) Quotes(value []string) []string

func (*Wrap) Segments

func (r *Wrap) Segments(segments []string) string

func (*Wrap) SetValueWrapper

func (r *Wrap) SetValueWrapper(wrapper func(string) string)

func (*Wrap) Table

func (r *Wrap) Table(table string) string

func (*Wrap) Value

func (r *Wrap) Value(value string) string

Jump to

Keyboard shortcuts

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