Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Getter ¶
Getter is an interface that retrieves a string value for a string key and can check for the existence of a string key.
type GoMap ¶
type GoMap struct {
// contains filtered or unexported fields
}
GoMap is an implementation of mapper.Map for map[string]string
type Map ¶
Map is an interface that gets and sets the value of string keys to/from string values
type PrimitiveMap ¶
type PrimitiveMap interface {
PrimitiveMapReader
PrimitiveMapWriter
}
PrimitiveMap is capable of reading and writing primitive values to/from a util.Map
func NewCompositionMapper ¶
func NewCompositionMapper(getter Getter, setter Setter) PrimitiveMap
NewCompositionMapper creates a new implementation of a PrimitiveMap composed of a custom Getter implementation and Setter implementation
func NewMapper ¶
func NewMapper(m Map) PrimitiveMap
NewMapper creates a new implementation of a PrimitiveMap
type PrimitiveMapReader ¶
type PrimitiveMapReader interface {
// Has checks if the map contains the given key.
Has(key string) bool
// Get parses an string from the map key parameter. If the value
// is empty, the defaultValue parameter is returned.
Get(key string, defaultValue string) string
// GetInt parses an int from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetInt(key string, defaultValue int) int
// GetInt8 parses an int8 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetInt8(key string, defaultValue int8) int8
// GetInt16 parses an int16 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetInt16(key string, defaultValue int16) int16
// GetInt32 parses an int32 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetInt32(key string, defaultValue int32) int32
// GetInt64 parses an int64 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetInt64(key string, defaultValue int64) int64
// GetUInt parses a uint from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetUInt(key string, defaultValue uint) uint
// GetUInt8 parses a uint8 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetUInt8(key string, defaultValue uint8) uint8
// GetUInt16 parses a uint16 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetUInt16(key string, defaultValue uint16) uint16
// GetUInt32 parses a uint32 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetUInt32(key string, defaultValue uint32) uint32
// GetUInt64 parses a uint64 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetUInt64(key string, defaultValue uint64) uint64
// GetFloat32 parses a float32 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetFloat32(key string, defaultValue float32) float32
// GetFloat64 parses a float64 from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetFloat64(key string, defaultValue float64) float64
// GetBool parses a bool from the map key parameter. If the value
// is empty or fails to parse, the defaultValue parameter is returned.
GetBool(key string, defaultValue bool) bool
// GetDuration parses a time.Duration from the map key parameter. If the
// value is empty to fails to parse, the defaultValue is returned.
GetDuration(key string, defaultValue time.Duration) time.Duration
// GetList returns a string list which contains the value set by key split using the
// provided delimiter with each entry trimmed of space. If the value doesn't exist,
// nil is returned
GetList(key string, delimiter string) []string
}
PrimitiveMapReader is an implementation contract for an object capable of reading primitive values from a util.Map
func NewReadOnlyMapper ¶
func NewReadOnlyMapper(getter Getter) PrimitiveMapReader
NewReadOnlyMapper creates a new implementation of a PrimitiveMapReader
type PrimitiveMapWriter ¶
type PrimitiveMapWriter interface {
// Set sets the map for the key provided using the value provided.
Set(key string, value string) error
// SetInt sets the map to a string formatted int value
SetInt(key string, value int) error
// SetInt8 sets the map to a string formatted int8 value.
SetInt8(key string, value int8) error
// SetInt16 sets the map to a string formatted int16 value.
SetInt16(key string, value int16) error
// SetInt32 sets the map to a string formatted int32 value.
SetInt32(key string, value int32) error
// SetInt64 sets the map to a string formatted int64 value.
SetInt64(key string, value int64) error
// SetUInt sets the map to a string formatted uint value
SetUInt(key string, value uint) error
// SetUInt8 sets the map to a string formatted uint8 value
SetUInt8(key string, value uint8) error
// SetUInt16 sets the map to a string formatted uint16 value
SetUInt16(key string, value uint16) error
// SetUInt32 sets the map to a string formatted uint32 value
SetUInt32(key string, value uint32) error
// SetUInt64 sets the map to a string formatted uint64 value
SetUInt64(key string, value uint64) error
// SetBool sets the map to a string formatted bool value.
SetBool(key string, value bool) error
// SetDuration sets the map to a string formatted time.Duration value
SetDuration(key string, duration time.Duration) error
// SetList sets the map's value at key to a string consistent of each value in the list separated
// by the provided delimiter.
SetList(key string, values []string, delimiter string) error
}
PrimitiveMapWriter is an implementation contract for an object capable of write primitive values to a util.Map
func NewWriteOnlyMapper ¶
func NewWriteOnlyMapper(setter Setter) PrimitiveMapWriter
NewWriteOnlyMapper creates a new implementation of a PrimitiveMapWriter