...

Source file src/github.com/lestrrat-go/jwx/internal/json/goccy.go

Documentation: github.com/lestrrat-go/jwx/internal/json

     1  // +build jwx_goccy
     2  
     3  package json
     4  
     5  import (
     6  	"io"
     7  
     8  	"github.com/goccy/go-json"
     9  )
    10  
    11  type Decoder = json.Decoder
    12  type Delim = json.Delim
    13  type Encoder = json.Encoder
    14  type Marshaler = json.Marshaler
    15  type Number = json.Number
    16  type RawMessage = json.RawMessage
    17  type Unmarshaler = json.Unmarshaler
    18  
    19  func Engine() string {
    20  	return "github.com/goccy/go-json"
    21  }
    22  
    23  // NewDecoder respects the values specified in DecoderSettings,
    24  // and creates a Decoder that has certain features turned on/off
    25  func NewDecoder(r io.Reader) *json.Decoder {
    26  	dec := json.NewDecoder(r)
    27  
    28  	muGlobalConfig.RLock()
    29  	if useNumber {
    30  		dec.UseNumber()
    31  	}
    32  	muGlobalConfig.RUnlock()
    33  
    34  	return dec
    35  }
    36  
    37  // NewEncoder is just a proxy for "encoding/json".NewEncoder
    38  func NewEncoder(w io.Writer) *json.Encoder {
    39  	return json.NewEncoder(w)
    40  }
    41  
    42  // Marshal is just a proxy for "encoding/json".Marshal
    43  func Marshal(v interface{}) ([]byte, error) {
    44  	return json.Marshal(v)
    45  }
    46  
    47  // MarshalIndent is just a proxy for "encoding/json".MarshalIndent
    48  func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error) {
    49  	return json.MarshalIndent(v, prefix, indent)
    50  }
    51  

View as plain text