diff --git a/entrypoint.go b/entrypoint.go index 500d099..86a3722 100644 --- a/entrypoint.go +++ b/entrypoint.go @@ -3,6 +3,7 @@ package oclib import ( "errors" "fmt" + "strings" "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/workspace" "cloud.o-forge.io/core/oc-lib/tools" + "github.com/beego/beego/v2/server/web/context" "github.com/goraz/onion" "github.com/rs/zerolog" ) @@ -65,6 +67,20 @@ func (d LibDataEnum) EnumIndex() int { 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 type LibDataShallow struct { Data []utils.ShallowDBObject `bson:"data" json:"data"`