You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Code generator has problems with binding Time properties of inlined struct.
Consider following structs:
type Metadata struct {
Id uint64
Created time.Time `objectbox:"date"`
Modified time.Time `objectbox:"date"`
}
type BlogPost struct {
Metadata `objectbox:"inline"`
Title string
Content string
}
Generated entity definition does not contain Created and Modified properties:
var BlogPostBinding = blogPost_EntityInfo{
Entity: objectbox.Entity{
Id: 6,
},
Uid: 5152285828382661602,
}
// BlogPost_ contains type-based Property helpers to facilitate some common operations such as Queries.
var BlogPost_ = struct {
Id *objectbox.PropertyUint64
Title *objectbox.PropertyString
Content *objectbox.PropertyString
}{
Id: &objectbox.PropertyUint64{
BaseProperty: &objectbox.BaseProperty{
Id: 1,
Entity: &BlogPostBinding.Entity,
},
},
Title: &objectbox.PropertyString{
BaseProperty: &objectbox.BaseProperty{
Id: 2,
Entity: &BlogPostBinding.Entity,
},
},
Content: &objectbox.PropertyString{
BaseProperty: &objectbox.BaseProperty{
Id: 3,
Entity: &BlogPostBinding.Entity,
},
},
}
Additionally Load function looks like this (notice Created and Modified properties):
func (blogPost_EntityInfo) Load(ob *objectbox.ObjectBox, bytes []byte) (interface{}, error) {
if len(bytes) == 0 { // sanity check, should "never" happen
return nil, errors.New("can't deserialize an object of type 'BlogPost' - no data received")
}
var table = &flatbuffers.Table{
Bytes: bytes,
Pos: flatbuffers.GetUOffsetT(bytes),
}
var propId = table.GetUint64Slot(4, 0)
return &BlogPost{
Metadata: Metadata{
Id: propId,
Created: Time{},
Modified: Time{},
},
Title: fbutils.GetStringSlot(table, 6),
Content: fbutils.GetStringSlot(table, 8),
}, nil
}
Expected behaviour: Inlined struct time properties are properly bound (just like regular properties)
Code generator has problems with binding Time properties of inlined struct.
Consider following structs:
Generated entity definition does not contain Created and Modified properties:
Additionally Load function looks like this (notice Created and Modified properties):
Expected behaviour: Inlined struct time properties are properly bound (just like regular properties)
Objectbox version: 1.7.0
Objectbox generator version: 0.13.0
The text was updated successfully, but these errors were encountered: