Documentation ¶
Overview ¶
Package misc provides miscellaneous functions and types.
Index ¶
- func AttributesSpanDecorator(span trace.Span, params, results map[string]interface{})
- func ListAll[T any](startPage int, listFn func(page int) ([]T, error)) ([]T, error)
- func Map[T, R any](s []T, f func(T) R) []R
- func PtrTernary[T any](cond *bool, ifTrue, ifFalse T) T
- type ErrAtPage
- type Filter
- type Pagination
- type Sort
- type SortBy
- type SortOrder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttributesSpanDecorator ¶
AttributesSpanDecorator is used alongside with gowrap's generated proxy, to format the span with arguments and results as independent span attributes.
Example of go:generate:
//go:generate gowrap gen -g -p . -i tracingClient -t opentelemetry -o client_trace_gen.go
Example of injecting:
someservicepkgClient := someservicepkg.NewtracingClientWithTracing( someservicepkg.NewClient(factory.ObjectRepository()), // original client "someservicepkg", // name of the service that will appear in span gowrap.AttributesSpanDecorator, )
func Map ¶
func Map[T, R any](s []T, f func(T) R) []R
Map applies f to each element of s and returns the result.
func PtrTernary ¶
PtrTernary returns ifTrue if cond is true, ifFalse if cond is false, and empty value otherwise.
Types ¶
type Filter ¶
type Filter[T any] struct { Include []T Exclude []T }
Filter is a filter for a list of items.
type Pagination ¶
Pagination specifies pagination parameters.
func (Pagination) Empty ¶
func (p Pagination) Empty() bool
Empty returns true if pagination is empty.
Click to show internal directories.
Click to hide internal directories.