client

package
v0.0.0-...-f5bbbf4 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dialer

func Dialer(keepAlive, timeout time.Duration) *net.Dialer

func QuerySearchIDs

func QuerySearchIDs(ctx context.Context, client postgres.Client, table, idCol, whereCond string, whereArgs []interface{}, isDeleted bool, limit, offset uint64) ([]string, error)

Types

type Config

type Config struct {
	Host              string        `json:"host"`
	Port              string        `json:"port"`
	User              string        `json:"user"`
	Password          string        `json:"password"`
	Database          string        `json:"database"`
	PoolSize          int           `json:"pool_size"`
	PoolTimeout       time.Duration `json:"pool_timeout"`
	DialTimeout       time.Duration `json:"dial_timeout"`
	KeepAliveInterval time.Duration `json:"keep_alive_interval"`
	ApplicationName   string        `json:"application_name"`
	SSLMode           string        `json:"ssl_mode"`
	TLSCert           string        `json:"tls_cert"`
	TLSKey            string        `json:"tls_key"`
	TLSCA             string        `json:"tls_ca"`
}

func (*Config) ToPGOptions

func (cfg *Config) ToPGOptions() (*pg.Options, error)

type PostgresClient

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

func New

func New(cfg *Config) (*PostgresClient, error)

func (*PostgresClient) Config

func (c *PostgresClient) Config() *Config

func (*PostgresClient) Delete

func (c *PostgresClient) Delete(ctx context.Context, model ...interface{}) error

func (*PostgresClient) DeletePK

func (c *PostgresClient) DeletePK(ctx context.Context, model ...interface{}) error

func (*PostgresClient) DeleteWhere

func (c *PostgresClient) DeleteWhere(ctx context.Context, model interface{}, where string, params ...interface{}) error

func (*PostgresClient) ForceDeletePK

func (c *PostgresClient) ForceDeletePK(ctx context.Context, model ...interface{}) error

func (*PostgresClient) ForceDeleteWhere

func (c *PostgresClient) ForceDeleteWhere(ctx context.Context, model interface{}, where string, params ...interface{}) error

func (*PostgresClient) Insert

func (c *PostgresClient) Insert(ctx context.Context, model ...interface{}) error

func (PostgresClient) Ping

func (c PostgresClient) Ping(ctx context.Context) error

func (*PostgresClient) Query

func (c *PostgresClient) Query(ctx context.Context, result, query interface{}, params ...interface{}) error

func (*PostgresClient) QueryOne

func (c *PostgresClient) QueryOne(ctx context.Context, result, query interface{}, params ...interface{}) error

func (PostgresClient) RunInTransaction

func (c PostgresClient) RunInTransaction(ctx context.Context, persist func(client postgres.Client) error) (err error)

func (*PostgresClient) Select

func (c *PostgresClient) Select(ctx context.Context, model ...interface{}) error

func (*PostgresClient) SelectDeleted

func (c *PostgresClient) SelectDeleted(ctx context.Context, model ...interface{}) error

func (*PostgresClient) SelectDeletedPK

func (c *PostgresClient) SelectDeletedPK(ctx context.Context, model ...interface{}) error

func (*PostgresClient) SelectDeletedWhere

func (c *PostgresClient) SelectDeletedWhere(ctx context.Context, model interface{}, where string, args ...interface{}) error

func (*PostgresClient) SelectPK

func (c *PostgresClient) SelectPK(ctx context.Context, model ...interface{}) error

func (*PostgresClient) SelectWhere

func (c *PostgresClient) SelectWhere(ctx context.Context, model interface{}, where string, relations []string, params ...interface{}) error

func (*PostgresClient) UndeletePK

func (c *PostgresClient) UndeletePK(ctx context.Context, model ...interface{}) error

func (*PostgresClient) UndeleteWhere

func (c *PostgresClient) UndeleteWhere(ctx context.Context, model interface{}, where string, params ...interface{}) error

func (*PostgresClient) UpdatePK

func (c *PostgresClient) UpdatePK(ctx context.Context, model interface{}) error

func (*PostgresClient) UpdateWhere

func (c *PostgresClient) UpdateWhere(ctx context.Context, model interface{}, where string, params ...interface{}) error

type TLSDialer

type TLSDialer struct {
	Dialer *tls.Dialer
	// contains filtered or unexported fields
}

func NewTLSDialer

func NewTLSDialer(sslMode, host string, keepAlive, timeout time.Duration, tlsOption *tls.Option) (*TLSDialer, error)

func (*TLSDialer) DialContext

func (d *TLSDialer) DialContext(ctx context.Context, network, addr string) (net.Conn, error)

Jump to

Keyboard shortcuts

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