mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-26 12:51:22 +02:00
Make Get return decorated result
This may break existing widgets that rely on .Get returing a raw gjson.Result
This commit is contained in:
parent
d9c934d3eb
commit
84f7286460
@ -311,7 +311,7 @@ func gJsonResultArrayToDecoratedResultArray(results []gjson.Result) []decoratedG
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) Exists(key string) bool {
|
func (r *decoratedGJSONResult) Exists(key string) bool {
|
||||||
return r.Get(key).Exists()
|
return r.Result.Get(key).Exists()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) Array(key string) []decoratedGJSONResult {
|
func (r *decoratedGJSONResult) Array(key string) []decoratedGJSONResult {
|
||||||
@ -319,7 +319,7 @@ func (r *decoratedGJSONResult) Array(key string) []decoratedGJSONResult {
|
|||||||
return gJsonResultArrayToDecoratedResultArray(r.Result.Array())
|
return gJsonResultArrayToDecoratedResultArray(r.Result.Array())
|
||||||
}
|
}
|
||||||
|
|
||||||
return gJsonResultArrayToDecoratedResultArray(r.Get(key).Array())
|
return gJsonResultArrayToDecoratedResultArray(r.Result.Get(key).Array())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) String(key string) string {
|
func (r *decoratedGJSONResult) String(key string) string {
|
||||||
@ -327,7 +327,7 @@ func (r *decoratedGJSONResult) String(key string) string {
|
|||||||
return r.Result.String()
|
return r.Result.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.Get(key).String()
|
return r.Result.Get(key).String()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) Int(key string) int {
|
func (r *decoratedGJSONResult) Int(key string) int {
|
||||||
@ -335,7 +335,7 @@ func (r *decoratedGJSONResult) Int(key string) int {
|
|||||||
return int(r.Result.Int())
|
return int(r.Result.Int())
|
||||||
}
|
}
|
||||||
|
|
||||||
return int(r.Get(key).Int())
|
return int(r.Result.Get(key).Int())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) Float(key string) float64 {
|
func (r *decoratedGJSONResult) Float(key string) float64 {
|
||||||
@ -343,7 +343,7 @@ func (r *decoratedGJSONResult) Float(key string) float64 {
|
|||||||
return r.Result.Float()
|
return r.Result.Float()
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.Get(key).Float()
|
return r.Result.Get(key).Float()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *decoratedGJSONResult) Bool(key string) bool {
|
func (r *decoratedGJSONResult) Bool(key string) bool {
|
||||||
@ -351,7 +351,11 @@ func (r *decoratedGJSONResult) Bool(key string) bool {
|
|||||||
return r.Result.Bool()
|
return r.Result.Bool()
|
||||||
}
|
}
|
||||||
|
|
||||||
return r.Get(key).Bool()
|
return r.Result.Get(key).Bool()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *decoratedGJSONResult) Get(key string) *decoratedGJSONResult {
|
||||||
|
return &decoratedGJSONResult{r.Result.Get(key)}
|
||||||
}
|
}
|
||||||
|
|
||||||
func customAPIDoMathOp[T int | float64](a, b T, op string) T {
|
func customAPIDoMathOp[T int | float64](a, b T, op string) T {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user