MCPcopy
hub / github.com/spf13/viper / RegisterCodec

Method RegisterCodec

encoding.go:118–127  ·  view source on GitHub ↗

RegisterCodec registers a custom [Codec]. Format is case-insensitive.

(format string, codec Codec)

Source from the content-addressed store, hash-verified

116//
117// Format is case-insensitive.
118func (r *DefaultCodecRegistry) RegisterCodec(format string, codec Codec) error {
119 r.init()
120
121 r.mu.Lock()
122 defer r.mu.Unlock()
123
124 r.codecs[strings.ToLower(format)] = codec
125
126 return nil
127}
128
129// Encoder implements the [EncoderRegistry] interface.
130//

Callers 1

TestDefaultCodecRegistryFunction · 0.80

Calls 1

initMethod · 0.95

Tested by 1

TestDefaultCodecRegistryFunction · 0.64