You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficcontrol.apache.org by GitBox <gi...@apache.org> on 2019/02/07 19:15:03 UTC

[GitHub] rob05c commented on issue #3306: Use JSONIntStr for user endpoint

rob05c commented on issue #3306: Use JSONIntStr for user endpoint
URL: https://github.com/apache/trafficcontrol/pull/3306#issuecomment-461558916
 
 
   I see two options:
   1. leave the code, and add a note to the CHANGELOG.md
   2. Change `tc.User` back to `int`s, and anonymously embed a `JSONIntStr` in the TO code, e.g.
   ```
   type TOUser struct {
   	ReqInfo *api.APIInfo `json:"-"`
   	tc.User
   
   	Role            *util.JSONIntStr `json:"role" db:"role"`
   	TenantID        *util.JSONIntStr `json:"tenantId" db:"tenant_id"`
   }
   
   ⋮ 
   
   if user.Role != nil {
     user.User.Role = util.IntPtr(*user.Role)
   }
   ```
   
   I'd lean toward the latter. It's not that much code on our side, and it provides a cleaner user experience. And besides, we're already doing it in other places, e.g. where we need a `pq.Array`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services