objectbox-go
objectbox-go copied to clipboard
Complex fields / structs not working as documented (Golang Example)
Description
The documentation example under “Complex fields / structs” (https://golang.objectbox.io/entity-annotations#complex-fields-structs) doesn’t work as shown. When embedding inline structs without their own ID field, the ObjectBox code generation fails, complaining that the inline struct has “no property recognized as an ID”. It seems every embedded struct also needs an ID.
Basic info
- ObjectBox version v1.9.0 (go) and v4.0.0 (generator)
- Reproducibility: always
- Device: Desktop
- OS: Debian Bookworm
- Runtime: mcr.microsoft.com/devcontainers/go:1.24-bookworm
How to reproduce
Steps to reproduce the behavior:
-
Create a Go struct that embeds another struct without its own
ID, e.g.:package model //go:generate go run github.com/objectbox/objectbox-go/cmd/objectbox-gogen type Metadata struct { Name string Info string } type Task struct { ID uint64 `objectbox:"id"` Title string Metadata Metadata } -
Execute
go generate ./...
Thanks for reporting! We'll try to verify this once there is time.
@gigabaitkajiutec74 Please avoid asking for updates, we will provide them when we have them. Reading and answering comments like this take time away from actually working on tasks.