client

package
v0.0.0-...-3010e5a Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RetryAttempts = 4
	RetryDelay    = 2 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func BadCli

func BadCli(t testing.TB) *Client

func New

func New(lc fx.Lifecycle, cfg Config, log *zap.Logger) (*Client, error)

New opens new postgres connection, configures it and return prepared client.

func NewTest

func NewTest(t testing.TB) (*Client, func())

NewTest prepares test client.

If error occurred while creating connection then test will be skipped. Second argument cleanup function to close connection and rollback all changes.

func (*Client) L

func (cli *Client) L() *zap.Logger

L return global client logger.

If client is nil object then global logger will be returned.

func (*Client) P

func (cli *Client) P() *pgxpool.Pool

P returns client's configured logger.

If client is nil object then will be returned nil pool.

type Config

type Config interface {
	URI() string
}

Jump to

Keyboard shortcuts

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