| 12345678910111213141516171819202122 |
- package middleware
- import "context"
- type Option struct {
- GenHttp bool
- NotAuth bool
- OperationRecord bool
- Path string
- Method string
- }
- type httpOption struct{}
- func NewOptionContext(ctx context.Context, op *Option) context.Context {
- return context.WithValue(ctx, httpOption{}, op)
- }
- func FromOptionContext(ctx context.Context) (*Option, bool) {
- op, ok := ctx.Value(httpOption{}).(*Option)
- return op, ok
- }
|