pgxexec

package module
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: GPL-3.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

pgxexec

PostgreSQL sql builder end executor for jackx/pgx driver.

Documentation

Index

Constants

View Source
const (
	SPTagName             = "db"
	SPAltTagName          = "json"
	SPOmitTagValue        = "-"
	SPOmitEmptyTagOption  = "omitempty"
	SPPrimaryKeyTagOption = "pk"
	SPStringTagOption     = "string"
)

Variables

View Source
var NotPointerErr = errors.New("'i' argument must be pointer")
View Source
var TargetRequiredErr = errors.New("'target' is required parameter")
View Source
var UpdateWithoutSetValuesErr = errors.New("update without set values")
View Source
var UpdatedBeforeDeleteError error

Functions

func FieldNames

func FieldNames(i interface{}) []string

func Pointers

func Pointers(fvs []FieldValue) []interface{}

func Quote

func Quote(value string) string

func QuoteRelationName

func QuoteRelationName(value string) string

func UnQuote

func UnQuote(value string) string

Types

type DeleteStatement

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

func Delete

func Delete(target string) *DeleteStatement

func (*DeleteStatement) Build

func (s *DeleteStatement) Build() (string, []interface{}, error)

func (*DeleteStatement) Exec

func (s *DeleteStatement) Exec(conn PgxConn, ctx context.Context) (rowsAffected int64, err error)

func (*DeleteStatement) One

func (s *DeleteStatement) One(conn PgxConn, ctx context.Context) error

func (*DeleteStatement) OneJson

func (s *DeleteStatement) OneJson(conn PgxConn, ctx context.Context) (string, error)

func (*DeleteStatement) Returning

func (s *DeleteStatement) Returning(ptr interface{}) *DeleteStatement

ptr parameter must be pointer

func (*DeleteStatement) ReturningSet

func (s *DeleteStatement) ReturningSet(col string, ptr interface{}) *DeleteStatement

func (*DeleteStatement) Version added in v1.0.3

func (s *DeleteStatement) Version(conn PgxConn, ctx context.Context) error

func (*DeleteStatement) WhereValues

func (s *DeleteStatement) WhereValues(values interface{}) *DeleteStatement

func (*DeleteStatement) WhereValuesAdd

func (s *DeleteStatement) WhereValuesAdd(col string, value interface{}) *DeleteStatement

type FieldValue

type FieldValue struct {
	Column     string
	PrimaryKey bool
	Value      interface{}
}

func FieldPointers

func FieldPointers(i interface{}) []FieldValue

func FieldValues

func FieldValues(i interface{}) []FieldValue

type InsertStatement

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

func Insert

func Insert(target string) *InsertStatement

func (*InsertStatement) Build

func (s *InsertStatement) Build() (string, []interface{}, error)

func (*InsertStatement) Exec

func (s *InsertStatement) Exec(conn PgxConn, ctx context.Context) (rowsAffected int64, err error)

func (*InsertStatement) One

func (s *InsertStatement) One(conn PgxConn, ctx context.Context) error

func (*InsertStatement) OneJson

func (s *InsertStatement) OneJson(conn PgxConn, ctx context.Context) (string, error)

func (*InsertStatement) Returning

func (s *InsertStatement) Returning(ptr interface{}) *InsertStatement

ptr parameter must be pointer

func (*InsertStatement) ReturningAdd

func (s *InsertStatement) ReturningAdd(col string, ptr interface{}) *InsertStatement

func (*InsertStatement) ValueSet

func (s *InsertStatement) ValueSet(col string, value interface{}) *InsertStatement

func (*InsertStatement) Values

func (s *InsertStatement) Values(str interface{}) *InsertStatement

type Map

type Map map[string]interface{}

type PgxConn

type PgxConn interface {
	Exec(ctx context.Context, sql string, arguments ...interface{}) (commandTag pgconn.CommandTag, err error)
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
	QueryFunc(ctx context.Context, sql string, args []interface{}, scans []interface{}, f func(pgx.QueryFuncRow) error) (pgconn.CommandTag, error)
}

type QueryStatement

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

func Query

func Query(target string) *QueryStatement

