Documentation ¶
Overview ¶
mapstruct is similar in idea to mitchellh/mapstructure, with a difference that values are assumed to always be created through json serialization.
Eg. If one would try to directly convert some struct to map[string]any via mapstructure, resulting map wouldn't necessary match json representation of said object, especially if custom UnmarshalJSON are present. Object created by EncodeObject avoids such mismatch.
Index ¶
- Constants
- func ApplyFieldMask(patchee, patcher proto.Message, mask *field_mask.FieldMask)
- func Get(ctx context.Context, url string, headers map[string]string, ...) (string, error)
- func IsHTTPUrl(url string) bool
- func MarshalGob(value interface{}) ([]byte, error)
- func Mod(a, b int) int
- func RemoveFromSlice(a []string, x string) []string
- func Shutdown(shutdowner fx.Shutdowner)
- func SliceContains(a []string, x string) bool
- func SliceFind(a []string, x string) int
- func SliceToMap(a []string) map[string]bool
- func UnmarshalGob(data []byte, value interface{}) error
- type GoLeakDetector
- type MapStruct
Constants ¶
const ( ApertureAgent = "aperture-agent" ApertureController = "aperture-controller" )
Aperture service names.
Variables ¶
This section is empty.
Functions ¶
func ApplyFieldMask ¶
func ApplyFieldMask(patchee, patcher proto.Message, mask *field_mask.FieldMask)
ApplyFieldMask applies the field mask to the patchee message.
func Get ¶
func Get(ctx context.Context, url string, headers map[string]string, timeout time.Duration) (string, error)
Get is a helper function to make a GET request to the specified URL and return the response body as a string.
func MarshalGob ¶ added in v2.2.0
MarshalGob encodes an interface into a byte array.
func RemoveFromSlice ¶
RemoveFromSlice removes x from a and returns the new slice.
func Shutdown ¶
func Shutdown(shutdowner fx.Shutdowner)
Shutdown invokes fx.Shutdowner and logs error if any.
func SliceContains ¶
SliceContains tells whether a contains x.
func SliceFind ¶
SliceFind returns the smallest index i at which x == a[i], or len(a) if there is no such index.
func SliceToMap ¶
SliceToMap converts a slice of string to a map[string]bool.
func UnmarshalGob ¶ added in v2.2.0
UnmarshalGob decodes a byte array into an interface.
Types ¶
type GoLeakDetector ¶
type GoLeakDetector struct {
// contains filtered or unexported fields
}
GoLeakDetector holds options for the goleak detector.
func NewGoLeakDetector ¶
func NewGoLeakDetector() *GoLeakDetector
NewGoLeakDetector creates a new GoLeakDetector with goleakOptions.
func (*GoLeakDetector) AddIgnoreTopFunctions ¶
func (l *GoLeakDetector) AddIgnoreTopFunctions(fs ...string)
AddIgnoreTopFunctions adds functions to ignore in the leak detector.
func (*GoLeakDetector) FindLeaks ¶
func (l *GoLeakDetector) FindLeaks() error
FindLeaks finds memory leaks in the current process.
type MapStruct ¶
MapStruct is an in-memory representation of JSON object.
func ToMapStruct ¶
ToMapStruct encodes any json-serializable struct as Object
json.Unmarshal(obj) and json.Unmarshal(returnedObject) should be equivalent.