postgres

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) database.Dialector

func Open

func Open(dsn string) database.Dialector

Types

type Config

type Config struct {
	DriverName           string
	DSN                  string
	PreferSimpleProtocol bool
	WithoutReturning     bool
	Conn                 database.ConnPool
}

type Dialector

type Dialector struct {
	*Config
}

func (Dialector) BindVarTo

func (dialector Dialector) BindVarTo(writer clause.Writer, stmt *database.Statement, v interface{})

func (Dialector) DataTypeOf

func (dialector Dialector) DataTypeOf(field *schema.Field) string

func (Dialector) DefaultValueOf

func (dialector Dialector) DefaultValueOf(field *schema.Field) clause.Expression

func (Dialector) Explain

func (dialector Dialector) Explain(sql string, vars ...interface{}) string

func (Dialector) Initialize

func (dialector Dialector) Initialize(db *database.DB) (err error)

func (Dialector) Migrator

func (dialector Dialector) Migrator(db *database.DB) database.Migrator

func (Dialector) Name

func (dialector Dialector) Name() string

func (Dialector) QuoteTo

func (dialector Dialector) QuoteTo(writer clause.Writer, str string)

func (Dialector) RollbackTo

func (dialectopr Dialector) RollbackTo(tx *database.DB, name string) error

func (Dialector) SavePoint

func (dialectopr Dialector) SavePoint(tx *database.DB, name string) error

type Index added in v1.0.6

type Index struct {
	TableName  string `database:"column:table_name"`
	ColumnName string `database:"column:column_name"`
	IndexName  string `database:"column:index_name"`
	NonUnique  bool   `database:"column:non_unique"`
	Primary    bool   `database:"column:primary"`
}

Index table index info

type Migrator

type Migrator struct {
	migrator.Migrator
}

func (Migrator) AddColumn

func (m Migrator) AddColumn(value interface{}, field string) error

func (Migrator) AlterColumn

func (m Migrator) AlterColumn(value interface{}, field string) error

AlterColumn alter value's `field` column' type based on schema definition

func (Migrator) BuildIndexOptions

func (m Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *database.Statement) (results []interface{})

func (Migrator) ColumnTypes

func (m Migrator) ColumnTypes(value interface{}) (columnTypes []database.ColumnType, err error)

func (Migrator) CreateIndex

func (m Migrator) CreateIndex(value interface{}, name string) error

func (Migrator) CreateSequence

func (m Migrator) CreateSequence(tx *database.DB, stmt *database.Statement, field *schema.Field,
	serialDatabaseType string) (err error)

func (Migrator) CreateTable

func (m Migrator) CreateTable(values ...interface{}) (err error)

func (Migrator) CurrentDatabase

func (m Migrator) CurrentDatabase() (name string)

func (Migrator) CurrentSchema

func (m Migrator) CurrentSchema(stmt *database.Statement, table string) (interface{}, interface{})

func (Migrator) DeleteSequence

func (m Migrator) DeleteSequence(tx *database.DB, stmt *database.Statement, field *schema.Field,
	fileType clause.Expr) (err error)

func (Migrator) DropColumn added in v1.0.6

func (m Migrator) DropColumn(dst interface{}, field string) error

func (Migrator) DropIndex

func (m Migrator) DropIndex(value interface{}, name string) error

func (Migrator) DropTable

func (m Migrator) DropTable(values ...interface{}) error

func (Migrator) GetIndexes added in v1.0.6

func (m Migrator) GetIndexes(value interface{}) ([]database.Index, error)

func (Migrator) GetRows

func (m Migrator) GetRows(currentSchema interface{}, table interface{}) (*sql.Rows, error)

func (Migrator) GetTables

func (m Migrator) GetTables() (tableList []string, err error)

func (Migrator) GetTypeAliases added in v1.0.6

func (m Migrator) GetTypeAliases(databaseTypeName string) []string

func (Migrator) HasColumn

func (m Migrator) HasColumn(value interface{}, field string) bool

func (Migrator) HasConstraint

func (m Migrator) HasConstraint(value interface{}, name string) bool

func (Migrator) HasIndex

func (m Migrator) HasIndex(value interface{}, name string) bool

func (Migrator) HasTable

func (m Migrator) HasTable(value interface{}) bool

func (Migrator) MigrateColumn

func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnType database.ColumnType) error

func (Migrator) RenameColumn added in v1.0.6

func (m Migrator) RenameColumn(dst interface{}, oldName, field string) error

func (Migrator) RenameIndex

func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error

func (Migrator) UpdateSequence

func (m Migrator) UpdateSequence(tx *database.DB, stmt *database.Statement, field *schema.Field,
	serialDatabaseType string) (err error)

Jump to

Keyboard shortcuts

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