postgresql

package
v0.0.0-...-4efd307 Latest Latest
Warning

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

Go to latest
Published: May 2, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DynamicQuery

func DynamicQuery(d DBTX, query string) (string, error)

DynamicQuery returns an SQL query result as JSON.

func New

func New(logger *zap.SugaredLogger, options ...Option) (*pgxpool.Pool, *sql.DB, error)

New instantiates the PostgreSQL database using configuration defined in environment variables.

func TrigramSimilarity

func TrigramSimilarity(field, value string) func(*sql.Selector)

Types

type DBOptions

type DBOptions struct {
	DBName string
}

type DBTX

type DBTX interface {
	Exec(context.Context, string, ...interface{}) (pgconn.CommandTag, error)
	Query(context.Context, string, ...interface{}) (pgx.Rows, error)
	QueryRow(context.Context, string, ...interface{}) pgx.Row
}

type Option

type Option func(*DBOptions)

func WithDBName

func WithDBName(db string) Option

WithDBName sets the postgres database to connect to.

Jump to

Keyboard shortcuts

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