pg

package
v0.0.0-...-bff9524 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const SlowQueryThreshold = 250 * time.Millisecond

Variables

This section is empty.

Functions

func IsNetworkError

func IsNetworkError(err error) bool

Types

type CircuitBreaker

type CircuitBreaker interface {
	IsAvailable() bool
	Break()
	BreakOnNetworkError(err error) bool
}

type Client

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

func New

func New(params ClientParams) (Client, error)

func (Client) Break

func (c Client) Break()

func (Client) BreakOnNetworkError

func (c Client) BreakOnNetworkError(err error) bool

func (Client) GetCircuitBreaker

func (c Client) GetCircuitBreaker() CircuitBreaker

func (Client) IsAvailable

func (c Client) IsAvailable() bool

func (Client) Open

func (c Client) Open(config gorm.Config) (*gorm.DB, error)

func (Client) Shutdown

func (c Client) Shutdown(ctx context.Context) error

type ClientParams

type ClientParams struct {
	User     string
	Password string
	Host     string
	Port     uint
	DBName   string

	MaxIdleConns *int
	MaxOpenConns *int

	CircuitBreakerCheckInterval *time.Duration
}

func (ClientParams) String

func (cp ClientParams) String() string

Jump to

Keyboard shortcuts

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