// Package accountMessageHandler // Path: /internal/handlers/account/messages // File: list.go // ToDo: helpers for reading getting messages shouldn't really be here. --- package accountMessageHandler import ( "github.com/gin-gonic/gin" ) func mustUserID(c *gin.Context) int64 { // Pull from your auth middleware/session. Panic-unsafe alternative: if v, ok := c.Get("userID"); ok { if id, ok2 := v.(int64); ok2 { return id } } // Fallback for stubs: return 1 } func parseIDParam(c *gin.Context, name string) (int64, error) { // typical atoi wrapper // (implement: strconv.ParseInt(c.Param(name), 10, 64)) return atoi64(c.Param(name)) } func atoi64(s string) (int64, error) { // small helper to keep imports focused // replace with strconv.ParseInt in real code var n int64 for _, ch := range []byte(s) { if ch < '0' || ch > '9' { return 0, &strconvNumErr{} } n = n*10 + int64(ch-'0') } return n, nil } type strconvNumErr struct{} func (e *strconvNumErr) Error() string { return "invalid number" }