postgres

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() dbal.Grammar

New Create a new mysql grammar inteface

Types

type Postgres

type Postgres struct {
	sql.SQL
}

Postgres the Postgresql Grammar

func (Postgres) AlterTable

func (grammarSQL Postgres) AlterTable(table *dbal.Table) error

AlterTable alter a table on the schema

func (Postgres) CompileColumns added in v0.5.1

func (grammarSQL Postgres) CompileColumns(query *dbal.Query, columns []interface{}, bindingOffset *int) string

CompileColumns Compile the "select *" portion of the query.

func (Postgres) CompileDelete added in v0.5.1

func (grammarSQL Postgres) CompileDelete(query *dbal.Query) (string, []interface{})

CompileDelete Compile a delete statement into SQL.

func (Postgres) CompileInsertGetID added in v0.5.1

func (grammarSQL Postgres) CompileInsertGetID(query *dbal.Query, columns []interface{}, values [][]interface{}, sequence string) (string, []interface{})

CompileInsertGetID Compile an insert and get ID statement into SQL.

func (Postgres) CompileInsertOrIgnore added in v0.5.1

func (grammarSQL Postgres) CompileInsertOrIgnore(query *dbal.Query, columns []interface{}, values [][]interface{}) (string, []interface{})

CompileInsertOrIgnore Compile an insert ignore statement into SQL.

func (Postgres) CompileLock added in v0.5.1

func (grammarSQL Postgres) CompileLock(query *dbal.Query, lock interface{}) string

CompileLock the lock into SQL.

func (Postgres) CompileSelect added in v0.5.1

func (grammarSQL Postgres) CompileSelect(query *dbal.Query) string

CompileSelect Compile a select query into SQL.

func (Postgres) CompileSelectOffset added in v0.5.1

func (grammarSQL Postgres) CompileSelectOffset(query *dbal.Query, offset *int) string

CompileSelectOffset Compile a select query into SQL.

func (Postgres) CompileTruncate added in v0.5.1

func (grammarSQL Postgres) CompileTruncate(query *dbal.Query) ([]string, [][]interface{})

CompileTruncate Compile a truncate table statement into SQL.

func (Postgres) CompileUpdate added in v0.5.1

func (grammarSQL Postgres) CompileUpdate(query *dbal.Query, values map[string]interface{}) (string, []interface{})

CompileUpdate Compile an update statement into SQL.

func (Postgres) CompileUpsert added in v0.5.1

func (grammarSQL Postgres) CompileUpsert(query *dbal.Query, columns []interface{}, values [][]interface{}, uniqueBy []interface{}, updateValues interface{}) (string, []interface{})

CompileUpsert Upsert new records or update the existing ones.

func (Postgres) CompileWheres added in v0.5.1

func (grammarSQL Postgres) CompileWheres(query *dbal.Query, wheres []dbal.Where, bindingOffset *int) string

CompileWheres Compile an update statement into SQL.

func (Postgres) CreateTable

func (grammarSQL Postgres) CreateTable(table *dbal.Table) error

CreateTable create a new table on the schema

func (Postgres) CreateType

func (grammarSQL Postgres) CreateType(table *dbal.Table, types map[string][]string) error

CreateType create user defined type

func (Postgres) ExecSQL

func (grammarSQL Postgres) ExecSQL(table *dbal.Table, sql string) error

ExecSQL execute sql then update table structure

func (Postgres) GetColumnListing

func (grammarSQL Postgres) GetColumnListing(dbName string, tableName string) ([]*dbal.Column, error)

GetColumnListing get a table columns structure

func (Postgres) GetIndexListing

func (grammarSQL Postgres) GetIndexListing(dbName string, tableName string) ([]*dbal.Index, error)

GetIndexListing get a table indexes structure

func (Postgres) GetOperators added in v0.5.1

func (grammarSQL Postgres) GetOperators() []string

GetOperators get the operators

func (Postgres) GetTable

func (grammarSQL Postgres) GetTable(name string) (*dbal.Table, error)

GetTable get a table on the schema

func (Postgres) GetTables

func (grammarSQL Postgres) GetTables() ([]string, error)

GetTables Get all of the table names for the database.

func (Postgres) GetVersion

func (grammarSQL Postgres) GetVersion() (*dbal.Version, error)

GetVersion get the version of the connection database

func (Postgres) NewWith

func (grammarSQL Postgres) NewWith(db *sqlx.DB, config *dbal.Config, option *dbal.Option) (dbal.Grammar, error)

NewWith Create a new grammar interface, using the given *sqlx.DB, *dbal.Config and *dbal.Option.

func (Postgres) NewWithRead added in v0.5.1

func (grammarSQL Postgres) NewWithRead(write *sqlx.DB, writeConfig *dbal.Config, read *sqlx.DB, readConfig *dbal.Config, option *dbal.Option) (dbal.Grammar, error)

