flagutil

package
v0.0.0-...-5193d3f Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolPtrValue

func BoolPtrValue(val *bool, p **bool) pflag.Value

func BytesPtrValue

func BytesPtrValue(val []byte, p *[]byte) pflag.Value

func DurationpbSliceValue

func DurationpbSliceValue(val []time.Duration, p *[]*durationpb.Duration) pflag.Value

func DurationpbValue

func DurationpbValue(val *time.Duration, p **durationpb.Duration) pflag.Value

func EnumPtrValue

func EnumPtrValue[E protoenum[E]](val *E, p **E) pflag.Value

func EnumValue

func EnumValue[E protoenum[E]](val E, p *E) pflag.Value

func FloatPtrValue

func FloatPtrValue[T constraints.Float](val *T, p **T) pflag.Value

func IPNetSliceValue

func IPNetSliceValue(val []string, p *[]string) pflag.Value

func IPNetValue

func IPNetValue(val string, p *string) pflag.Value

func IntPtrValue

func IntPtrValue[T constraints.Signed](val *T, p **T) pflag.Value

func LoadDefaults

func LoadDefaults[T FlagSetter](obj T)

func ParseDurationWithExtendedUnits

func ParseDurationWithExtendedUnits(s string) (time.Duration, error)

func Ptr

func Ptr[T any](t T) *T

func SetDefValue

func SetDefValue(fs *pflag.FlagSet, name, value string)

Sets DefValue and calls Value.Set for a flag. Must only be used after calling AddFlagSet and before calling Parse.

func StringPtrValue

func StringPtrValue(val *string, p **string) pflag.Value

func StringToFloat64Value

func StringToFloat64Value(val map[string]float64, p *map[string]float64) pflag.Value

func TimestamppbValue

func TimestamppbValue(val *string, p **timestamppb.Timestamp) pflag.Value

func UintPtrValue

func UintPtrValue[T constraints.Unsigned](val *T, p **T) pflag.Value

Types

type FlagSetter

type FlagSetter interface {
	FlagSet(...string) *pflag.FlagSet
}

Jump to

Keyboard shortcuts

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