Skip to content

Commit dc97f09

Browse files
author
Ben Hubbard
committed
Add StructFieldDecodedHook Extension Point
1 parent 1624edc commit dc97f09

File tree

2 files changed

+20
-874
lines changed

2 files changed

+20
-874
lines changed

reflect_extension.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ type Binding struct {
4747
// Can also rename fields by UpdateStructDescriptor.
4848
type Extension interface {
4949
UpdateStructDescriptor(structDescriptor *StructDescriptor)
50+
StructFieldDecodedHook(field string, ptr unsafe.Pointer, typ reflect2.Type)
5051
CreateMapKeyDecoder(typ reflect2.Type) ValDecoder
5152
CreateMapKeyEncoder(typ reflect2.Type) ValEncoder
5253
CreateDecoder(typ reflect2.Type) ValDecoder
@@ -63,6 +64,10 @@ type DummyExtension struct {
6364
func (extension *DummyExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) {
6465
}
6566

67+
// StructFieldDecodedHook No-op
68+
func (extension *DummyExtension) StructFieldDecodedHook(field string, ptr unsafe.Pointer, typ reflect2.Type) {
69+
}
70+
6671
// CreateMapKeyDecoder No-op
6772
func (extension *DummyExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder {
6873
return nil
@@ -99,6 +104,10 @@ type EncoderExtension map[reflect2.Type]ValEncoder
99104
func (extension EncoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) {
100105
}
101106

107+
// StructFieldDecodedHook No-op
108+
func (extension EncoderExtension) StructFieldDecodedHook(field string, ptr unsafe.Pointer, typ reflect2.Type) {
109+
}
110+
102111
// CreateDecoder No-op
103112
func (extension EncoderExtension) CreateDecoder(typ reflect2.Type) ValDecoder {
104113
return nil
@@ -135,6 +144,10 @@ type DecoderExtension map[reflect2.Type]ValDecoder
135144
func (extension DecoderExtension) UpdateStructDescriptor(structDescriptor *StructDescriptor) {
136145
}
137146

147+
// StructFieldDecodedHook No-op
148+
func (extension DecoderExtension) StructFieldDecodedHook(field string, ptr unsafe.Pointer, typ reflect2.Type) {
149+
}
150+
138151
// CreateMapKeyDecoder No-op
139152
func (extension DecoderExtension) CreateMapKeyDecoder(typ reflect2.Type) ValDecoder {
140153
return nil

0 commit comments

Comments
 (0)