🔧 **fix(model, controller): robust serialization for ChannelInfo & correct Vertex-AI key storage**
Summary
1. **model/channel.go**
• Replaced the pointer-only `Value()` with a value-receiver implementation
• GORM can now marshal both `ChannelInfo` and `*ChannelInfo`, eliminating
`unsupported type model.ChannelInfo` runtime error.
2. **controller/channel.go**
• Refactored `getVertexArrayKeys()` – every element is now
- passed through `json.Marshal` when not already a string
- trimmed & validated before insertion
• Guarantees each service-account key is persisted as a **pure JSON string**
instead of the previous `map[...]` dump.
Result
• Channel creation / update succeeds without SQL driver errors.
• Vertex-AI batch & multi-key uploads are stored in canonical JSON, ready for
downstream SDKs to consume.
This commit is contained in:
@@ -53,8 +53,8 @@ type ChannelInfo struct {
|
||||
}
|
||||
|
||||
// Value implements driver.Valuer interface
|
||||
func (c *ChannelInfo) Value() (driver.Value, error) {
|
||||
return common.EncodeJson(c)
|
||||
func (c ChannelInfo) Value() (driver.Value, error) {
|
||||
return common.EncodeJson(&c)
|
||||
}
|
||||
|
||||
// Scan implements sql.Scanner interface
|
||||
|
||||
Reference in New Issue
Block a user