Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Options = []expr.Option{ expr.Function( "fetch", func(params ...any) (any, error) { var req *http.Request var err error url := params[0].(string) if len(params) == 2 { options := params[1].(map[string]any) method, _ := options["method"].(string) headers, _ := options["headers"].(map[string]any) req, err = newRequest(method, url, headers) } else { req, err = http.NewRequest("GET", url, nil) } if err != nil { return nil, err } res, err := tcp.Do(req) if err != nil { return nil, err } b, _ := io.ReadAll(res.Body) return map[string]any{ "ok": res.StatusCode < 400, "status": res.Status, "text": string(b), "json": func() (v any) { _ = json.Unmarshal(b, &v) return }, }, nil }, ), expr.Function( "match", func(params ...any) (any, error) { re, err := regExp(params[1:]...) if err != nil { return nil, err } str := params[0].(string) return re.FindStringSubmatch(str), nil }, ), expr.Function( "RegExp", func(params ...any) (any, error) { return regExp(params) }, ), }
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.