Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove nullable options #2481

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions codec/reflectcodec/struct_fielder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ const (

// TagValue is the value the tag must have to be serialized.
TagValue = "true"

// TagValue is the value the tag must have to be serialized, this variant
// includes the nullable option
TagWithNullableValue = "true,nullable"
)

var _ StructFielder = (*structFielder)(nil)

type FieldDesc struct {
Index int
MaxSliceLen uint32
Nullable bool
}

// StructFielder handles discovery of serializable fields in a struct.
Expand Down Expand Up @@ -89,17 +84,10 @@ func (s *structFielder) GetSerializedFields(t reflect.Type) ([]FieldDesc, error)
// any tag with the right value
var (
captureField bool
nullable bool
)
for _, tag := range s.tags {
switch field.Tag.Get(tag) {
case TagValue:
captureField = true
case TagWithNullableValue:
if field.Tag.Get(tag) == TagValue {
captureField = true
nullable = true
}
if captureField {
break
}
}
Expand All @@ -121,7 +109,6 @@ func (s *structFielder) GetSerializedFields(t reflect.Type) ([]FieldDesc, error)
serializedFields = append(serializedFields, FieldDesc{
Index: i,
MaxSliceLen: maxSliceLen,
Nullable: nullable,
})
}
s.serializedFieldIndices[t] = serializedFields // cache result
Expand Down
Loading
Loading