Documentation
¶
Index ¶
- Variables
- func BuildJsScript(info *APIInfo, arrangeJSON string, owner string) (string, string, []string, error)
- func GetFactory() *factory.FlexObjFactory
- func InitArrange(template string, info *Arrange) (string, error)
- func ValidateNodeName(name string) error
- type APIInfo
- type Arrange
- type Builder
- type CondExpr
- type CondExprGroup
- type Evaler
- type FieldMap
- type FlexJSONObject
- type IfNodeDetail
- type InputNodeDetail
- type InputValue
- type Node
- type OutputNodeDetail
- type RequestNodeDetail
- type SwagConstValue
- type ValArray
- type ValArrayString
- type ValArrayStringElem
- type ValBoolean
- type ValDirectExpr
- type ValExpr
- type ValExprCmp
- type ValExprFunc
- type ValExprGroup
- type ValExprSel
- type ValFiltObj
- type ValMergeObj
- type ValNumber
- type ValObject
- type ValString
- type ValTimestamp
- type Value
- type ValueDefine
- type ValueSet
Constants ¶
This section is empty.
Variables ¶
var ( // NodeTypeEnum represents node enum set NodeTypeEnum = enumset.New(nil) NodeTypeInput = NodeTypeEnum.MustReg("input") NodeTypeIf = NodeTypeEnum.MustReg("if") NodeTypeRequest = NodeTypeEnum.MustReg("request") NodeTypeOutput = NodeTypeEnum.MustReg("output") NodeTypeArrange = NodeTypeEnum.MustReg("arrange") )
node type enum
var ( // NodeNameEnum represents node name enum set NodeNameEnum = enumset.New(nil) // NodeNameStart represents node name start NodeNameStart = NodeNameEnum.MustReg("start") // NodeNameEnd represents node name end NodeNameEnd = NodeNameEnum.MustReg("end") )
var PolyDocGennerator func(poly *Arrange, in *InputNodeDetail, out *OutputNodeDetail) (*adaptor.APIDoc, error)
PolyDocGennerator is a function for generate swagger for the poly api this function is provide from outside package
Functions ¶
func BuildJsScript ¶
func BuildJsScript(info *APIInfo, arrangeJSON string, owner string) (string, string, []string, error)
BuildJsScript generate js code from arrange config. Which generate a temp one-time function and execute it immediately.
func InitArrange ¶
InitArrange return an initialized arrange text
func ValidateNodeName ¶
ValidateNodeName verify node name format
Types ¶
type APIInfo ¶
type APIInfo struct { Schema string `json:"schema,omitempty"` Host string `json:"host,omitempty"` Namespace string `json:"namespace,omitempty"` Name string `json:"name,omitempty"` // name of this arrange Title string `json:"title,omitempty"` Desc string `json:"desc,omitempty"` // description of this arrange Version string `json:"version,omitempty"` // version of this arrange Method string `json:"method,omitempty"` Encoding string `json:"encoding,omitempty"` // json only current }
APIInfo is info of api
type Arrange ¶
type Arrange struct { // for poly doc Info *APIInfo `json:"info,omitempty"` Nodes []Node `json:"nodes"` // nodes of this arrange }
Arrange represent an arrange config.
type IfNodeDetail ¶
type IfNodeDetail struct { Cond exprx.CondExpr `json:"cond"` // check condition Yes string `json:"yes"` // next node if condition is yes No string `json:"no"` // next node if condition is no }
IfNodeDetail represents detail of an if node.
func (*IfNodeDetail) BuildJsScript ¶
func (d *IfNodeDetail) BuildJsScript(n *Node, b *jsBuilder, depth int) error
BuildJsScript generate JS script of this node
func (*IfNodeDetail) DelayedJSONDecode ¶
func (d *IfNodeDetail) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (IfNodeDetail) TypeName ¶
func (d IfNodeDetail) TypeName() string
TypeName returns name of the type
type InputNodeDetail ¶
type InputNodeDetail exprx.InputNodeDetail
InputNodeDetail represents the detail of an input node.
func (*InputNodeDetail) BuildJsScript ¶
func (d *InputNodeDetail) BuildJsScript(n *Node, b *jsBuilder, depth int) error
BuildJsScript generate JS script of this node
func (*InputNodeDetail) DelayedJSONDecode ¶
func (d *InputNodeDetail) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (InputNodeDetail) TypeName ¶
func (d InputNodeDetail) TypeName() string
TypeName returns name of the type
type Node ¶
type Node struct { Name string `json:"name"` // node name, unique, English only Title string `json:"title"` // node name alias, unique, allow Chinese Desc string `json:"desc"` // description of this node Type enumset.Enum `json:"type"` // input|request|output|if NextNodes []string `json:"nextNodes"` // name of parent nodes Detail expr.FlexJSONObject `json:"detail"` // detail of this node // contains filtered or unexported fields }
Node represents an arrange node
func (*Node) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
type OutputNodeDetail ¶
type OutputNodeDetail exprx.OutputNodeDetail
OutputNodeDetail represents detail of an output node
func (*OutputNodeDetail) BuildJsScript ¶
func (d *OutputNodeDetail) BuildJsScript(n *Node, b *jsBuilder, depth int) error
BuildJsScript generate JS script of this node
func (*OutputNodeDetail) DelayedJSONDecode ¶
func (d *OutputNodeDetail) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (*OutputNodeDetail) GenerateDoc ¶
func (d *OutputNodeDetail) GenerateDoc() error
GenerateDoc generate doc from header & body
func (OutputNodeDetail) TypeName ¶
func (d OutputNodeDetail) TypeName() string
TypeName returns name of the type
type RequestNodeDetail ¶
type RequestNodeDetail struct { RawPath string `json:"rawPath"` // Id of the request raw API APIKeyID string `json:"apiKeyID"` // fixed api key id DynamicKey bool `json:"dynamicKey"` // use dynamic key for requester Inputs exprx.ValueSet `json:"inputs"` // input from header, path, body or uri(GET) }
RequestNodeDetail represents detail of an request node
func (*RequestNodeDetail) BuildJsScript ¶
func (d *RequestNodeDetail) BuildJsScript(n *Node, b *jsBuilder, depth int) error
BuildJsScript build and write script text into buffer
func (*RequestNodeDetail) DelayedJSONDecode ¶
func (d *RequestNodeDetail) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (RequestNodeDetail) TypeName ¶
func (d RequestNodeDetail) TypeName() string
TypeName returns name of the type
type SwagConstValue ¶
type SwagConstValue = exprx.SwagConstValue
SwagConstValue is the predefined value
type ValArrayStringElem ¶
type ValArrayStringElem = exprx.ValArrayStringElem
ValArrayStringElem exports
type ValueDefine ¶
type ValueDefine = exprx.ValueDefine
ValueDefine represents the value of an input.