module

Noir::GoRequestParamExtractor

Constants

BOUND_NAME = /(?<![\w."`])([A-Za-z_]\w*)(?![\w"`(])/
DECODE_TARGET = /\.Decode\s*\(\s*&\s*([A-Za-z_]\w*)\s*\)/
HEADER_READ_RE = /\.Header\s*(?:\.\s*(?:Get|Values)\s*\(\s*["`]([^"`]+)["`]|\[\s*["`]([^"`]+)["`]\s*\](?!\s*=[^=]))/

A stdlib request-header read, whatever the request is called: r / req, gin's c.Request, echo's c.Request(). Header.Get("X"), Header.Values("X") and Header["X"]; not a Header["X"] = v write, nor w.Header().Get (the response's own headers).

HELPER_PARAMS = /\Afunc\s*(?:\([^)]*\)\s*)?\w+\s*(?:\[.*?\]\s*)?\(([^)]*)\)/
JSON_DECODE = /\b\w*json\w*\.NewDecoder\([^)]*\.Body\)\s*\.\s*Decode/

json.NewDecoder(r.Body).Decode(&req), under any alias of the package.

LOCAL_NAMES = /(?:\A|[\n;{(]|\bvar)\s*([A-Za-z_]\w*(?:\s*,\s*[A-Za-z_]\w*)*)\s*:=|\bvar\s+([A-Za-z_]\w*)|\bfor\s+([A-Za-z_]\w*(?:\s*,\s*[A-Za-z_]\w*)*)\s*:?=\s*range\b/
MAX_HELPER_DEPTH = 3
QUERY_ALIAS = /([A-Za-z_]\w*)\s*:?=\s*\w+\s*\.\s*URL\s*\.\s*Query\s*\(\s*\)/
QUERY_READ_RE = /\.(?:URL\s*\.\s*Query|QueryParams)\s*\(\s*\)\s*(?:\.\s*Get\s*\(\s*["`]([^"`]+)["`]|\[\s*["`]([^"`]+)["`]\s*\])/

A read off the parsed query string: stdlib URL.Query() or echo's QueryParams() (both url.Values), by .Get("x") or ["x"].

REQUEST_PARAM = /([A-Za-z_]\w*)\s+\*\s*http\.Request\b/
STRING_LIST = /\A\[(?:\.\.\.)?\]string\s*\{((?:\s*"[^"]*"\s*,?)*)\s*\}\z/m

Instance methods

header_params(text : String) : Array(Param)

Every header text reads, as header params. Shared by the Go adapters whose handlers see a *http.Request.

Source
lazy_package_bodies_for_dirs(file_contents : Hash(String, String), dirs : Set(String)) : Noir::GoCalleeExtractor::LazyPackageBodies

Function and method tables restricted to dirs, behind the func / func ( per-file gates. A directory is parsed only when a route file in it asks for its table. See Noir::GoCalleeExtractor::LazyPackageBodies.

Source
params_for_body(fn : Noir::GoCalleeExtractor::FunctionBody, http_method : String, resolver : Resolver) : Array(Param)

The params the handler definition fn reads (and the helpers it calls, through resolver), for a route answering http_method.

Source
params_for_routes(source : String, route_rows : Set(Int32), route_methods : Hash(Int32, String), external_functions : Hash(String, Noir::GoCalleeExtractor::FunctionBody), external_methods : Hash(String, Array(Noir::GoCalleeExtractor::FunctionBody)), resolver : Resolver | Nil = nil, path : String | Nil = nil) : Hash(Int32, Array(Param))
Source
query_params(text : String) : Array(Param)
Source

Nested types