add a tool func for query
This commit is contained in:
parent
c309d97623
commit
3f610619b5
@ -3,6 +3,7 @@ package oclib
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ import (
|
|||||||
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
"cloud.o-forge.io/core/oc-lib/models/workflow_execution"
|
||||||
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
"cloud.o-forge.io/core/oc-lib/models/workspace"
|
||||||
"cloud.o-forge.io/core/oc-lib/tools"
|
"cloud.o-forge.io/core/oc-lib/tools"
|
||||||
|
"github.com/beego/beego/v2/server/web/context"
|
||||||
"github.com/goraz/onion"
|
"github.com/goraz/onion"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
)
|
)
|
||||||
@ -65,6 +67,20 @@ func (d LibDataEnum) EnumIndex() int {
|
|||||||
return int(d)
|
return int(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IsQueryParamsEquals(input *context.BeegoInput, name string, val interface{}) bool {
|
||||||
|
path := strings.Split(input.URI(), "?")
|
||||||
|
if len(path) >= 2 {
|
||||||
|
uri := strings.Split(path[1], "&")
|
||||||
|
for _, val := range uri {
|
||||||
|
kv := strings.Split(val, "=")
|
||||||
|
if kv[0] == name && fmt.Sprintf("%v", val) == kv[1] {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// model to define the shallow data structure
|
// model to define the shallow data structure
|
||||||
type LibDataShallow struct {
|
type LibDataShallow struct {
|
||||||
Data []utils.ShallowDBObject `bson:"data" json:"data"`
|
Data []utils.ShallowDBObject `bson:"data" json:"data"`
|
||||||
|
Loading…
Reference in New Issue
Block a user