fix: channel remark ignore issue - #1996
Conversation
WalkthroughThe Channel struct’s Remark field changed from string to pointer to string. The JSON tag was updated from "remark,omitempty" to "remark". GORM type and validation constraints remain the same. This enables nil values for Remark and affects serialization and nil-check behavior. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API
participant Model as Channel Model
participant DB
Client->>API: Create/Update Channel (payload.remark)
API->>Model: Map payload to Channel{ Remark *string }
alt remark provided (non-null)
Model->>DB: INSERT/UPDATE remark=VALUE
DB-->>API: Success
else remark omitted/null
Model->>DB: INSERT/UPDATE remark=NULL
DB-->>API: Success
end
API-->>Client: JSON response with "remark": null or string
Client->>API: Get Channel
API->>DB: SELECT Channel
DB-->>API: row with remark {NULL or string}
API->>Model: Scan to Remark *string
alt Remark is NULL
API-->>Client: "remark": null
else Remark is not NULL
API-->>Client: "remark": "..."
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
model/channel.go (1)
49-49: No Channel.Remark usage found—pointer change is safe. Optional: add a GetRemark() helper for consistency with other pointer fields:func (c *Channel) GetRemark() string { if c.Remark == nil { return "" } return *c.Remark }
fix: channel remark ignore issue
…d-empty-pages fix(anthropic): drop empty Read.pages in responses-to-anthropic tool input
fix: channel remark ignore issue
Summary by CodeRabbit