MCPcopy Create free account
hub / github.com/evcc-io/evcc / NewEncoder

Function NewEncoder

util/encode/encode.go:25–31  ·  view source on GitHub ↗

NewEncoder creates a new encoder with the following default conversions: - float NaN/Inf are converted to nil - zero time.Time are converted to nil - durations are converted to seconds using WithDuration() - fmt.Stringer are converted to string - time.Time are converted to RFC3339 string

(opt ...EncoderOption)

Source from the content-addressed store, hash-verified

23// - fmt.Stringer are converted to string
24// - time.Time are converted to RFC3339 string
25func NewEncoder(opt ...EncoderOption) Encoder {
26 res := new(encoder)
27 for _, o := range opt {
28 o(res)
29 }
30 return res
31}
32
33func WithDuration() EncoderOption {
34 return func(e *encoder) {

Callers 3

socket_helper.goFile · 0.92
stateHandlerFunction · 0.92
TestEncodeFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestEncodeFunction · 0.68