func (*QueryStatement) All

func (s *QueryStatement) All(conn PgxConn, ctx context.Context) error

func (*QueryStatement) AllJson

func (s *QueryStatement) AllJson(conn PgxConn, ctx context.Context) (string, error)

func (*QueryStatement) Build

func (s *QueryStatement) Build() (string, []interface{}, error)

func (*QueryStatement) Count

func (s *QueryStatement) Count(conn PgxConn, ctx context.Context) (uint64, error)

func (*QueryStatement) Exists

func (s *QueryStatement) Exists(conn PgxConn, ctx context.Context) (bool, error)

func (*QueryStatement) Limit

func (s *QueryStatement) Limit(val uint64) *QueryStatement

func (*QueryStatement) Offset

func (s *QueryStatement) Offset(val uint64) *QueryStatement

func (*QueryStatement) One

func (s *QueryStatement) One(conn PgxConn, ctx context.Context) error

func (*QueryStatement) OneJson

func (s *QueryStatement) OneJson(conn PgxConn, ctx context.Context) (string, error)

func (*QueryStatement) OrderBy

func (s *QueryStatement) OrderBy(clause string) *QueryStatement

func (*QueryStatement) Scalar added in v1.0.1

func (s *QueryStatement) Scalar(conn PgxConn, ctx context.Context) (interface{}, error)

func (*QueryStatement) SelectColAdd

func (s *QueryStatement) SelectColAdd(col string, as ...string) *QueryStatement

func (*QueryStatement) SelectDistinct

func (s *QueryStatement) SelectDistinct() *QueryStatement

func (*QueryStatement) SelectStruct

func (s *QueryStatement) SelectStruct(str interface{}) *QueryStatement

func (*QueryStatement) WhereFilter

func (s *QueryStatement) WhereFilter(values interface{}) *QueryStatement

func (*QueryStatement) WhereFilterAdd

func (s *QueryStatement) WhereFilterAdd(col string, value interface{}) *QueryStatement

func (*QueryStatement) WhereStatement

func (s *QueryStatement) WhereStatement(statement string, args ...interface{}) *QueryStatement

func (*QueryStatement) WhereValues

func (s *QueryStatement) WhereValues(values interface{}) *QueryStatement

func (*QueryStatement) WhereValuesAdd

func (s *QueryStatement) WhereValuesAdd(col string, value interface{}) *QueryStatement

type Strings

type Strings []string

type Struct

type Struct struct {
	FieldNames []string
	Fields     []FieldValue
	// contains filtered or unexported fields
}

type UpdateStatement

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

func Update

func Update(target string) *UpdateStatement

func (*UpdateStatement) Build

func (s *UpdateStatement) Build() (string, []interface{}, error)

func (*UpdateStatement) Exec

func (s *UpdateStatement) Exec(conn PgxConn, ctx context.Context) (rowsAffected int64, err error)

func (*UpdateStatement) One

func (s *UpdateStatement) One(conn PgxConn, ctx context.Context) error

func (*UpdateStatement) OneJson

func (s *UpdateStatement) OneJson(conn PgxConn, ctx context.Context) (string, error)

func (*UpdateStatement) Returning

func (s *UpdateStatement) Returning(ptr interface{}) *UpdateStatement

ptr parameter must be pointer

func (*UpdateStatement) ReturningSet

func (s *UpdateStatement) ReturningSet(col string, ptr interface{}) *UpdateStatement

func (*UpdateStatement) Set

func (s *UpdateStatement) Set(str interface{}) *UpdateStatement

func (*UpdateStatement) SetAdd

func (s *UpdateStatement) SetAdd(col string, value interface{}) *UpdateStatement

func (*UpdateStatement) SetWherePrimaryKey

func (s *UpdateStatement) SetWherePrimaryKey(str interface{}) *UpdateStatement

func (*UpdateStatement) WhereValues

func (s *UpdateStatement) WhereValues(values interface{}) *UpdateStatement

func (*UpdateStatement) WhereValuesAdd

func (s *UpdateStatement) WhereValuesAdd(col string, value interface{}) *UpdateStatement

Jump to

Keyboard shortcuts

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