Documentation
¶
Index ¶
- func AppendString(parameterBag bagcontract.ParameterBag, name string, value string) error
- func AppendStringSlice(parameterBag bagcontract.ParameterBag, name string, values []string) error
- func Bool(parameterBag bagcontract.ParameterBag, name string) (bool, bool, error)
- func Duration(parameterBag bagcontract.ParameterBag, name string) (time.Duration, bool, error)
- func Float64(parameterBag bagcontract.ParameterBag, name string) (float64, bool, error)
- func HasNonEmptyString(parameterBag bagcontract.ParameterBag, name string) bool
- func Int(parameterBag bagcontract.ParameterBag, name string) (int64, bool, error)
- func String(parameterBag bagcontract.ParameterBag, name string) (string, bool)
- func StringAt(parameterBag bagcontract.ParameterBag, name string, index int) (string, bool, error)
- func StringMapStringString(parameterBag bagcontract.ParameterBag, name string) (map[string]string, bool, error)
- func StringOrDefault(parameterBag bagcontract.ParameterBag, name string, defaultValue string) string
- func StringSlice(parameterBag bagcontract.ParameterBag, name string) ([]string, bool)
- func StringSliceStrict(parameterBag bagcontract.ParameterBag, name string) ([]string, bool, error)
- func StringStrict(parameterBag bagcontract.ParameterBag, name string) (string, bool, error)
- type ParameterBag
- func (instance *ParameterBag) All() map[string]any
- func (instance *ParameterBag) AppendString(name string, value string) error
- func (instance *ParameterBag) Count() int
- func (instance *ParameterBag) Get(name string) (any, bool)
- func (instance *ParameterBag) Has(name string) bool
- func (instance *ParameterBag) Remove(name string)
- func (instance *ParameterBag) Set(name string, value any)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendString ¶
func AppendString(parameterBag bagcontract.ParameterBag, name string, value string) error
AppendString appends through the concrete bag's own critical section when it has one: the contract-level fallback reads and writes under two separate locks, and two concurrent appends through that window keep only one of the two values — a lost update no race detector reports, because each individual access is locked.
func AppendStringSlice ¶
func AppendStringSlice(parameterBag bagcontract.ParameterBag, name string, values []string) error
func Bool ¶
func Bool(parameterBag bagcontract.ParameterBag, name string) (bool, bool, error)
func Duration ¶
func Duration(parameterBag bagcontract.ParameterBag, name string) (time.Duration, bool, error)
func Float64 ¶
func Float64(parameterBag bagcontract.ParameterBag, name string) (float64, bool, error)
func HasNonEmptyString ¶
func HasNonEmptyString(parameterBag bagcontract.ParameterBag, name string) bool
func Int ¶
func Int(parameterBag bagcontract.ParameterBag, name string) (int64, bool, error)
func String ¶
func String(parameterBag bagcontract.ParameterBag, name string) (string, bool)
func StringAt ¶
func StringAt(parameterBag bagcontract.ParameterBag, name string, index int) (string, bool, error)
func StringMapStringString ¶
func StringMapStringString(parameterBag bagcontract.ParameterBag, name string) (map[string]string, bool, error)
func StringOrDefault ¶
func StringOrDefault(parameterBag bagcontract.ParameterBag, name string, defaultValue string) string
func StringSlice ¶
func StringSlice(parameterBag bagcontract.ParameterBag, name string) ([]string, bool)
func StringSliceStrict ¶
func StringSliceStrict(parameterBag bagcontract.ParameterBag, name string) ([]string, bool, error)
func StringStrict ¶
func StringStrict(parameterBag bagcontract.ParameterBag, name string) (string, bool, error)
Types ¶
type ParameterBag ¶
type ParameterBag struct {
// contains filtered or unexported fields
}
func NewParameterBag ¶
func NewParameterBag() *ParameterBag
func NewParameterBagFromValues ¶
func NewParameterBagFromValues(values url.Values) *ParameterBag
NewParameterBagFromValues keeps the single and the repeated key apart by type: url.Values carries every value as a list even when the key appeared once, so a key with one occurrence is stored as the string it really is — which is what lets String and Input hand it back — while a genuinely repeated key stays a string slice, to be read through StringSlice or StringAt. Reading the repeated one as a single string is refused loudly rather than answered with a guess.
func (*ParameterBag) All ¶
func (instance *ParameterBag) All() map[string]any
All copies as deep as the bag's own writers go: a string slice or a string map handed back live would alias the stored value, and a caller mutating the copy would write into the bag behind its lock. Other value types are opaque to the bag and are handed back as stored.
func (*ParameterBag) AppendString ¶ added in v2.13.0
func (instance *ParameterBag) AppendString(name string, value string) error
AppendString adds one string under the name inside a single critical section: the read-modify-write helper of the same name works over the contract through Get and Set, whose window between the two locks loses one of two concurrent appends without an error — a lost update the race detector cannot see, because every individual access is locked.
func (*ParameterBag) Count ¶
func (instance *ParameterBag) Count() int
func (*ParameterBag) Has ¶
func (instance *ParameterBag) Has(name string) bool
func (*ParameterBag) Remove ¶
func (instance *ParameterBag) Remove(name string)
func (*ParameterBag) Set ¶
func (instance *ParameterBag) Set(name string, value any)