Documentation
¶
Index ¶
- Variables
- func NewConsulClient(addr string) (*api.Client, error)
- func NewNATSClient(opts *NATSOptions, logger *zap.Logger) (*nats.Conn, error)
- func NewPostgresClient(ctx context.Context, url string, options *PostgresOptions) (*pgxpool.Pool, error)
- func NewRedisClient(url string, options *RedisOptions) (*redis.Client, error)
- func NewRedisClusterClient(opts *RedisClusterOptions) (*redis.ClusterClient, error)
- type NATSOptions
- type PostgresOptions
- func (o *PostgresOptions) WithConnMaxLifetime(time time.Duration) *PostgresOptions
- func (o *PostgresOptions) WithConnectTimeout(time time.Duration) *PostgresOptions
- func (o *PostgresOptions) WithDatabase(database string) *PostgresOptions
- func (o *PostgresOptions) WithDialFunc(fn func(ctx context.Context, network, addr string) (net.Conn, error)) *PostgresOptions
- func (o *PostgresOptions) WithHealthCheckPeriod(time time.Duration) *PostgresOptions
- func (o *PostgresOptions) WithHost(host string) *PostgresOptions
- func (o *PostgresOptions) WithMaxCons(amount int32) *PostgresOptions
- func (o *PostgresOptions) WithMinCons(amount int32) *PostgresOptions
- func (o *PostgresOptions) WithPassword(password string) *PostgresOptions
- func (o *PostgresOptions) WithTracerProvider(provider trace.TracerProvider) *PostgresOptions
- func (o *PostgresOptions) WithUsername(username string) *PostgresOptions
- type RedisClusterOptions
- func (o *RedisClusterOptions) WithAddrs(addrs []string) *RedisClusterOptions
- func (o *RedisClusterOptions) WithBackoffTimeouts(min, max time.Duration) *RedisClusterOptions
- func (o *RedisClusterOptions) WithDialTimeout(dialTimeout time.Duration) *RedisClusterOptions
- func (o *RedisClusterOptions) WithMaxRedirects(maxRedirects int) *RedisClusterOptions
- func (o *RedisClusterOptions) WithMaxRetries(maxRetries int) *RedisClusterOptions
- func (o *RedisClusterOptions) WithMinIdleConns(minIdleConns int) *RedisClusterOptions
- func (o *RedisClusterOptions) WithPoolSize(poolSize int) *RedisClusterOptions
- func (o *RedisClusterOptions) WithPoolTimeout(timeout time.Duration) *RedisClusterOptions
- func (o *RedisClusterOptions) WithReadOnlyFlag(readOnly bool) *RedisClusterOptions
- func (o *RedisClusterOptions) WithReadTimeout(timeout time.Duration) *RedisClusterOptions
- func (o *RedisClusterOptions) WithRouteRandomly(randomly bool) *RedisClusterOptions
- func (o *RedisClusterOptions) WithRouterByLatency(routerByLatency bool) *RedisClusterOptions
- func (o *RedisClusterOptions) WithTraceProvider(provider trace.TracerProvider) *RedisClusterOptions
- func (o *RedisClusterOptions) WithWriteTimeout(timeout time.Duration) *RedisClusterOptions
- type RedisOptions
- func (o *RedisOptions) WithAddr(addr string) *RedisOptions
- func (o *RedisOptions) WithConnMaxIdleTimeout(timeout time.Duration) *RedisOptions
- func (o *RedisOptions) WithDealer(fn func(ctx context.Context, network, addr string) (net.Conn, error)) *RedisOptions
- func (o *RedisOptions) WithDialTimeout(timeout time.Duration) *RedisOptions
- func (o *RedisOptions) WithLimiter(limiter redis.Limiter) *RedisOptions
- func (o *RedisOptions) WithMaxActiveConns(maxActiveConns int) *RedisOptions
- func (o *RedisOptions) WithMaxRetries(maxRetries int) *RedisOptions
- func (o *RedisOptions) WithMaxRetryBackoff(time time.Duration) *RedisOptions
- func (o *RedisOptions) WithMinRetryBackoff(time time.Duration) *RedisOptions
- func (o *RedisOptions) WithOnConnect(fn func(ctx context.Context, conn *redis.Conn) error) *RedisOptions
- func (o *RedisOptions) WithPassword(pw string) *RedisOptions
- func (o *RedisOptions) WithPoolSize(poolSize int) *RedisOptions
- func (o *RedisOptions) WithReadTimeout(timeout time.Duration) *RedisOptions
- func (o *RedisOptions) WithTLSConfig(tlsConfig *tls.Config) *RedisOptions
- func (o *RedisOptions) WithTraceProvider(provider trace.TracerProvider) *RedisOptions
- func (o *RedisOptions) WithUsername(username string) *RedisOptions
- func (o *RedisOptions) WithWriteTimeout(timeout time.Duration) *RedisOptions
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultNATSOptions = &NATSOptions{ URL: nats.DefaultURL, Name: "my-nats-client", MaxReconnect: 10, ReconnectWait: 2 * time.Second, }
Functions ¶
func NewNATSClient ¶
func NewNATSClient(opts *NATSOptions, logger *zap.Logger) (*nats.Conn, error)
func NewPostgresClient ¶
func NewRedisClient ¶
func NewRedisClient(url string, options *RedisOptions) (*redis.Client, error)
func NewRedisClusterClient ¶
func NewRedisClusterClient(opts *RedisClusterOptions) (*redis.ClusterClient, error)
Types ¶
type NATSOptions ¶
func (*NATSOptions) WithMaxReconnect ¶
func (o *NATSOptions) WithMaxReconnect(max int) *NATSOptions
func (*NATSOptions) WithName ¶
func (o *NATSOptions) WithName(name string) *NATSOptions
func (*NATSOptions) WithReconnectWait ¶
func (o *NATSOptions) WithReconnectWait(reconnect time.Duration) *NATSOptions
func (*NATSOptions) WithURL ¶
func (o *NATSOptions) WithURL(urls string) *NATSOptions
type PostgresOptions ¶
func NewPostgresOptions ¶
func NewPostgresOptions(url string) *PostgresOptions
func (*PostgresOptions) WithConnMaxLifetime ¶
func (o *PostgresOptions) WithConnMaxLifetime(time time.Duration) *PostgresOptions
func (*PostgresOptions) WithConnectTimeout ¶
func (o *PostgresOptions) WithConnectTimeout(time time.Duration) *PostgresOptions
func (*PostgresOptions) WithDatabase ¶
func (o *PostgresOptions) WithDatabase(database string) *PostgresOptions
func (*PostgresOptions) WithDialFunc ¶
func (o *PostgresOptions) WithDialFunc(fn func(ctx context.Context, network, addr string) (net.Conn, error)) *PostgresOptions
func (*PostgresOptions) WithHealthCheckPeriod ¶
func (o *PostgresOptions) WithHealthCheckPeriod(time time.Duration) *PostgresOptions
func (*PostgresOptions) WithHost ¶
func (o *PostgresOptions) WithHost(host string) *PostgresOptions
func (*PostgresOptions) WithMaxCons ¶
func (o *PostgresOptions) WithMaxCons(amount int32) *PostgresOptions
func (*PostgresOptions) WithMinCons ¶
func (o *PostgresOptions) WithMinCons(amount int32) *PostgresOptions
func (*PostgresOptions) WithPassword ¶
func (o *PostgresOptions) WithPassword(password string) *PostgresOptions
func (*PostgresOptions) WithTracerProvider ¶
func (o *PostgresOptions) WithTracerProvider(provider trace.TracerProvider) *PostgresOptions
func (*PostgresOptions) WithUsername ¶
func (o *PostgresOptions) WithUsername(username string) *PostgresOptions
type RedisClusterOptions ¶
type RedisClusterOptions struct { *redis.ClusterOptions // contains filtered or unexported fields }
func NewRedisClusterOptions ¶
func NewRedisClusterOptions(addrs []string) *RedisClusterOptions
func (*RedisClusterOptions) WithAddrs ¶
func (o *RedisClusterOptions) WithAddrs(addrs []string) *RedisClusterOptions
func (*RedisClusterOptions) WithBackoffTimeouts ¶
func (o *RedisClusterOptions) WithBackoffTimeouts(min, max time.Duration) *RedisClusterOptions
func (*RedisClusterOptions) WithDialTimeout ¶
func (o *RedisClusterOptions) WithDialTimeout(dialTimeout time.Duration) *RedisClusterOptions
func (*RedisClusterOptions) WithMaxRedirects ¶
func (o *RedisClusterOptions) WithMaxRedirects(maxRedirects int) *RedisClusterOptions
func (*RedisClusterOptions) WithMaxRetries ¶
func (o *RedisClusterOptions) WithMaxRetries(maxRetries int) *RedisClusterOptions
func (*RedisClusterOptions) WithMinIdleConns ¶
func (o *RedisClusterOptions) WithMinIdleConns(minIdleConns int) *RedisClusterOptions
func (*RedisClusterOptions) WithPoolSize ¶
func (o *RedisClusterOptions) WithPoolSize(poolSize int) *RedisClusterOptions
func (*RedisClusterOptions) WithPoolTimeout ¶
func (o *RedisClusterOptions) WithPoolTimeout(timeout time.Duration) *RedisClusterOptions
func (*RedisClusterOptions) WithReadOnlyFlag ¶
func (o *RedisClusterOptions) WithReadOnlyFlag(readOnly bool) *RedisClusterOptions
func (*RedisClusterOptions) WithReadTimeout ¶
func (o *RedisClusterOptions) WithReadTimeout(timeout time.Duration) *RedisClusterOptions
func (*RedisClusterOptions) WithRouteRandomly ¶
func (o *RedisClusterOptions) WithRouteRandomly(randomly bool) *RedisClusterOptions
func (*RedisClusterOptions) WithRouterByLatency ¶
func (o *RedisClusterOptions) WithRouterByLatency(routerByLatency bool) *RedisClusterOptions
func (*RedisClusterOptions) WithTraceProvider ¶
func (o *RedisClusterOptions) WithTraceProvider(provider trace.TracerProvider) *RedisClusterOptions
func (*RedisClusterOptions) WithWriteTimeout ¶
func (o *RedisClusterOptions) WithWriteTimeout(timeout time.Duration) *RedisClusterOptions
type RedisOptions ¶
type RedisOptions struct { *redis.Options // contains filtered or unexported fields }
func NewRedisOptions ¶
func NewRedisOptions(url string) *RedisOptions
func (*RedisOptions) WithAddr ¶
func (o *RedisOptions) WithAddr(addr string) *RedisOptions
func (*RedisOptions) WithConnMaxIdleTimeout ¶
func (o *RedisOptions) WithConnMaxIdleTimeout(timeout time.Duration) *RedisOptions
func (*RedisOptions) WithDealer ¶
func (o *RedisOptions) WithDealer(fn func(ctx context.Context, network, addr string) (net.Conn, error)) *RedisOptions
func (*RedisOptions) WithDialTimeout ¶
func (o *RedisOptions) WithDialTimeout(timeout time.Duration) *RedisOptions
func (*RedisOptions) WithLimiter ¶
func (o *RedisOptions) WithLimiter(limiter redis.Limiter) *RedisOptions
func (*RedisOptions) WithMaxActiveConns ¶
func (o *RedisOptions) WithMaxActiveConns(maxActiveConns int) *RedisOptions
func (*RedisOptions) WithMaxRetries ¶
func (o *RedisOptions) WithMaxRetries(maxRetries int) *RedisOptions
func (*RedisOptions) WithMaxRetryBackoff ¶
func (o *RedisOptions) WithMaxRetryBackoff(time time.Duration) *RedisOptions
func (*RedisOptions) WithMinRetryBackoff ¶
func (o *RedisOptions) WithMinRetryBackoff(time time.Duration) *RedisOptions
func (*RedisOptions) WithOnConnect ¶
func (o *RedisOptions) WithOnConnect(fn func(ctx context.Context, conn *redis.Conn) error) *RedisOptions
func (*RedisOptions) WithPassword ¶
func (o *RedisOptions) WithPassword(pw string) *RedisOptions
func (*RedisOptions) WithPoolSize ¶
func (o *RedisOptions) WithPoolSize(poolSize int) *RedisOptions
func (*RedisOptions) WithReadTimeout ¶
func (o *RedisOptions) WithReadTimeout(timeout time.Duration) *RedisOptions
func (*RedisOptions) WithTLSConfig ¶
func (o *RedisOptions) WithTLSConfig(tlsConfig *tls.Config) *RedisOptions
func (*RedisOptions) WithTraceProvider ¶
func (o *RedisOptions) WithTraceProvider(provider trace.TracerProvider) *RedisOptions
func (*RedisOptions) WithUsername ¶
func (o *RedisOptions) WithUsername(username string) *RedisOptions
func (*RedisOptions) WithWriteTimeout ¶
func (o *RedisOptions) WithWriteTimeout(timeout time.Duration) *RedisOptions
Click to show internal directories.
Click to hide internal directories.