summaryrefslogtreecommitdiffstats
path: root/modules/base
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2015-08-10 16:52:08 +0800
committerUnknwon <u@gogs.io>2015-08-10 16:52:08 +0800
commit922f3f306239aca309279dbdf1bdedfb9788b6e8 (patch)
tree410c6eb28335f9e0a213da59699053b159f607ea /modules/base
parent17de3ab0a313819bdeb73f3985b61a791ae84696 (diff)
downloadgitea-922f3f306239aca309279dbdf1bdedfb9788b6e8.tar.gz
gitea-922f3f306239aca309279dbdf1bdedfb9788b6e8.zip
finish create issue with labels
Diffstat (limited to 'modules/base')
-rw-r--r--modules/base/tool.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/base/tool.go b/modules/base/tool.go
index 92f493afe2..2435ebe06f 100644
--- a/modules/base/tool.go
+++ b/modules/base/tool.go
@@ -420,3 +420,21 @@ func Subtract(left interface{}, right interface{}) interface{} {
return fleft + float64(rleft) - (fright + float64(rright))
}
}
+
+// StringsToInt64s converts a slice of string to a slice of int64.
+func StringsToInt64s(strs []string) []int64 {
+ ints := make([]int64, len(strs))
+ for i := range strs {
+ ints[i] = com.StrTo(strs[i]).MustInt64()
+ }
+ return ints
+}
+
+// Int64sToMap converts a slice of int64 to a int64 map.
+func Int64sToMap(ints []int64) map[int64]bool {
+ m := make(map[int64]bool)
+ for _, i := range ints {
+ m[i] = true
+ }
+ return m
+}