MCPcopy Index your code
hub / github.com/cockroachdb/errors / RegisterLeafEncoder

Function RegisterLeafEncoder

errbase/encode.go:340–346  ·  view source on GitHub ↗

RegisterLeafEncoder can be used to register new leaf error types to the library. Registered types will be encoded using their own Go type when an error is encoded. Wrappers that have not been registered will be encoded using the opaqueLeaf type. Note: if the error type has been migrated from a prev

(theType TypeKey, encoder LeafEncoder)

Source from the content-addressed store, hash-verified

338// or a different type, ensure that RegisterTypeMigration() was called
339// prior to RegisterLeafEncoder().
340func RegisterLeafEncoder(theType TypeKey, encoder LeafEncoder) {
341 if encoder == nil {
342 delete(leafEncoders, theType)
343 } else {
344 leafEncoders[theType] = encoder
345 }
346}
347
348// LeafEncoder is to be provided (via RegisterLeafEncoder above)
349// by additional wrapper types not yet known to this library.

Callers 8

RegisterLeafEncoderFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.92
initFunction · 0.70
initFunction · 0.70

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…