pgh

package module
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 1 Imported by: 0

README

PGH

A Go package that provides helper functions to combine the power of:

Go Reference CI Status Go Report Card

Purpose and Core Functionality

The PGH project is a Go package that provides helper functions to combine the power of several libraries:

  • Squirrel: SQL builder
  • pgx: PGX PostgreSQL driver
  • database/sql: Golang SQL package
  • scany: Scanning query results into Golang structs

Requirements

  • Go 1.23 or higher

Key Features and Capabilities

  • Helper functions for building SQL queries using Squirrel
  • Functions for executing SQL queries and handling results using pgx
  • Support for various query types, including modification queries, select queries, and batch queries
  • Options for adding conditions, sorting, searching, and pagination to queries
  • PostgreSQL error handling with specific error code support

Additional Functionality

Getting Started

# general functionality
go get github.com/n-r-w/pgh/v2
# pgx + squirrel + scany
go get github.com/n-r-w/pgh/v2/px
# database/sql + squirrel + scany
go get github.com/n-r-w/pgh/v2/pq

Usage Examples

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Builder

func Builder() sq.StatementBuilderType

Builder creates a new instance of squirrel.StatementBuilderType for building queries

func TruncSQL

func TruncSQL(sql string) string

TruncSQL truncates sql to sqlTruncLen characters.

Types

type Args

type Args []any

Args is a slice of values for binding. Used to explicitly separate query parameters from other arguments.

Directories

Path Synopsis
Package filter ...
Package filter ...
px
Package px is a generated GoMock package.
Package px is a generated GoMock package.
db
Package db is a generated GoMock package.
Package db is a generated GoMock package.
db/conn
Package conn is a generated GoMock package.
Package conn is a generated GoMock package.
Package txmgr is a generated GoMock package.
Package txmgr is a generated GoMock package.

Jump to

Keyboard shortcuts

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