Documentation ¶
Index ¶
- type Config
- type FSConfig
- type Factory
- func (f *Factory) MustOpen(ctx context.Context, l L.L, cfg *Config) interface{}
- func (f *Factory) MustOpenString(ctx context.Context, l L.L, text string) interface{}
- func (f *Factory) Open(ctx context.Context, l L.L, cfg *Config) (interface{}, error)
- func (f *Factory) OpenString(ctx context.Context, l L.L, text string) (interface{}, error)
- type GRPCConfig
- type InMemConfig
- type OtherConfig
- type RedisConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // If not empty, used from OpenString. All else ignored. Spec string `envconfig:"SPEC" json:"spec"` // If Type is empty, will try to use FromDefault. Type string `envconfig:"TYPE" json:"type"` GRPC GRPCConfig `envconfig:"GRPC" json:"grpc"` // type="grpc" GORM gormfactory.Config `envconfig:"GORM" json:"gorm"` // type="gorm" Redis RedisConfig `envconfig:"REDIS" json:"redis"` // type="redis" InMem InMemConfig `envconfig:"INMEM" json:"inmem"` // type="inmem" FS FSConfig `envconfig:"FS" json:"fs"` // type="fs" Other OtherConfig `envconfig:"OTHER" json:"other"` // otherwise }
func ParseConfigString ¶
type Factory ¶
type Factory struct { FromDefault func(context.Context, L.L) (interface{}, error) FromGORM func(_ context.Context, _ L.L, _ *gorm.DB) (interface{}, error) FromGRPCConn func(context.Context, L.L, *grpc.ClientConn) (interface{}, error) FromRedis func(context.Context, L.L, *redis.Client) (interface{}, error) FromInMem func(context.Context, L.L, *InMemConfig) (interface{}, error) FromFS func(context.Context, L.L, *FSConfig) (interface{}, error) FromOther func(context.Context, L.L, string, *OtherConfig) (interface{}, error) }
func (*Factory) MustOpenString ¶
type GRPCConfig ¶
type GRPCConfig struct {
HostPort string `envconfig:"HOSTPORT" default:"127.0.0.1:20001" json:"hostport"`
}
type InMemConfig ¶
type InMemConfig struct {
Config string `envconfig:"CONFIG" json:"config"`
}
type OtherConfig ¶
type OtherConfig struct {
Config string `envconfig:"CONFIG" json:"config"`
}
type RedisConfig ¶
type RedisConfig struct {
URL string `envconfig:"URL" default:"redis://localhost:6789/0" json:"url"`
}
Click to show internal directories.
Click to hide internal directories.