Documentation
¶
Index ¶
- func GenerateTimeBasedID() string
- func GetReqId(c context.Context) string
- func NewFromQueue(sig string, q ...any) context.Context
- func NewFromWorker(sig, reqId string) context.Context
- func SetFromConsoleCtx(c console.Context)
- func SetFromRequestHeader(c http.Context)
- func SetHTTPRequestHeader(r *http.Request)
- func ToQueue(c context.Context) (out []queue.Arg)
- type Metadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateTimeBasedID ¶ added in v0.16.4
func GenerateTimeBasedID() string
func GetReqId ¶
GetReqId extract request id from given context. This is a shortcut for Get with ReqId to get the request id from given context.
func NewFromQueue ¶ added in v0.12.0
NewFromQueue capture request/task id from given queue value in job, also set given signature as signature path in metadata context then return the context.
This function expect the request id is in the first argument, and can be safely used if sending the job to queue using ToQueue.
func NewFromWorker ¶ added in v0.12.0
NewFromWorker return new context that has given signature and request id as the metadata inside the context.
func SetFromConsoleCtx ¶ added in v0.16.4
func SetFromRequestHeader ¶
SetFromRequestHeader set any available metadata from given http context in the request header.
func SetHTTPRequestHeader ¶ added in v0.12.0
Types ¶
type Metadata ¶
type Metadata struct {
Authorization string
UserAgent string
CacheControl string
ForwardedFor string
RequestFrom string
DeviceId string
App string
VersionApp string
ReqId string
ReqTags string
ReqUser string
ReqNama string
ReqKodeJabatan string
ReqNamaJabatan string
ReqKodeUker string
ReqNamaUker string
ReqJenisUker string
ReqKodeMainUker string
ReqKodeRegion string
PathGateway string
ApiKey string
UrlPath string // UrlPath may contain the url path information coming from http request
SignaturePath string // SignaturePath may contain the signature command from artisan command
}
Metadata holds any request-scoped shared data within brispot microservice.