[go-nuts] Re: Hide struct fields from frontend code (JSON REST API)

2016-11-30 Thread Mirco Zeiss
compiler will warn me when I forget a field. On Monday, November 28, 2016 at 1:35:42 PM UTC+1, Mirco Zeiss wrote: > > Sorry, but it won't work. I'm using the same marshal method when > communicating with my DB as when communicating to my frontend. How can I > tell it to someti

[go-nuts] Re: Hide struct fields from frontend code (JSON REST API)

2016-11-28 Thread Mirco Zeiss
Sorry, but it won't work. I'm using the same marshal method when communicating with my DB as when communicating to my frontend. How can I tell it to sometimes leave out the private fields and sometimes not? On Monday, November 28, 2016 at 6:43:26 AM UTC+1, Mirco Zeiss wrote: > >

[go-nuts] Re: Hide struct fields from frontend code (JSON REST API)

2016-11-27 Thread Mirco Zeiss
That might work. Thank you! Will try and report back. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options,

[go-nuts] Re: Hide struct fields from frontend code (JSON REST API)

2016-11-25 Thread Mirco Zeiss
Yeah, I know. But how do I keep the private fields when talking to my database? On Friday, November 25, 2016 at 2:04:58 PM UTC+1, Tamás Gulácsi wrote: > > Yoz can create a MarshalJSON method on the struct (type), that filters out > private fields, based on either field name, or a field tag. --

[go-nuts] Hide struct fields from frontend code (JSON REST API)

2016-11-25 Thread Mirco Zeiss
I'm using CouchDB to store my models. CouchDB uses JSON and HTTP for communication. Here is a simple user model type User struct { Name string `json:"name"` PasswordHash string `json:"passwordHash"` } On the other side I'm also using JSON over HTTP to communicate with my frontend code. Obvi