// // options.go // Copyright (C) 2023 tiglog // // Distributed under terms of the MIT license. // package requestid import "github.com/gin-gonic/gin" // Option for queue system type Option func(*config) type ( Generator func() string Handler func(c *gin.Context, requestID string) ) type HeaderStrKey string // WithGenerator set generator function func WithGenerator(g Generator) Option { return func(cfg *config) { cfg.generator = g } } // WithCustomHeaderStrKey set custom header key for request id func WithCustomHeaderStrKey(s HeaderStrKey) Option { return func(cfg *config) { cfg.headerKey = s } } // WithHandler set handler function for request id with context func WithHandler(handler Handler) Option { return func(cfg *config) { cfg.handler = handler } }