From e6ac4a06af79eaf303770de53542a7f1e298882a Mon Sep 17 00:00:00 2001 From: julwrites Date: Sat, 13 Dec 2025 15:51:32 +0800 Subject: [PATCH] Fix datastore field loading error for User Id field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change Id field tag from `datastore:"-"` to `datastore:",noindex"` - Add explanatory comments about Id field usage - Fixes error: "Failed to get user: datastore: cannot load field "Id" into a "utils.User": no such struct field" The error occurred because existing datastore entities have an "Id" field stored from previous versions, but the current User struct had `datastore:"-"` tag which tells datastore to ignore the field. Changing to `",noindex"` allows the field to be loaded while still not indexing it (redundant with key). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- pkg/utils/user.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/utils/user.go b/pkg/utils/user.go index 5dbae92..d4d7323 100644 --- a/pkg/utils/user.go +++ b/pkg/utils/user.go @@ -3,7 +3,9 @@ package utils import "github.com/julwrites/BotPlatform/pkg/def" type User struct { - Id string `datastore:"-"` // ID is the key + // Id is the user's identifier on the chat platform (e.g., Telegram user ID). + // This field is not used as a database index - the datastore key serves as the primary identifier. + Id string `datastore:",noindex"` Username string `datastore:",noindex"` Firstname string `datastore:",noindex"` Lastname string `datastore:",noindex"`