These are chat archives for jinzhu/gorm

14th
Mar 2016
Paul Tötterman
@ptman
Mar 14 2016 07:41
@jinzhu thanks for the fix
Jinzhu
@jinzhu
Mar 14 2016 08:54
My pleasure
@tboerger still working on your issue, but it is a take time one
for future issues, maybe better submit a github issues, so it is easier for me to track
Thomas Boerger
@tboerger
Mar 14 2016 09:01
@jinzhu as I said, already solved... Layer 8 problem
Thomas Boerger
@tboerger
Mar 14 2016 09:42
@jinzhu i know... the issue is doubled pointers... type Builds []*Build and Builds *Builds json:"builds"
Jinzhu
@jinzhu
Mar 14 2016 09:49
Ok, got it. but think there might cause some other issues, let me research it anyway.
Thomas Boerger
@tboerger
Mar 14 2016 09:50
sure, do it. i just fixed my issue... but a better error message should help somebody else who's running into that :)
but maybe it's hard to check that
Jinzhu
@jinzhu
Mar 14 2016 09:50
yes, I already spend hours on this, seems not a easy one to fix.
Thomas Boerger
@tboerger
Mar 14 2016 09:51
but anyway... after fixing the PEBKAC issue everything is fine. gorm is awesome :)
Jinzhu
@jinzhu
Mar 14 2016 09:51
cool ;)
Thomas Boerger
@tboerger
Mar 14 2016 09:52
https://github.com/solderapp/solder-api/tree/master/model the number of models is not that big but it's enough to make this application awesome when it's done :P
maybe i need to write a custom validator for unique index checks on the application level
Jinzhu
@jinzhu
Mar 14 2016 09:53
what's the solder basically do?
Thomas Boerger
@tboerger
Mar 14 2016 09:55
there is the technic platform, a launcher for custom minecraft modpacks. solder is an application to upload and combin minecraft mods. those modpacks can be auto imported by the technic platform and that way all clients are getting automatically updated for the modpacks
https://github.com/TechnicPack/TechnicSolder is the upstream project, but as i dont like php and this got missing features i started my own version on go :)
Jinzhu
@jinzhu
Mar 14 2016 09:56
if !db.Where("name = ?", u.Name).Not("id", u.ID).First(&Client{}).RecordNotFound() {
  // add error
}
could be above
Thomas Boerger
@tboerger
Mar 14 2016 09:57
hum... yeah, sounds better :D
Himanshu Raj
@rhim
Mar 14 2016 23:10
Hi Folks, how do I implement the Upsert functionality (update if exist, insert otherwise) in GoRM. I looked at FirstOrInit and FirstOrCreate but both will just return the existing entry. Is there a specific return code that will tell me that call is returning an existing entry, so I can update it.
Also, what's the difference between FirstOrInit and FirstOrCreate?
Thomas Boerger
@tboerger
Mar 14 2016 23:57
FirstOrInit fetches or initializes the record while FirstOrCreate fetches or directly saves the record
Himanshu Raj
@rhim
Mar 14 2016 23:59
So FirstOrInit doesn't perform db write