reform
reform copied to clipboard
Documentation, examples and spell/grammar checking
What part of reform needs more documentation? Leave a comment. Where will example help? Leave a comment. Found a typo or grammar error? You can fix it right on GitHub.
We can use GitHub wiki, GitHub Pages, Hugo or GitBook for documentation. GORM docs is a good example. Another one – XORM.
We can also use https://asciinema.org for simple demo in README.
If you work with dates (like time.Time) from reform, you have to add in your model method afterFind
which will convert time zones etc. Am I right?
Maybe it is possible to add some helpful tips for different data type to understand the best way?
If you work with dates (like time.Time) from reform, you have to add in your model method afterFind which will convert time zones etc. Am I right?
No, if your database driver is doing a sane thing. But yeah, this need to be documented.
ErrNoRows
can be returned from some methods and is never returned from others. General rule probably can be better documented.
How can I use multiple conditions?
// Find records by IDs. persons, err := DB.FindAllFrom(PersonTable, "id", 1, 2) if err != nil { log.Fatal(err) } for _, p := range persons { fmt.Println(p) }
Allows me to select by id, let's say I want to select by 'id' and 'name' or any other field.
What would my code look like?
Various Find methods accept a single column only. More complex conditions are possible with Select methods:
persons, err := DB.SelectAllFrom(PersonTable, "WHERE id = ? AND name = ?", id, name)