Documentation
¶
Index ¶
- type Aggregate
- type Attribute
- type AttributeMigrate
- type Attributer
- type Body
- type Config
- type Connection
- type DatabaseConfig
- func (c DatabaseConfig) ErrorHandler(ctx context.Context, err error) error
- func (c DatabaseConfig) ErrorQueryHandler(ctx context.Context, query Query) error
- func (c DatabaseConfig) InfoHandler(ctx context.Context, query Query)
- func (c *DatabaseConfig) Init(driverName string, errorTranslator func(err error) error)
- func (c DatabaseConfig) InitCallback() func() error
- func (c DatabaseConfig) Schemas() []string
- func (c *DatabaseConfig) SetInitCallback(f func() error)
- func (c *DatabaseConfig) SetSchemas(s []string)
- type Driver
- type FunctionType
- type GroupBy
- type IndexMigrate
- type Join
- type JoinArgument
- type Joins
- type Logger
- type ManyToSomeMigrate
- type Migrator
- type OneToSomeMigrate
- type Operation
- type OrderBy
- type PrimaryKeyMigrate
- type Query
- type QueryHeader
- type Row
- type Rows
- type SavePoint
- type Set
- type Table
- type TableMigrate
- type Transaction
- type ValueOperation
- type Where
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregate ¶
type Aggregate interface {
Aggregate() enum.AggregateType
}
type Attribute ¶
type Attribute struct {
Table string
Name string
AggregateType enum.AggregateType
FunctionType enum.FunctionType
}
type AttributeMigrate ¶
type Attributer ¶
type Config ¶
type Config interface {
Name() string
GetDatabaseConfig() *DatabaseConfig
}
type Connection ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Logger Logger
IncludeArguments bool // include all arguments used on query
QueryThreshold time.Duration // query threshold to warning on slow queries
// contains filtered or unexported fields
}
DatabaseConfig Database config used by all GOE drivers
func (DatabaseConfig) ErrorHandler ¶
func (c DatabaseConfig) ErrorHandler(ctx context.Context, err error) error
func (DatabaseConfig) ErrorQueryHandler ¶
func (c DatabaseConfig) ErrorQueryHandler(ctx context.Context, query Query) error
func (DatabaseConfig) InfoHandler ¶
func (c DatabaseConfig) InfoHandler(ctx context.Context, query Query)
func (*DatabaseConfig) Init ¶
func (c *DatabaseConfig) Init(driverName string, errorTranslator func(err error) error)
func (DatabaseConfig) InitCallback ¶
func (c DatabaseConfig) InitCallback() func() error
func (DatabaseConfig) Schemas ¶
func (c DatabaseConfig) Schemas() []string
func (*DatabaseConfig) SetInitCallback ¶
func (c *DatabaseConfig) SetInitCallback(f func() error)
func (*DatabaseConfig) SetSchemas ¶
func (c *DatabaseConfig) SetSchemas(s []string)
type Driver ¶
type Driver interface {
MigrateContext(context.Context, *Migrator) error
DropTable(schema, table string) error
DropColumn(schema, table, column string) error
RenameColumn(schema, table, oldColumn, newName string) error
RenameTable(schema, table, newName string) error
Init() error
AddLogger(Logger, error) error
KeywordHandler(string) string
NewConnection() Connection
NewTransaction(ctx context.Context, opts *sql.TxOptions) (Transaction, error)
Stats() sql.DBStats
Close() error
ErrorTranslator() func(err error) error
Config
}
type FunctionType ¶
type FunctionType interface {
GetType() enum.FunctionType
}
type IndexMigrate ¶
type IndexMigrate struct {
Name string
EscapingName string
Unique bool
Func string
Attributes []AttributeMigrate
}
type Join ¶
type Join struct {
Table Table
FirstArgument JoinArgument
JoinOperation enum.JoinType
SecondArgument JoinArgument
}
type JoinArgument ¶
type ManyToSomeMigrate ¶
type ManyToSomeMigrate struct {
TargetTable string
TargetColumn string
EscapingTargetTable string
EscapingTargetColumn string
TargetSchema *string
AttributeMigrate
}
ManyToSomeMigrate M2O/M2M relationship
func (ManyToSomeMigrate) EscapingTargetTableName ¶
func (m ManyToSomeMigrate) EscapingTargetTableName() string
EscapingTargetTableName returns the target table and the schema.
type Migrator ¶
type Migrator struct {
Tables map[string]*TableMigrate
Schemas []string
Error error
}
type OneToSomeMigrate ¶
type OneToSomeMigrate struct {
IsOneToOne bool
TargetTable string
TargetColumn string
EscapingTargetTable string
EscapingTargetColumn string
TargetSchema *string
AttributeMigrate
}
OneToSomeMigrate O2M/O2O relationship
func (OneToSomeMigrate) EscapingTargetTableName ¶
func (o OneToSomeMigrate) EscapingTargetTableName() string
EscapingTargetTableName returns the target table and the schema.
type PrimaryKeyMigrate ¶
type PrimaryKeyMigrate struct {
AutoIncrement bool
AttributeMigrate
}
type Query ¶
type Query struct {
Type enum.QueryType
Attributes []Attribute
Tables []Table
Joins []Join // Select
Limit int // Select
Offset int // Select
OrderBy []OrderBy // Select
GroupBy []GroupBy // Select
ForUpdate bool // Select
WhereOperations []Where // Select, Update and Delete
WhereIndex int // Start of where position arguments $1, $2...
Arguments []any
ReturningID *Attribute // Insert
BatchSizeQuery int // Insert
SizeArguments int // Insert
RawSql string
Header QueryHeader
}
type QueryHeader ¶
type TableMigrate ¶
type TableMigrate struct {
Name string
EscapingName string
Schema *string
Migrated bool
PrimaryKeys []PrimaryKeyMigrate
Indexes []IndexMigrate
Attributes []AttributeMigrate
ManyToSomes []ManyToSomeMigrate
OneToSomes []OneToSomeMigrate
}
func (TableMigrate) EscapingTableName ¶
func (t TableMigrate) EscapingTableName() string
EscapingTableName returns the table and the schema.
type Transaction ¶
type Transaction interface {
Connection
Commit() error
Rollback() error
SavePoint() (SavePoint, error)
}
type ValueOperation ¶
type ValueOperation interface {
GetValue() any
}
Click to show internal directories.
Click to hide internal directories.