File: options.go

package info (click to toggle)
golang-github-lestrrat-go-jwx 2.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,872 kB
  • sloc: sh: 222; makefile: 86; perl: 62
file content (30 lines) | stat: -rw-r--r-- 596 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package jwx

import "github.com/lestrrat-go/option"

type identUseNumber struct{}

type Option = option.Interface

type JSONOption interface {
	Option
	isJSONOption()
}

type jsonOption struct {
	Option
}

func (o *jsonOption) isJSONOption() {}

func newJSONOption(n interface{}, v interface{}) JSONOption {
	return &jsonOption{option.New(n, v)}
}

// WithUseNumber controls whether the jwx package should unmarshal
// JSON objects with the "encoding/json".Decoder.UseNumber feature on.
//
// Default is false.
func WithUseNumber(b bool) JSONOption {
	return newJSONOption(identUseNumber{}, b)
}