Documentation
¶
Index ¶
Constants ¶
View Source
const INSECURE = "INSECURE"
View Source
const NOBODY = "NOBODY"
Variables ¶
View Source
var JsFuncs = map[string]any{ "btoa": btoa, "atob": atob, "env": os.Getenv, "expandenv": os.ExpandEnv, "getHostByName": getHostByName, "fetchUrl": fetch, }
Template functions are also available in JavaScript runtime. Some funcs are added to it in init(). Additionally, set_status & set_body & set_header & clear_header funcs are also available in JavaScript runtime.
View Source
var TemplateFuncMap = map[string]any{
"marshal": marshal,
"unmarshal": unmarshal,
"randstring": randstring,
"encrypt": encrypt,
"decrypt": decrypt,
"encrypt_binary": encrypt_binary,
"decrypt_binary": decrypt_binary,
"md5sum": md5sum,
"hexdecode": hexdecode,
"neg": neg,
"abs": absFunc,
"read": read,
"shlex_split": shlexSplit,
"fetch": fetch,
"system": system,
"exec": execFunc,
}
Additional template functions, require url to be signed. Due to the pipeline way that Go template works, the last argument of funcs shoud be the primary one.
Functions ¶
func Any2string ¶
Convert input to string. If input is nil, return empty string. If input is string or []byte, return as it. If input is a goja Promise, use it's resolved value. Otherwise return fmt.Sprint(input).
Types ¶
type ExecResponse ¶
Click to show internal directories.
Click to hide internal directories.