options.go 596 B

123456789101112131415161718192021222324252627282930
  1. package jwx
  2. import "github.com/lestrrat-go/option"
  3. type identUseNumber struct{}
  4. type Option = option.Interface
  5. type JSONOption interface {
  6. Option
  7. isJSONOption()
  8. }
  9. type jsonOption struct {
  10. Option
  11. }
  12. func (o *jsonOption) isJSONOption() {}
  13. func newJSONOption(n interface{}, v interface{}) JSONOption {
  14. return &jsonOption{option.New(n, v)}
  15. }
  16. // WithUseNumber controls whether the jwx package should unmarshal
  17. // JSON objects with the "encoding/json".Decoder.UseNumber feature on.
  18. //
  19. // Default is false.
  20. func WithUseNumber(b bool) JSONOption {
  21. return newJSONOption(identUseNumber{}, b)
  22. }