1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-07-15 01:25:00 +02:00

Added missed UA setting (#318)

* Added misset UA setting

* Update doc_ua.fql

* Delete ferret_embedding_basic.go
This commit is contained in:
Tim Voronov
2019-06-25 12:51:51 -04:00
committed by GitHub
parent eee801fb5b
commit 2cfd1040a9
11 changed files with 214 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package strings
import (
"context"
"encoding/base64"
"net/url"
"github.com/MontFerret/ferret/pkg/runtime/values"
@ -14,6 +15,7 @@ import (
// @returns value (String) - The decoded string.
func FromBase64(_ context.Context, args ...core.Value) (core.Value, error) {
err := core.ValidateArgs(args, 1, 1)
if err != nil {
return values.EmptyString, err
}
@ -27,3 +29,22 @@ func FromBase64(_ context.Context, args ...core.Value) (core.Value, error) {
return values.NewString(string(out)), nil
}
// DecodeURIComponent returns the decoded String of uri.
// @param (String) - Uri to decode.
// @returns String - Decoded string.
func DecodeURIComponent(_ context.Context, args ...core.Value) (core.Value, error) {
err := core.ValidateArgs(args, 1, 1)
if err != nil {
return values.EmptyString, err
}
str, err := url.QueryUnescape(args[0].String())
if err != nil {
return values.None, err
}
return values.NewString(str), nil
}