These are chat archives for gin-gonic/gin

4th
Mar 2016
Thomas Boerger
@tboerger
Mar 04 2016 08:20
is there some builtin validation of form data in combination with gorm? like checking unique constraints...
Dean Karn
@joeybloggs
Mar 04 2016 11:58
You can use validator, gin's default validator, register gorms SQL field types (one time thing) and then register a Struct Validation function where you can do your unique check or register a new unique validation function if requirements are simple. Please see https://github.com/go-playground/validator/blob/v8/README.md and look at the "Custom Field Type" and "Struct Level Validation" examples
Thomas Boerger
@tboerger
Mar 04 2016 13:37
thanks
Dean Karn
@joeybloggs
Mar 04 2016 13:39
if you need any help just let me know
Thomas Boerger
@tboerger
Mar 04 2016 13:40
currently i'm fighting more with gorm and not with gin :D
Dean Karn
@joeybloggs
Mar 04 2016 13:40
I can;t say that I’ve used Gorm, so kinda on your own there
Thomas Boerger
@tboerger
Mar 04 2016 13:41
i'm not sure if gorm was the best choice...
Dean Karn
@joeybloggs
Mar 04 2016 13:42
I mostly use NOSQL databases so I’m not sure about what good sql libraries are out there, but can always check out awesome-go and libsclub to see some more
Kevin Eaton
@kevineaton
Mar 04 2016 22:54
Hi everyone! First, I love Gin and have migrated a bunch of projects over to it. However, I seem to be having a tough time getting unit test coverage on the Gin end points and I am sure it is because I am such a noob. Essentially, is there a guide or tutorial for how to adequately test the end points? Or is there a good mocking tool I should use? Again, I am a noob at Go and specifically Gin, so any help would be appreciated!