mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user