Documentation ¶
Overview ¶
Package util contains utility functions. Most generally, functions that generate random instances of structs for the purposes of testing. This prevents using hard coded values in unit tests which can create copy/paste bugs.
Index ¶
- func GenerateExpandedMapClaims() jwt.MapClaims
- func GenerateRandomAPIGatewayContext() events.APIGatewayProxyRequestContext
- func GenerateRandomAPIGatewayProxyRequest() events.APIGatewayProxyRequest
- func GenerateRandomInt(N, M int) int
- func GenerateRandomString(n int) string
- func GenerateStandardMapClaims() jwt.MapClaims
- func WrapErrors(err1, err2 error) error
- type MockConst
- type MockGetReq
- type MockItem
- type MockListReq
- type MockPostReq
- type Number
- type StringAliasExample
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateExpandedMapClaims ¶ added in v1.3.3
GenerateExpandedMapClaims returns a random
func GenerateRandomAPIGatewayContext ¶
func GenerateRandomAPIGatewayContext() events.APIGatewayProxyRequestContext
GenerateRandomAPIGatewayContext returns a random instance of events.APIGatewayProxyRequestContext for testing purposes.
func GenerateRandomAPIGatewayProxyRequest ¶
func GenerateRandomAPIGatewayProxyRequest() events.APIGatewayProxyRequest
GenerateRandomAPIGatewayProxyRequest returns a random instance of events.APIGatewayProxyRequest instance for testing purposes.
func GenerateRandomInt ¶
GenerateRandomInt returns a random integer between N and M (inclusive) for testing purposes.
func GenerateRandomString ¶
GenerateRandomString returns a random string of length N for testing purposes.
func GenerateStandardMapClaims ¶ added in v1.3.3
func WrapErrors ¶ added in v1.3.3
Types ¶
type MockGetReq ¶ added in v1.3.3
type MockListReq ¶ added in v1.3.3
type MockListReq struct { Alias StringAliasExample `lambda:"query.alias"` AliasPtr *StringAliasExample `lambda:"query.alias_ptr"` Bool1 bool `lambda:"query.bool1"` Bool2 bool `lambda:"query.bool2"` Bool3 bool `lambda:"query.bool3"` Bool4 bool `lambda:"query.bool4"` Bool5 bool `lambda:"query.bool5"` Bool6 bool `lambda:"query.bool6"` Bool7 bool `lambda:"query.bool7"` Bool8 bool `lambda:"query.bool8"` Bool9 bool `lambda:"query.bool9"` Civil civil.Date `lambda:"query.civil"` CivilPtr *civil.Date `lambda:"query.civilPtr"` CivilPtrNil *civil.Date `lambda:"query.civilPtrNil"` CommaSplit []Number `lambda:"query.commaSplit"` CommaSplitPtr []*Number `lambda:"query.commaSplitPtr"` Const MockConst `lambda:"query.const"` ConstPtr *MockConst `lambda:"query.constPtr"` ConstPtrNil *MockConst `lambda:"query.constPtrNil"` Encoding []string `lambda:"header.Accept-Encoding"` ID string `lambda:"path.id"` IDs []*string `lambda:"query.ids"` Language string `lambda:"header.Accept-Language"` MongoID primitive.ObjectID `lambda:"query.mongoId"` MongoIDPtr *primitive.ObjectID `lambda:"query.mongoIdPtr"` MongoIDPtrNil *primitive.ObjectID `lambda:"query.mongoIdPtrNil"` MongoIDs []primitive.ObjectID `lambda:"query.mongoIds"` MongoIDsPtr []*primitive.ObjectID `lambda:"query.mongoIdsPtr"` Number *float32 `lambda:"query.number"` Numbers []float64 `lambda:"query.numbers"` PBoolOne *bool `lambda:"query.pbool1"` PBoolTwo *bool `lambda:"query.pbool2"` Page int64 `lambda:"query.page"` PageSize *int64 `lambda:"query.page_size"` Terms []string `lambda:"query.terms"` Time time.Time `lambda:"query.time"` TimePtr *time.Time `lambda:"query.timePtr"` TimePtrNil *time.Time `lambda:"query.timePtrNil"` }
type MockPostReq ¶ added in v1.3.3
type StringAliasExample ¶ added in v1.3.3
type StringAliasExample string