Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Propagator ¶
type Propagator struct {
// contains filtered or unexported fields
}
func NewPropagator ¶
func NewPropagator(cookieName string, opts ...PropagatorOption) *Propagator
NewPropagator creates a new instance of the Propagator struct. It takes in a cookieName string and a variadic number of PropagatorOption functions. It returns a pointer to the newly created Propagator.
func (*Propagator) Extract ¶
func (p *Propagator) Extract(req *http.Request) (string, error)
Extract extracts the value of a cookie with the given name from the provided HTTP request. If the cookie is not found, it returns an empty string and an error.
func (*Propagator) Inject ¶
func (p *Propagator) Inject(id string, writer http.ResponseWriter) error
Inject sets a cookie with the provided session ID in the response writer. It only sets the basic attributes of the cookie, while other properties are set using the cookie option.
func (*Propagator) Remove ¶
func (p *Propagator) Remove(writer http.ResponseWriter) error
Remove removes the cookie from the response writer by setting it to expire.
type PropagatorOption ¶
type PropagatorOption func(propagator *Propagator)
func WithCookieOption ¶
func WithCookieOption(opt func(c *http.Cookie)) PropagatorOption
WithCookieOption creates a PropagatorOption that sets the cookie option.