You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

删除ObjectBox-Go模型结构体后未从objectbox-model.json移除导致报错

ObjectBox-Go移除模型结构体后模型未从配置文件中移除的问题

移除ObjectBox-Go的模型结构体后,我期望该模型能从objectbox-model.json中移除,但它仍被列在其中,导致objectbox-model.go出现错误。

我的代码文件

structs.go

//go:generate go run github.com/objectbox/objectbox-go/cmd/objectbox-gogen clean .
//go:generate go run github.com/objectbox/objectbox-go/cmd/objectbox-gogen

package main

// ToBeRemoved is an entity that should be removed from the objectbox-model.json.
// type ToBeRemoved struct {
//  Id   uint64 `objectbox:"id"`
//  Name string
// }

type ToBeKept struct {
    Id   uint64 `objectbox:"id"`
    Name string
}

objectbox-model.json

{
  "_note1": "KEEP THIS FILE! Check it into a version control system (VCS) like git.",
  "_note2": "ObjectBox manages crucial IDs for your object model. See docs for details.",
  "_note3": "If you have VCS merge conflicts, you must resolve them according to ObjectBox docs.",
  "entities": [
    {
      "id": "1:3079339562650722594",
      "lastPropertyId": "2:305721489019317394",
      "name": "ToBeRemoved",
      "properties": [
        {
          "id": "1:480091436726252863",
          "name": "Id",
          "type": 6,
          "flags": 1
        },
        {
          "id": "2:305721489019317394",
          "name": "Name",
          "type": 9
        }
      ]
    },
    {
      "id": "2:3058164914484646824",
      "lastPropertyId": "2:8297323123436003017",
      "name": "ToBeKept",
      "properties": [
        {
          "id": "1:6680719812996421489",
          "name": "Id",
          "type": 6,
          "flags": 1
        },
        {
          "id": "2:8297323123436003017",
          "name": "Name",
          "type": 9
        }
      ]
    }
  ],
  "lastEntityId": "2:3058164914484646824",
  "lastIndexId": "",
  "lastRelationId": "",
  "modelVersion": 5,
  "modelVersionParserMinimum": 5,
  "retiredEntityUids": [],
  "retiredIndexUids": [],
  "retiredPropertyUids": [],
  "retiredRelationUids": [],
  "version": 1
}

运行go generate后,我期望"ToBeRemoved"实体能从objectbox-model.json中移除。我已准备好包含上述两个主要文件的复现项目。

相关信息

我在Stack Overflow上找到相关问题:Objectbox-go: deleting model class;Github上有对应的Issue以及修复该问题的PR,但即使使用包含该PR的最新版本,仍能复现此问题。

请问我是否操作有误?


内容的提问来源于stack exchange,提问作者Jelle

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.23 10:02:30