| 1234567891011121314151617181920212223 |
- package middleware
- import "context"
- type Option struct {
- GenHttp bool
- NotAuth bool
- OperationRecord bool
- Path string
- Method string
- AuthorizationsName 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
- }
|