mirror of
https://github.com/glanceapp/glance.git
synced 2025-07-07 10:10:10 +02:00
Change custom api int64 types to int
Some of Go's native template functions return int and having to juggle between int and int64 might get messy so we'll try to stick to having a single int type
This commit is contained in:
@ -153,12 +153,12 @@ func (r *decoratedGJSONResult) String(key string) string {
|
|||||||
return r.Get(key).String()
|
return r.Get(key).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) Int(key string) int64 {
|
func (r *decoratedGJSONResult) Int(key string) int {
|
||||||
if key == "" {
|
if key == "" {
|
||||||
return r.Result.Int()
|
return int(r.Result.Int())
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.Get(key).Int()
|
return int(r.Get(key).Int())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) Float(key string) float64 {
|
func (r *decoratedGJSONResult) Float(key string) float64 {
|
||||||
@ -179,11 +179,11 @@ func (r *decoratedGJSONResult) Bool(key string) bool {
|
|||||||
|
|
||||||
var customAPITemplateFuncs = func() template.FuncMap {
|
var customAPITemplateFuncs = func() template.FuncMap {
|
||||||
funcs := template.FuncMap{
|
funcs := template.FuncMap{
|
||||||
"toFloat": func(a int64) float64 {
|
"toFloat": func(a int) float64 {
|
||||||
return float64(a)
|
return float64(a)
|
||||||
},
|
},
|
||||||
"toInt": func(a float64) int64 {
|
"toInt": func(a float64) int {
|
||||||
return int64(a)
|
return int(a)
|
||||||
},
|
},
|
||||||
"add": func(a, b float64) float64 {
|
"add": func(a, b float64) float64 {
|
||||||
return a + b
|
return a + b
|
||||||
|
Reference in New Issue
Block a user