postgres

package
v1.0.1-rc4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SchemaDB = sqlx.NewDatabase("INFORMATION_SCHEMA")

Functions

func InterpolateParams

func InterpolateParams(query string, args []driver.NamedValue, loc *time.Location) (string, error)

Types

type ColumnSchema

type ColumnSchema struct {
	TABLE_SCHEMA             string `db:"table_schema"`
	TABLE_NAME               string `db:"table_name"`
	COLUMN_NAME              string `db:"column_name"`
	DATA_TYPE                string `db:"data_type"`
	IS_NULLABLE              string `db:"is_nullable"`
	COLUMN_DEFAULT           string `db:"column_default"`
	CHARACTER_MAXIMUM_LENGTH uint64 `db:"character_maximum_length"`
	NUMERIC_PRECISION        uint64 `db:"numeric_precision"`
	NUMERIC_SCALE            uint64 `db:"numeric_scale"`
}

func (ColumnSchema) TableName

func (ColumnSchema) TableName() string

type Connector

type Connector struct {
	Host       string
	DBName     string
	MustSchema string
	Extra      string
	Extensions []string
}

func (*Connector) AddColumn

func (c *Connector) AddColumn(col *builder.Column) builder.SqlExpr

func (*Connector) AddIndex

func (c *Connector) AddIndex(key *builder.Key) builder.SqlExpr

func (*Connector) Connect

func (c *Connector) Connect(ctx context.Context) (driver.Conn, error)

func (*Connector) CreateDatabase

func (c *Connector) CreateDatabase(dbName string) builder.SqlExpr

func (*Connector) CreateSchema

func (c *Connector) CreateSchema(schema string) builder.SqlExpr

func (*Connector) CreateTableIsNotExists

func (c *Connector) CreateTableIsNotExists(t *builder.Table) (exprs []builder.SqlExpr)

func (*Connector) DataType

func (c *Connector) DataType(columnType *builder.ColumnType) builder.SqlExpr

func (Connector) Driver

func (Connector) Driver() driver.Driver

func (Connector) DriverName

func (Connector) DriverName() string

func (*Connector) DropColumn

func (c *Connector) DropColumn(col *builder.Column) builder.SqlExpr

func (*Connector) DropDatabase

func (c *Connector) DropDatabase(dbName string) builder.SqlExpr

func (*Connector) DropIndex

func (c *Connector) DropIndex(key *builder.Key) builder.SqlExpr

func (*Connector) DropTable

func (c *Connector) DropTable(t *builder.Table) builder.SqlExpr

func (Connector) IsErrorConflict

func (Connector) IsErrorConflict(err error) bool

func (Connector) IsErrorUnknownDatabase

func (Connector) IsErrorUnknownDatabase(err error) bool

func (*Connector) Migrate

func (c *Connector) Migrate(ctx context.Context, db sqlx.DBExecutor) error

func (*Connector) ModifyColumn

func (c *Connector) ModifyColumn(col *builder.Column, prev *builder.Column) builder.SqlExpr

func (Connector) PrimaryKeyName

func (Connector) PrimaryKeyName() string

func (*Connector) RenameColumn

func (c *Connector) RenameColumn(col *builder.Column, target *builder.Column) builder.SqlExpr

func (*Connector) TruncateTable

func (c *Connector) TruncateTable(t *builder.Table) builder.SqlExpr

func (Connector) WithDBName

func (c Connector) WithDBName(name string) driver.Connector

type Driver

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

func (*Driver) Open

func (d *Driver) Open(dsn string) (driver.Conn, error)

type IndexSchema

type IndexSchema struct {
	TABLE_SCHEMA string `db:"schemaname"`
	TABLE_NAME   string `db:"tablename"`
	INDEX_NAME   string `db:"indexname"`
	INDEX_DEF    string `db:"indexdef"`
}

func (IndexSchema) TableName

func (IndexSchema) TableName() string

type LoggingConn

type LoggingConn struct {
	driver.Conn
	// contains filtered or unexported fields
}

func (*LoggingConn) BeginTx

func (c *LoggingConn) BeginTx(ctx context.Context, opts driver.TxOptions) (driver.Tx, error)

func (*LoggingConn) ExecContext

func (c *LoggingConn) ExecContext(ctx context.Context, query string, args []driver.NamedValue) (res driver.Result, err error)

func (*LoggingConn) Prepare

func (c *LoggingConn) Prepare(string) (driver.Stmt, error)

func (*LoggingConn) QueryContext

func (c *LoggingConn) QueryContext(ctx context.Context, query string, args []driver.NamedValue) (rows driver.Rows, err error)

type LoggingTx

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

func (*LoggingTx) Commit

func (tx *LoggingTx) Commit() error

func (*LoggingTx) Rollback

func (tx *LoggingTx) Rollback() error

type Opts

type Opts map[string]string

func ParseOption

func ParseOption(s string) Opts

func (Opts) String

func (o Opts) String() string

type SqlPrinter

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

func (*SqlPrinter) String

func (p *SqlPrinter) String() string

Jump to

Keyboard shortcuts

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