psql

package
v0.0.0-...-2c24670 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: Apache-2.0 Imports: 19 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DB      *gorm.DB
	DBError error
)
View Source
var (
	DBx      *IQSqlx
	DBxError error
)

Functions

func ConnectDB

func ConnectDB()

func ConnectDBx

func ConnectDBx()

func DbWithError

func DbWithError(e error) *gorm.DB

func DeleteModelWithAssociations

func DeleteModelWithAssociations(value interface{}, associations ...string) error

func TestDB

func TestDB() (*gorm.DB, error)

func Transact

func Transact(db *gorm.DB, txFunc func(*gorm.DB) error) (err error)

func UndeleteOrCreate

func UndeleteOrCreate(model interface{}, query string, args ...interface{}) error

Types

type IQModel

type IQModel interface {
	TableName() string
}

type IQSqlx

type IQSqlx struct {
	X *sqlx.DB
}

func (IQSqlx) MapById

func (db IQSqlx) MapById(mappable Mappable, query string, params ...interface{}) error

Takes a map[string]struct, populates the stuct, and sets the map keys to the column specified by the mappable interface

type JsonB

type JsonB map[string]interface{}

func (*JsonB) Scan

func (j *JsonB) Scan(src interface{}) error

func (JsonB) Value

func (j JsonB) Value() (driver.Value, error)

type Mappable

type Mappable interface {
	IdColumn() string
}

type QueryParser

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

func (QueryParser) Get

func (qp QueryParser) Get(name string) (string, error)

Get is a shortcut for r.Parse(), passing nil as data.

func (QueryParser) Parse

func (qp QueryParser) Parse(name string, data interface{}) (string, error)

func (QueryParser) ParseWithValueHolders

func (qp QueryParser) ParseWithValueHolders(name string, numfields int, numEntities int) (string, error)

func (*QueryParser) SetFileFromBindata

func (qp *QueryParser) SetFileFromBindata(path string) error

type Scope

type Scope func(db *gorm.DB) *gorm.DB

Jump to

Keyboard shortcuts

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