Documentation ¶
Index ¶
- Constants
- Variables
- func Check(err error, msg string)
- func CheckFeedError(logger *zap.SugaredLogger, err error, msg string)
- func DeduplicateList[T any](pkFun func(element *T) string, elements []*T) []*T
- func GenericCollectionMapper[T, R any](itemsSource []T, transformFn func(T) R) []R
- func RequestIDFromContext(ctx context.Context) string
- func SplitSliceInBatch[T any](size int, collection []T, fn func(batch []T) error) error
- func TimeFromString(input string) (time.Time, error)
- type DefaultHTTPDoer
- type HTTPError
- type SlingHTTPDoer
Constants ¶
View Source
const TimeISO8601 = "2006-01-02"
Variables ¶
View Source
var (
ContextKeyRequestID = contextKey("RequestID")
)
Functions ¶
func CheckFeedError ¶
func CheckFeedError(logger *zap.SugaredLogger, err error, msg string)
CheckFeedError - checks the Feed for errors, except for 403's
func DeduplicateList ¶
DeduplicateList a list of T type and maintains the latest value
func GenericCollectionMapper ¶
func GenericCollectionMapper[T, R any](itemsSource []T, transformFn func(T) R) []R
GenericCollectionMapper will map from []T to []R by providing a transformation function
func RequestIDFromContext ¶
RequestIDFromContext returns the Request ID stored in context or a new RequestID.
func SplitSliceInBatch ¶
SplitSliceInBatch splits a slice into batches and calls the callback function for each batch.
Types ¶
type DefaultHTTPDoer ¶
func (*DefaultHTTPDoer) Error ¶
func (b *DefaultHTTPDoer) Error() interface{}
func (*DefaultHTTPDoer) URL ¶
func (b *DefaultHTTPDoer) URL() string
type HTTPError ¶
type HTTPError struct { StatusCode int `json:"status_code"` Resource string `json:"resource"` Message string `json:"message"` }
HTTPError represents an easy way to pass HttpErrors from Sling
type SlingHTTPDoer ¶
type SlingHTTPDoer struct { Sl *sling.Sling Req *http.Request SuccessV interface{} FailureV interface{} }
func (*SlingHTTPDoer) Error ¶
func (b *SlingHTTPDoer) Error() interface{}
func (*SlingHTTPDoer) URL ¶
func (b *SlingHTTPDoer) URL() string
Click to show internal directories.
Click to hide internal directories.