Documentation
¶
Index ¶
- Variables
- func CallFunc(funcName string, params []interface{}) (interface{}, error)
- func CheckGivenParams(params []interface{}, numParams int) error
- func CheckRequestIsAction(action string) error
- func CheckTypeAndConvert(word string) (interface{}, error)
- func GetFunctionParamsNum(function reflect.Value) (int, error)
- func Handler(rw http.ResponseWriter, r *http.Request)
- func ParseParamsIntoRVArray(params []interface{}) ([]reflect.Value, error)
- func RunFunctionsGetReturns(functionCalMap []Endpoint) (map[string]interface{}, error)
- type BodyContents
- type Endpoint
- type FuncMap
Constants ¶
This section is empty.
Variables ¶
DQGLogger - Logger for DynamicQuerysGo processes (can be stdout or a io.writer to a file)
var FuncsStorage = FuncMap{ "ReverseString": funcendpoints.ReverseString, "ReverseStringBool": funcendpoints.ReverseStringBool, "TakeAnInterfaceArray": funcendpoints.TakeAInterfaceArray, "TakeAMap": funcendpoints.TakeAMap, }
FuncsStorage -
Functions ¶
func CheckGivenParams ¶
CheckGivenParams - checks if the number of parmeters is the correct amount.
func CheckRequestIsAction ¶
CheckRequestIsAction - Verifys the request content contains an action
func CheckTypeAndConvert ¶
CheckTypeAndConvert - Takes a string and compares it to a number of regex patterns, each representing golang data types,
if the pattern and string match, the string will be converted to the represented data type. The order of regex comparisson is important in some cases, such as in strings, json-like strings ("{\"name\":\"Golang\"}").
func GetFunctionParamsNum ¶
GetFunctionParamsNum - Gets the given function number of parameters, and returns it or an error.
func Handler ¶
func Handler(rw http.ResponseWriter, r *http.Request)
Handler - Handles all of the requests coming into the server
func ParseParamsIntoRVArray ¶
ParseParamsIntoRVArray - Gets values from the params array, and puts their reflect value insside a []reflect.Value, and returns it.
func RunFunctionsGetReturns ¶
RunFunctionsGetReturns - Runs the given functions in []FunctionPath, and returns the resulting function-call values. Returns the called functions results as map[string]interface{}, and an error (nil if successfull)
Types ¶
type BodyContents ¶
type BodyContents struct { ActionBody string // Body of the action Authentication [][]string // JWT auth tokens FuncCalls [][]string // Function names passed in the schema FuncArgs [][]string // Passed params in the schema FuncsContent []string // Content of the " funcs: " section of the schema }
BodyContents - Represents the extende structure of the action body
func ParseActionContents ¶
func ParseActionContents(request string) (BodyContents, error)
ParseActionContents - Separates the action into its dedicated content parts
type Endpoint ¶
type Endpoint struct { FuncName string // Function name to call Params []interface{} // Parameters to be passed into the function }
Endpoint - Represent the function called in the action schema, its name and parameters
func ParseActionBody ¶
func ParseActionBody(regex string, actionContents BodyContents) ([]Endpoint, error)
ParseActionBody - Parsses the action body text into usable data