NewWithRead Create a new grammar interface, using the given *sqlx.DB, *dbal.Config and *dbal.Option.

func (Postgres) ProcessInsertGetID added in v0.5.1

func (grammarSQL Postgres) ProcessInsertGetID(sql string, bindings []interface{}, sequence string) (int64, error)

ProcessInsertGetID Execute an insert and get ID statement and return the id

func (Postgres) RenameTable

func (grammarSQL Postgres) RenameTable(old string, new string) error

RenameTable rename a table on the schema.

func (Postgres) SQLAddColumn

func (grammarSQL Postgres) SQLAddColumn(column *dbal.Column) string

SQLAddColumn return the add column sql for table create

func (Postgres) SQLAddComment

func (grammarSQL Postgres) SQLAddComment(column *dbal.Column) string

SQLAddComment return the add comment sql for table create

func (Postgres) SQLAddIndex

func (grammarSQL Postgres) SQLAddIndex(index *dbal.Index) string

SQLAddIndex return the add index sql for table create

func (Postgres) SQLAddPrimary

func (grammarSQL Postgres) SQLAddPrimary(primary *dbal.Primary) string

SQLAddPrimary return the add primary key sql for table create

func (Postgres) SQLAlterColumnType

func (grammarSQL Postgres) SQLAlterColumnType(Column *dbal.Column) string

SQLAlterColumnType return the add column sql for table alter

func (Postgres) SQLAlterIndex

func (grammarSQL Postgres) SQLAlterIndex(index *dbal.Index) string

SQLAlterIndex return the add index sql for table alter

func (Postgres) TableExists

func (grammarSQL Postgres) TableExists(name string) (bool, error)

TableExists check if the table exists

func (Postgres) Upsert added in v0.5.1

func (grammarSQL Postgres) Upsert(query *dbal.Query, values []xun.R, uniqueBy []interface{}, updateValues interface{}) (sql.Result, error)

Upsert Upsert new records or update the existing ones.

func (Postgres) WhereDate added in v0.5.1

func (grammarSQL Postgres) WhereDate(query *dbal.Query, where dbal.Where, bindingOffset *int) string

WhereDate Compile a "where date" clause.

func (Postgres) WhereDateBased added in v0.5.1

func (grammarSQL Postgres) WhereDateBased(typ string, query *dbal.Query, where dbal.Where, bindingOffset *int) string

WhereDateBased Compile a date based where clause.

func (Postgres) WhereDay added in v0.5.1

func (grammarSQL Postgres) WhereDay(query *dbal.Query, where dbal.Where, bindingOffset *int) string

WhereDay Compile a "where day" clause.

func (Postgres) WhereMonth added in v0.5.1

func (grammarSQL Postgres) WhereMonth(query *dbal.Query, where dbal.Where, bindingOffset *int) string

WhereMonth Compile a "where month" clause.

func (Postgres) WhereTime added in v0.5.1

func (grammarSQL Postgres) WhereTime(query *dbal.Query, where dbal.Where, bindingOffset *int) string

WhereTime Compile a "where time" clause.

func (Postgres) WhereYear added in v0.5.1

func (grammarSQL Postgres) WhereYear(query *dbal.Query, where dbal.Where, bindingOffset *int) string

WhereYear Compile a "where year" clause.

type Quoter

type Quoter struct {
	sql.Quoter
}

Quoter the database quoting query text SQL type

func (*Quoter) Columnize added in v0.5.1

func (quoter *Quoter) Columnize(columns []interface{}) string

Columnize Convert an array of column names into a delimited string.

func (Quoter) ID

func (quoter Quoter) ID(name string) string

ID quoting query Identifier (`id`)

func (*Quoter) Parameter added in v0.5.1

func (quoter *Quoter) Parameter(value interface{}, num int) string

Parameter Get the appropriate query parameter place-holder for a value.

func (*Quoter) Parameterize added in v0.5.1

func (quoter *Quoter) Parameterize(values []interface{}, offset int) string

Parameterize Create query parameter place-holders for an array.

func (Quoter) VAL

func (quoter Quoter) VAL(v interface{}) string

VAL quoting query value ( 'value' )

func (*Quoter) Wrap added in v0.5.1

func (quoter *Quoter) Wrap(value interface{}) string

Wrap a value in keyword identifiers.

func (*Quoter) WrapAliasedValue added in v0.5.1

func (quoter *Quoter) WrapAliasedValue(value string) string

WrapAliasedValue Wrap a value that has an alias.

func (*Quoter) WrapTable added in v0.5.1

func (quoter *Quoter) WrapTable(value interface{}) string

WrapTable Wrap a table in keyword identifiers.

Jump to

Keyboard shortcuts

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