postgres

package
v0.0.0-...-5b54b9f Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidDSN indicates an invalid PostgreSQL connection string.
	ErrInvalidDSN = errors.New("invalid PostgreSQL DSN")
	// ErrClientConnection indicates a failure to connect to PostgreSQL.
	ErrClientConnection = errors.New("failed to connect to PostgreSQL server")
	// ErrInvalidDatabase indicates an invalid database name.
	ErrInvalidDatabase = errors.New("invalid database name")
	// ErrInvalidCredentials indicates invalid authentication credentials.
	ErrInvalidCredentials = errors.New("invalid PostgreSQL credentials")
	// ErrInvalidSchema indicates an invalid schema name.
	ErrInvalidSchema = errors.New("invalid schema name")
)

Error variables for wrapping underlying errors.

Functions

This section is empty.

Types

type Config

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

Config - config

type PingConnectionError

type PingConnectionError struct {
	Err error
}

PingConnectionError - error ping connection

func (*PingConnectionError) Error

func (e *PingConnectionError) Error() string

type Store

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

Store implementation of db interface

func New

func New(tracer trace.TracerProvider, metrics *metric.MeterProvider) *Store

New return new instance of Store

func (*Store) GetConn

func (s *Store) GetConn() any

GetConn - get connect

func (*Store) Init

func (s *Store) Init(ctx context.Context) error

Init - initialize

type StoreError

type StoreError struct {
	Op      string
	Err     error
	Details string
}

StoreError is a custom error type for Store operations with added details.

func (*StoreError) Error

func (e *StoreError) Error() string

Error implements the error interface.

func (*StoreError) Unwrap

func (e *StoreError) Unwrap() error

Unwrap allows errors.Is and errors.As to work with StoreError.

type Tracer

type Tracer struct {
	trace.TracerProvider
}

func (*Tracer) TraceQueryEnd

func (*Tracer) TraceQueryEnd(ctx context.Context, _ *pgx.Conn, data pgx.TraceQueryEndData)

func (*Tracer) TraceQueryStart

func (*Tracer) TraceQueryStart(ctx context.Context, _ *pgx.Conn, _ pgx.TraceQueryStartData) context.Context

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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