MCPcopy
hub / github.com/pquerna/ffjson / EncodeFast

Method EncodeFast

ffjson/encoder.go:79–85  ·  view source on GitHub ↗

EncodeFast will unmarshal the data if fast marshall is available. This function can be used if you want to be sure the fast marshal is used or in testing. If you would like to have fallback to encoding/json you can use the regular Encode() method.

(v interface{})

Source from the content-addressed store, hash-verified

77// If you would like to have fallback to encoding/json you can use the
78// regular Encode() method.
79func (e *Encoder) EncodeFast(v interface{}) error {
80 _, ok := v.(marshalerFaster)
81 if !ok {
82 return errors.New("ffjson marshal not available for type " + reflect.TypeOf(v).String())
83 }
84 return e.Encode(v)
85}

Callers 2

TestMarshalEncoderFunction · 0.95
TestMarshalEncoderErrorFunction · 0.95

Calls 2

EncodeMethod · 0.95
StringMethod · 0.65

Tested by 2

TestMarshalEncoderFunction · 0.76
TestMarshalEncoderErrorFunction · 0.76