Data layer restructuring (#997)

* Move query builders to sqlite package
* Add transaction system
* Wrap model resolvers in transaction
* Add error return value for StringSliceToIntSlice
* Update/refactor mutation resolvers
* Convert query builders
* Remove unused join types
* Add stash id unit tests
* Use WAL journal mode
This commit is contained in:
WithoutPants
2021-01-18 12:23:20 +11:00
committed by GitHub
parent 7bae990c67
commit 1e04deb3d4
168 changed files with 12683 additions and 10863 deletions

View File

@@ -35,14 +35,17 @@ func StrMap(vs []string, f func(string) string) []string {
return vsm
}
// StringSliceToIntSlice converts a slice of strings to a slice of ints. If any
// values cannot be parsed, then they are inserted into the returned slice as
// 0.
func StringSliceToIntSlice(ss []string) []int {
// StringSliceToIntSlice converts a slice of strings to a slice of ints.
// Returns an error if any values cannot be parsed.
func StringSliceToIntSlice(ss []string) ([]int, error) {
ret := make([]int, len(ss))
for i, v := range ss {
ret[i], _ = strconv.Atoi(v)
var err error
ret[i], err = strconv.Atoi(v)
if err != nil {
return nil, err
}
}
return ret
return ret, nil
}