Weichang Zha
Weichang Zha
**Root Cause:** The issue occurs because `PrepareStmt` is enabled, which triggers schema initialization during the first `First` query for a given model. Schema initialization internally requires a database connection. At...
@LUKIEYF I tested this issue in both SQLite (v3.39.4) and MySQL (v8.0.32) using GORM v1.25.5, and I was not able to reproduce the problem. In my test, I used AutoMigrate...
goctl api swagger: syntax error: expected 'IDENT', got 'struct' and syntax error: for map[string]any
``` type ChatStreamReq { Query string `json:"query"` ConversationId string `json:"conversation_id,optional"` User string `json:"user,optional"` Inputs map[string]interface{} `json:"inputs,optional"` } type ChatStreamResp {} ``` @chowyu12 In Go-Zero's .api syntax: Do not use struct...
goctl api swagger: syntax error: expected 'IDENT', got 'struct' and syntax error: for map[string]any
@chowyu12 🤗
Can there be multiple "with" keywords? Or does it depend on where it is located?
In GORM, when you update a model with a primary key (e.g., `ID`), it automatically adds the primary key to the `WHERE` clause for performance optimization. This ensures only the...
Here's a simple approach: ### 1. **Globally Customize JSON Serialization** * Create a new type `Int64String` that wraps the `int64` type. * Implement the `MarshalJSON` method to convert the `int64`...
In GORM, if a struct already contains a non-zero primary key value, it will automatically add a `WHERE` clause using that primary key when executing queries like `First()`. This optimization...
[API documentation](https://gorm.io/docs/query.html) I found that this section is mentioned in the documentation, though it's not very prominent.  Do you have any recommendations for optimizing this design?
I think the key issue is that the primary key is automatically added as a condition during queries, which can be confusing. @jinzhu Maybe it would be better to add...