pgutil

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const DuplicateKeyErrorPrefix = "ERROR #23505 duplicate key value violates unique constraint"

Variables

This section is empty.

Functions

func ErrIsDuplicateKey

func ErrIsDuplicateKey(err error) bool

func NilifyErrDuplicateKey

func NilifyErrDuplicateKey(err error) error

func SelectArrayAny

func SelectArrayAny(db *pg.DB, table, arrayCol, arrayVar string, res any) error

func SelectTagHistogramResults

func SelectTagHistogramResults(db *pg.DB, table, tags, tag string, res any) error

func TagHistogramSQL

func TagHistogramSQL(table, tags, tag string) string

Types

type PgConn

type PgConn struct {
	Host     string
	Port     string
	Addr     string `josn:"Addr,omitempty"`
	User     string `json:"User,omitempty"`
	Password string `json:"Password,omitempty"`
	Database string `json:"Database,omitempty"`
	SSLMode  string `json:"sslmode,omitempty"`
}

func NewPgConnJSON

func NewPgConnJSON(data []byte) (PgConn, error)

func (*PgConn) Address

func (conn *PgConn) Address() string

func (*PgConn) Client

func (conn *PgConn) Client() *pg.DB

func (*PgConn) Encode

func (conn *PgConn) Encode() string

func (*PgConn) GoPgOptions

func (conn *PgConn) GoPgOptions() *pg.Options

func (*PgConn) Trim

func (conn *PgConn) Trim()

type TagInfo

type TagInfo struct {
	Name  string
	Count int
}

func SelectTagHistogram

func SelectTagHistogram(db *pg.DB, table, tags, tag string) ([]TagInfo, error)

Jump to

Keyboard shortcuts

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