option_helper

package
v1.3.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: MIT Imports: 10 Imported by: 5

Documentation

Index

Constants

View Source
const (
	OPTION_LOGGER      = "logger"
	OPTION_HTTP_CLIENT = "httpClient"
)

Variables

View Source
var (
	WithLogger, GetLogger         = optiongo.New[*logrus.Entry](OPTION_LOGGER)
	WithHTTPClient, GetHTTPClient = optiongo.New[*http.Client](OPTION_HTTP_CLIENT)
)
View Source
var NewOption = NewOptionArr

Functions

func GetValueWithImmutableOption added in v1.1.26

func GetValueWithImmutableOption(getter GetImmutableOptioner, opt objx.Map, key string) *objx.Value

func InvalidArgument

func InvalidArgument(key string) error

func SetenvIfNotExists added in v1.1.18

func SetenvIfNotExists(key, val string)

func Setopt

func Setopt(conds SetoptConds, opts ...SetOptOption) func(...interface{}) error

func ToBool added in v1.0.0

func ToBool(v *bool) func(string, interface{}) error

func ToByte added in v1.0.0

func ToByte(v *byte) func(string, interface{}) error

func ToContext added in v1.1.28

func ToContext(y *context.Context) func(string, interface{}) error

func ToDuration

func ToDuration(v *time.Duration, unit ...time.Duration) func(string, interface{}) error

func ToInt

func ToInt(v *int) func(string, interface{}) error

func ToInt32

func ToInt32(v *int32) func(string, interface{}) error

func ToInt64 added in v1.0.0

func ToInt64(v *int64) func(string, interface{}) error

func ToIsTraced added in v1.1.28

func ToIsTraced(y *bool) func(string, interface{}) error

func ToLogger

func ToLogger(v *log.FieldLogger) func(string, interface{}) error

func ToString

func ToString(v *string) func(string, interface{}) error

func ToStringMap added in v1.1.24

func ToStringMap(v *map[string]interface{}) func(string, interface{}) error

func ToStringMapString added in v1.1.26

func ToStringMapString(v *map[string]string) func(string, interface{}) error

func ToStringSlice added in v1.2.4

func ToStringSlice(v *[]string) func(string, interface{}) error

Types

type GetImmutableOptioner added in v1.1.26

type GetImmutableOptioner interface {
	GetImmutableOption() objx.Map
}

type Option

type Option interface {
	Set(string, interface{})
	Get(string) interface{}
	Keys() []string
	Contains(string) bool
	Update(Option)
	GetString(string) string
	GetStrings(string) []string
	GetInt(string) int
	GetUInt32(string) uint32
	GetUInt64(string) uint64
	GetInt32(string) int32
	GetInt64(string) int64
	GetFloat32(string) float32
	GetFloat64(string) float64
	GetBool(string) bool
	Data() map[string]interface{}
}

func Copy

func Copy(x Option) Option

func NewOptionArr

func NewOptionArr(args ...interface{}) Option

func NewOptionMap

func NewOptionMap(o ...map[string]interface{}) Option

type SetOptOption added in v1.1.16

type SetOptOption func(*SetOptOptions)

func SetSkip added in v1.1.16

func SetSkip(skip bool) SetOptOption

type SetOptOptions added in v1.1.16

type SetOptOptions struct {
	Skip bool
}

func NewSetOptOptions added in v1.1.16

func NewSetOptOptions() *SetOptOptions

type SetoptConds

type SetoptConds map[string]func(string, interface{}) error

Jump to

Keyboard shortcuts

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