mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-23 01:24:30 +02:00
7ce6797e9c
* Implemented XPath for CDP driver * Added XPATH function * Added e2e tests for CDP * Fixed linting issues * Added support of XPath to HTTP driver * Fixed linting issues
38 lines
695 B
Go
38 lines
695 B
Go
package eval
|
|
|
|
import (
|
|
"strconv"
|
|
|
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
|
"github.com/MontFerret/ferret/pkg/runtime/values"
|
|
)
|
|
|
|
func Param(input core.Value) string {
|
|
switch value := input.(type) {
|
|
case values.String:
|
|
return ParamString(string(value))
|
|
case values.Float:
|
|
return ParamFloat(float64(value))
|
|
case values.Int:
|
|
return ParamInt(int64(value))
|
|
default:
|
|
if input == values.None {
|
|
return "null"
|
|
}
|
|
|
|
return value.String()
|
|
}
|
|
}
|
|
|
|
func ParamString(param string) string {
|
|
return "`" + param + "`"
|
|
}
|
|
|
|
func ParamFloat(param float64) string {
|
|
return strconv.FormatFloat(param, 'f', 6, 64)
|
|
}
|
|
|
|
func ParamInt(param int64) string {
|
|
return strconv.FormatInt(param, 64)
|
|
}
|