Documentation ¶
Index ¶
- func New(config Config) gorm.Dialector
- func Open(dsn string) gorm.Dialector
- type Config
- type Dialector
- func (dialector Dialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{})
- func (dialector Dialector) DataTypeOf(field *schema.Field) string
- func (dialector Dialector) DefaultValueOf(field *schema.Field) clause.Expression
- func (dialector Dialector) Explain(sql string, vars ...interface{}) string
- func (dialector Dialector) Initialize(db *gorm.DB) (err error)
- func (dialector Dialector) Migrator(db *gorm.DB) gorm.Migrator
- func (dialector Dialector) Name() string
- func (dialector Dialector) QuoteTo(writer clause.Writer, str string)
- func (dialector Dialector) RollbackTo(tx *gorm.DB, name string) error
- func (dialector Dialector) SavePoint(tx *gorm.DB, name string) error
- func (dialector Dialector) Translate(err error) error
- type ErrMessage
- type Index
- type Migrator
- func (m Migrator) AddColumn(value interface{}, field string) error
- func (m Migrator) AlterColumn(value interface{}, field string) error
- func (m Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{})
- func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType, err error)
- func (m Migrator) CreateIndex(value interface{}, name string) error
- func (m Migrator) CreateSequence(tx *gorm.DB, stmt *gorm.Statement, field *schema.Field, ...) (err error)
- func (m Migrator) CreateTable(values ...interface{}) (err error)
- func (m Migrator) CurrentDatabase() (name string)
- func (m Migrator) CurrentSchema(stmt *gorm.Statement, table string) (interface{}, interface{})
- func (m Migrator) DeleteSequence(tx *gorm.DB, stmt *gorm.Statement, field *schema.Field, fileType clause.Expr) (err error)
- func (m Migrator) DropColumn(dst interface{}, field string) error
- func (m Migrator) DropIndex(value interface{}, name string) error
- func (m Migrator) DropTable(values ...interface{}) error
- func (m Migrator) GetIndexes(value interface{}) ([]gorm.Index, error)
- func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Rows, error)
- func (m Migrator) GetTables() (tableList []string, err error)
- func (m Migrator) GetTypeAliases(databaseTypeName string) []string
- func (m Migrator) HasColumn(value interface{}, field string) bool
- func (m Migrator) HasConstraint(value interface{}, name string) bool
- func (m Migrator) HasIndex(value interface{}, name string) bool
- func (m Migrator) HasTable(value interface{}) bool
- func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnType gorm.ColumnType) error
- func (m Migrator) RenameColumn(dst interface{}, oldName, field string) error
- func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error
- func (m Migrator) UpdateSequence(tx *gorm.DB, stmt *gorm.Statement, field *schema.Field, ...) (err error)
- type QueryExecMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dialector ¶
type Dialector struct {
*Config
}
func (Dialector) DefaultValueOf ¶
func (dialector Dialector) DefaultValueOf(field *schema.Field) clause.Expression
type ErrMessage ¶
type Index ¶
type Index struct { TableName string `gorm:"column:table_name"` ColumnName string `gorm:"column:column_name"` IndexName string `gorm:"column:index_name"` NonUnique bool `gorm:"column:non_unique"` Primary bool `gorm:"column:primary"` }
Index table index info
type Migrator ¶
func (Migrator) AlterColumn ¶
AlterColumn alter value's `field` column' type based on schema definition
func (Migrator) BuildIndexOptions ¶
func (m Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{})
func (Migrator) ColumnTypes ¶
func (m Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType, err error)
func (Migrator) CreateIndex ¶
func (Migrator) CreateSequence ¶
func (Migrator) CreateTable ¶
func (Migrator) CurrentDatabase ¶
func (Migrator) CurrentSchema ¶
func (Migrator) DeleteSequence ¶
func (Migrator) DropColumn ¶
func (Migrator) GetTypeAliases ¶
func (Migrator) HasConstraint ¶
func (Migrator) MigrateColumn ¶
func (Migrator) RenameColumn ¶
func (Migrator) RenameIndex ¶
type QueryExecMode ¶
type QueryExecMode int32
const ( // Automatically prepare and cache statements. This uses the extended protocol. Queries are executed in a single // round trip after the statement is cached. This is the default. QueryExecModeCacheStatement QueryExecMode // Cache statement descriptions (i.e. argument and result types) and assume they do not change. This uses the // extended protocol. Queries are executed in a single round trip after the description is cached. If the database // schema is modified or the search_path is changed this may result in undetected result decoding errors. QueryExecModeCacheDescribe // Get the statement description on every execution. This uses the extended protocol. Queries require two round trips // to execute. It does not use named prepared statements. But it does use the unnamed prepared statement to get the // statement description on the first round trip and then uses it to execute the query on the second round trip. This // may cause problems with connection poolers that switch the underlying connection between round trips. It is safe // even when the the database schema is modified concurrently. QueryExecModeDescribeExec // Assume the PostgreSQL query parameter types based on the Go type of the arguments. This uses the extended protocol // with text formatted parameters and results. Queries are executed in a single round trip. Type mappings can be // registered with pgtype.Map.RegisterDefaultPgType. Queries will be rejected that have arguments that are // unregistered or ambigious. e.g. A map[string]string may have the PostgreSQL type json or hstore. Modes that know // the PostgreSQL type can use a map[string]string directly as an argument. This mode cannot. QueryExecModeExec // Use the simple protocol. Assume the PostgreSQL query parameter types based on the Go type of the arguments. // Queries are executed in a single round trip. Type mappings can be registered with // pgtype.Map.RegisterDefaultPgType. Queries will be rejected that have arguments that are unregistered or ambigious. // e.g. A map[string]string may have the PostgreSQL type json or hstore. Modes that know the PostgreSQL type can use // a map[string]string directly as an argument. This mode cannot. // // QueryExecModeSimpleProtocol should have the user application visible behavior as QueryExecModeExec with minor // exceptions such as behavior when multiple result returning queries are erroneously sent in a single string. // // QueryExecModeSimpleProtocol uses client side parameter interpolation. All values are quoted and escaped. Prefer // QueryExecModeExec over QueryExecModeSimpleProtocol whenever possible. In general QueryExecModeSimpleProtocol // should only be used if connecting to a proxy server, connection pool server, or non-PostgreSQL server that does // not support the extended protocol. QueryExecModeSimpleProtocol )
Click to show internal directories.
Click to hide internal directories.