provider

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = time.Minute
)

Variables

View Source
var ForceDisableTls bool

Functions

func InitGlobalProvider

func InitGlobalProvider(provider *Provider)

func NewDefaultViperProto

func NewDefaultViperProto() *viper.ViperProto

func SetGlobalProvider

func SetGlobalProvider(provider *Provider)

Types

type CompletedConfig

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

func (CompletedConfig) Apply

func (c CompletedConfig) Apply(ctx context.Context) error

Apply set options and something else as global init, act likes New but without Config's instance Apply usually called after Complete

func (CompletedConfig) New

func (c CompletedConfig) New(ctx context.Context) (*Provider, error)

New creates a new server which logically combines the handling chain with the passed server. name is used to differentiate for logging. The handler chain in particular can be difficult as it starts delgating. New usually called after Complete

type Config

type Config struct {
	KeyInViper string
	Viper      *viper.Viper // If set, overrides params below

	Logs       *logs.Config
	OpenTracer *opentrace.Config

	KeyCipher *pasta.Config
	Sql       *sql.Config
	Redis     *redis_.Config
	Consul    *consul.Config
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() *Config

NewConfig returns a Config struct with the default values

func NewViperConfig added in v0.0.17

func NewViperConfig(key string) *Config

NewViperConfig returns a Config struct with the global viper instance key representing a sub tree of this instance. NewViperConfig is case-insensitive for a key.

func (*Config) Complete

func (c *Config) Complete() CompletedConfig

Complete fills in any fields not set that are required to have valid data and can be derived from other fields. If you're going to ApplyOptions, do that first. It's mutating the receiver. ApplyOptions is called inside.

type Provider

type Provider struct {
	ConfigFile string

	Proto *viper_.ViperProto

	KeyCipher       *pasta.Pasta
	SqlDB           *sqlx.DB
	Redis           redis.UniversalClient
	ServiceRegister *consul.ServiceRegister
	ServiceResolver *consul.ServiceResolver
	// contains filtered or unexported fields
}

func GlobalProvider

func GlobalProvider() *Provider

func (*Provider) Context

func (p *Provider) Context() context.Context

func (*Provider) ReloadForever added in v0.0.13

func (p *Provider) ReloadForever()

func (*Provider) SqlDBPing

func (p *Provider) SqlDBPing() error

Jump to

Keyboard shortcuts

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