pg

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2021 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetWhereClause

func GetWhereClause(w Where, base *int) (string, []interface{})

GetWhereClause builds the WHERE clause from any of Where-types

Types

type InsertVals

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

InsertVals represents an easy to use store for setting up multiple insert-rows for SQL

func NewInsert

func NewInsert() *InsertVals

NewInsert creates a store for rows that will be inserted with an SQL-statement

func (*InsertVals) Add

func (v *InsertVals) Add(values ...interface{}) error

Add appends one or more rows to the insert store

func (*InsertVals) String

func (v *InsertVals) String(base *int) string

String returns the VALUES-Clause with the size of given value-rows

func (*InsertVals) Values

func (v *InsertVals) Values() []interface{}

Values returns all stored rows in a single-dimension array to use with the sql package

type UpdateConfig

type UpdateConfig func(c *UpdateSQL)

func Fields

func Fields(v map[string]interface{}) UpdateConfig

func Returns

func Returns(v map[string]interface{}) UpdateConfig

type UpdateSQL

type UpdateSQL struct {
	ValueMap map[string]interface{}
}

func (*UpdateSQL) String

func (c *UpdateSQL) String(base *int) string

func (*UpdateSQL) Values

func (c *UpdateSQL) Values() []interface{}

type Where

type Where func(paramBase *int) (string, []interface{})

Where is a function type that is used to create a WHERE clause and the values to use in an SQL-Query.

func AND

func AND(ops ...Where) Where

AND joins two or more Where-types with (cond1 AND cond2)

func EQ

func EQ(column string, value interface{}) Where

EQ compares values in an SQL-Statement with "="-operator

func IN

func IN(column string, values ...interface{}) Where

IN compares values in an SQL-Statement with "IN (?,?,?,...)"-operator

func INCallabel

func INCallabel(column string, callable func() []interface{}) Where

INCallabel same as IN but calles function for the values

func NEQ

func NEQ(column string, value interface{}) Where

NEQ compares values in an SQL-Statement with "!="-operator

func NONE

func NONE() Where

NONE for using non filtered input

func OR

func OR(ops ...Where) Where

OR joins two or more Where-types with (cond1 OR cond2)

Jump to

Keyboard shortcuts

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