package postgres

Import Path
	gorm.io/driver/postgres (on go.dev)

Dependency Relation
	imports 15 packages, and imported by one package


Package-Level Type Names (total 5)
/* sort by: | */
Conn gorm.ConnPool DSN string DriverName string PreferSimpleProtocol bool WithoutQuotingCheck bool WithoutReturning bool func New(config Config) gorm.Dialector
Config *Config Config.Conn gorm.ConnPool Config.DSN string Config.DriverName string Config.PreferSimpleProtocol bool Config.WithoutQuotingCheck bool Config.WithoutReturning bool ( Dialector) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{}) ( Dialector) DataTypeOf(field *schema.Field) string ( Dialector) DefaultValueOf(field *schema.Field) clause.Expression ( Dialector) Explain(sql string, vars ...interface{}) string ( Dialector) Initialize(db *gorm.DB) (err error) ( Dialector) Migrator(db *gorm.DB) gorm.Migrator ( Dialector) Name() string ( Dialector) QuoteTo(writer clause.Writer, str string) ( Dialector) RollbackTo(tx *gorm.DB, name string) error ( Dialector) SavePoint(tx *gorm.DB, name string) error Translate it will translate the error to native gorm errors. Since currently gorm supporting both pgx and pg drivers, only checking for pgx PgError types is not enough for translating errors, so we have additional error json marshal fallback. Dialector : gorm.io/gorm.Dialector Dialector : gorm.io/gorm.ErrorTranslator Dialector : gorm.io/gorm.Plugin Dialector : gorm.io/gorm.SavePointerDialectorInterface
Code string Message string Severity string
Index table index info ColumnName string IndexName string NonUnique bool Primary bool TableName string
Migrator migrator.Migrator Migrator.Config migrator.Config Migrator.Config.CreateIndexAfterCreateTable bool Migrator.Config.DB *gorm.DB Migrator.Config.Dialector gorm.Dialector ( Migrator) AddColumn(value interface{}, field string) error AlterColumn alter value's `field` column' type based on schema definition AutoMigrate auto migrate values ( Migrator) BindVarTo(writer clause.Writer, stmt *gorm.Statement, v interface{}) ( Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{}) ( Migrator) ColumnTypes(value interface{}) (columnTypes []gorm.ColumnType, err error) CreateConstraint create constraint ( Migrator) CreateIndex(value interface{}, name string) error ( Migrator) CreateSequence(tx *gorm.DB, stmt *gorm.Statement, field *schema.Field, serialDatabaseType string) (err error) ( Migrator) CreateTable(values ...interface{}) (err error) CreateView create view from Query in gorm.ViewOption. Query in gorm.ViewOption is a [subquery] // CREATE VIEW `user_view` AS SELECT * FROM `users` WHERE age > 20 q := DB.Model(&User{}).Where("age > ?", 20) DB.Debug().Migrator().CreateView("user_view", gorm.ViewOption{Query: q}) // CREATE OR REPLACE VIEW `users_view` AS SELECT * FROM `users` WITH CHECK OPTION q := DB.Model(&User{}) DB.Debug().Migrator().CreateView("user_view", gorm.ViewOption{Query: q, Replace: true, CheckOption: "WITH CHECK OPTION"}) [subquery]: https://gorm.io/docs/advanced_query.html#SubQuery ( Migrator) CurrentDatabase() (name string) ( Migrator) CurrentSchema(stmt *gorm.Statement, table string) (interface{}, interface{}) CurrentTable returns current statement's table expression DataTypeOf return field's db data type ( Migrator) DefaultValueOf(*schema.Field) clause.Expression ( Migrator) DeleteSequence(tx *gorm.DB, stmt *gorm.Statement, field *schema.Field, fileType clause.Expr) (err error) ( Migrator) DropColumn(dst interface{}, field string) error DropConstraint drop constraint ( Migrator) DropIndex(value interface{}, name string) error ( Migrator) DropTable(values ...interface{}) error DropView drop view ( Migrator) Explain(sql string, vars ...interface{}) string FullDataTypeOf returns field's db full data type ( Migrator) GetIndexes(value interface{}) ([]gorm.Index, error) ( Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Rows, error) ( Migrator) GetTables() (tableList []string, err error) ( Migrator) GetTypeAliases(databaseTypeName string) []string GuessConstraintAndTable guess statement's constraint and it's table based on name ( Migrator) HasColumn(value interface{}, field string) bool ( Migrator) HasConstraint(value interface{}, name string) bool ( Migrator) HasIndex(value interface{}, name string) bool ( Migrator) HasTable(value interface{}) bool ( Migrator) Initialize(*gorm.DB) error ( Migrator) MigrateColumn(value interface{}, field *schema.Field, columnType gorm.ColumnType) error ( Migrator) Name() string ( Migrator) QuoteTo(clause.Writer, string) ( Migrator) RenameColumn(dst interface{}, oldName, field string) error ( Migrator) RenameIndex(value interface{}, oldName, newName string) error RenameTable rename table from oldName to newName ReorderModels reorder models according to constraint dependencies RunWithValue run migration with statement value TableType return tableType gorm.TableType and execErr error ( Migrator) UpdateSequence(tx *gorm.DB, stmt *gorm.Statement, field *schema.Field, serialDatabaseType string) (err error) Migrator : gorm.io/gorm.Migrator Migrator : gorm.io/gorm.Plugin Migrator : gorm.io/gorm/migrator.BuildIndexOptionsInterface
Package-Level Functions (total 2)
func New(config Config) gorm.Dialector