github.com/lestrrat-go/jwx/v2@v2.0.21/options.go (about)

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