Skip to content

Commit b65e945

Browse files
GODRIVER-3455 Remove defaultValueEncoderFunc
1 parent cf3a91e commit b65e945

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

bson/bsoncodec.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -139,18 +139,6 @@ func (fn ValueEncoderFunc) EncodeValue(ec EncodeContext, vw ValueWriter, val ref
139139
return fn(ec, vw, val)
140140
}
141141

142-
// defaultValueEncoderFunc is an adapter function that allows a function with
143-
// the correct signature to be used as a ValueEncoder. This differentiates
144-
// between user-defined ValueEncoders and driver-defined ValueEncoders with the
145-
// goal of forgoing drvier-defined behavior in favor of a reflection-free option
146-
// if one exists.
147-
type defaultValueEncoderFunc func(EncodeContext, ValueWriter, reflect.Value) error
148-
149-
// EncodeValue implements the ValueEncoder interface.
150-
func (fn defaultValueEncoderFunc) EncodeValue(ec EncodeContext, vw ValueWriter, val reflect.Value) error {
151-
return fn(ec, vw, val)
152-
}
153-
154142
// reflectFreeValueEncoder is a reflect-free version of ValueEncoder.
155143
type reflectFreeValueEncoder interface {
156144
EncodeValue(ec EncodeContext, vw ValueWriter, val any) error

bson/registry.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,7 @@ func (r *Registry) LookupEncoder(valueType reflect.Type) (ValueEncoder, error) {
259259
return nil, errNoEncoder{Type: valueType}
260260
}
261261

262-
if _, ok := enc.(defaultValueEncoderFunc); !ok {
263-
return enc, nil
264-
}
262+
return enc, nil
265263
}
266264

267265
// Next try to get a reflection-free encoder.

0 commit comments

Comments
 (0)