pogo

package
v0.0.0-...-a197a46 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Log = func(string, ...interface{}) {}

Log function. Override this with the logger of your choice

Functions

func Conditions

func Conditions(conds ...Condition) (sql string, params []interface{}, err error)

Conditions turns a list of conditions into sql clauses and params

func IsNoRows

func IsNoRows(err error) bool

IsErrNoRows checks if an error was caused by a result returning no rows

Types

type Clause

type Clause struct {
	Type   string
	Format string
	Params []interface{}
	Error  error
}

Clause struct

type Condition

type Condition interface {
	Clause() *Clause
}

Condition interface

type DB

type DB interface {
	Exec(string, ...interface{}) (pgx.CommandTag, error)
	Query(string, ...interface{}) (*pgx.Rows, error)
	QueryRow(string, ...interface{}) *pgx.Row
}

type Insertable

type Insertable interface {
	Insert(db DB) (Row, error)
}

Insertable can be inserted into the DB This is a convenience function for simple insert operations

type Row

type Row interface {
	Decode(v interface{}) error
}

Row interface allows you to pull out the specific models in a generic way

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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