IssueRaiser

This is actually a rather annoying problem.

This is actually a rather annoying problem. This is what I'm doing temporarily (all fields have the "omitempty" tag): Fetch struct A from DB Unmarshal JSON data into &A Unset read-only fields of A Save A to DB It's very inefficient but it beats dealing with bugs caused by various flags not being set (or being unset). I'll switch to using pointers to boolean, int and string since most other (non-trivial) fields are pointers anyway. I'm not happy about the indirection, but it's certainly much faster than the current database roundtrip I'm performing. And for anyone shouting 'Rust' - there's always going to be that perfect language out there, at the end of the rainbow.

Posted by optymizer on May 30, 2014, 12:09 AM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.9,500 issues0 comments

hackernews (Other)

This is actually a rather annoying problem.

optymizerMay 30, 2014, 12:09 AM

This is actually a rather annoying problem. This is what I'm doing temporarily (all fields have the "omitempty" tag): Fetch struct A from DB Unmarshal JSON data into &A Unset read-only fields of A Save A to DB It's very inefficient but it beats dealing with bugs caused by various flags not being set (or being unset). I'll switch to using pointers to boolean, int and string since most other (non-trivial) fields are pointers anyway. I'm not happy about the indirection, but it's certainly much faster than the current database roundtrip I'm performing. And for anyone shouting 'Rust' - there's always going to be that perfect language out there, at the end of the rainbow.

Comments (0)

No comments yet. Start the discussion.

Comment on this issue