option_helper

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2019 License: MIT Imports: 3 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewOption = NewOptionArr

Functions

func InvalidArgument

func InvalidArgument(key string) error

func Setopt

func Setopt(conds SetoptConds) 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 ToDuration

func ToDuration(v *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 ToLogger

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

func ToString

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

Types

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 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