diff --git a/schema/field.go b/schema/field.go index b5103d53..7d1a1789 100644 --- a/schema/field.go +++ b/schema/field.go @@ -604,6 +604,22 @@ func (field *Field) setupValuerAndSetter() { if data != nil && *data != nil { field.ReflectValueOf(ctx, value).SetInt(**data) } + case **int: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetInt(int64(**data)) + } + case **int8: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetInt(int64(**data)) + } + case **int16: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetInt(int64(**data)) + } + case **int32: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetInt(int64(**data)) + } case int64: field.ReflectValueOf(ctx, value).SetInt(data) case int: @@ -668,6 +684,22 @@ func (field *Field) setupValuerAndSetter() { if data != nil && *data != nil { field.ReflectValueOf(ctx, value).SetUint(**data) } + case **uint: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetUint(uint64(**data)) + } + case **uint8: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetUint(uint64(**data)) + } + case **uint16: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetUint(uint64(**data)) + } + case **uint32: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetUint(uint64(**data)) + } case uint64: field.ReflectValueOf(ctx, value).SetUint(data) case uint: @@ -720,6 +752,10 @@ func (field *Field) setupValuerAndSetter() { if data != nil && *data != nil { field.ReflectValueOf(ctx, value).SetFloat(**data) } + case **float32: + if data != nil && *data != nil { + field.ReflectValueOf(ctx, value).SetFloat(float64(**data)) + } case float64: field.ReflectValueOf(ctx, value).SetFloat(data) case float32: diff --git a/tests/embedded_struct_test.go b/tests/embedded_struct_test.go index 0d240fd8..3747dad9 100644 --- a/tests/embedded_struct_test.go +++ b/tests/embedded_struct_test.go @@ -107,6 +107,7 @@ func TestEmbeddedPointerTypeStruct(t *testing.T) { ID string Name string Email string + Age int } type HNPost struct {