pgxz

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count[T IModel](db *PgDb, whereSql string, whereArgs ...any) (int64, error)

func Create

func Create(db *PgDb, col ICol) error

func CreateAndReturn added in v0.0.3

func CreateAndReturn[T IModel](db *PgDb, col ICol) (*T, error)

func GetOne

func GetOne[T IModel](db *PgDb, whereSql string, whereArgs ...any) (*T, error)

func Update

func Update(db *PgDb, updates ICol, whereSql string, whereArgs ...any) error

Types

type Col

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

func (*Col) Init

func (c *Col) Init()

func (*Col) Mapping

func (c *Col) Mapping() map[string]any

func (*Col) Set

func (c *Col) Set(fn string, v any)

func (*Col) SetIfNotNil

func (c *Col) SetIfNotNil(fn string, v any)

type ICol

type ICol interface {
	Init()
	Set(fn string, v any)
	SetIfNotNil(fn string, v any)
	TableName() string
	Keys() []string
	Mapping() map[string]any
}

type IModel

type IModel interface {
	TableName() string
}

type PgDb

type PgDb struct {
	*pgxpool.Pool
}

func New

func New(pool *pgxpool.Pool) *PgDb

Jump to

Keyboard shortcuts

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