arrange

package
v0.0.0-...-55524bd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2022 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

View Source
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")
)
View Source
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 GetFactory

func GetFactory() *factory.FlexObjFactory

GetFactory return the factory object

func InitArrange

func InitArrange(template string, info *Arrange) (string, error)

InitArrange return an initialized arrange text

func ValidateNodeName

func ValidateNodeName(name string) error

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

func (*APIInfo) APIPath

func (p *APIInfo) APIPath() string

APIPath get api full path

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.

func (Arrange) TypeName

func (a Arrange) TypeName() string

TypeName returns name of the type

type Builder

type Builder interface {
	BuildJsScript(n *Node, b *jsBuilder, depth int) error
}

Builder impliments script build function for nodes

type CondExpr

type CondExpr = exprx.CondExpr

CondExpr exports

type CondExprGroup

type CondExprGroup = exprx.CondExprGroup

CondExprGroup exports

type Evaler

type Evaler = protocol.Evaler

Evaler export

type FieldMap

type FieldMap = exprx.FieldMap

FieldMap exports

type FlexJSONObject

type FlexJSONObject = exprx.FlexJSONObject

FlexJSONObject exports

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 InputValue

type InputValue = exprx.InputValue

InputValue exports

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

func (v *Node) DelayedJSONDecode() error

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 ValArray

type ValArray = exprx.ValArray

ValArray exports

type ValArrayString

type ValArrayString = exprx.ValArrayString

ValArrayString exports

type ValArrayStringElem

type ValArrayStringElem = exprx.ValArrayStringElem

ValArrayStringElem exports

type ValBoolean

type ValBoolean = exprx.ValBoolean

ValBoolean exports

type ValDirectExpr

type ValDirectExpr = exprx.ValDirectExpr

ValDirectExpr exports

type ValExpr

type ValExpr = exprx.ValExpr

ValExpr exports

type ValExprCmp

type ValExprCmp = exprx.ValExprCmp

ValExprCmp exports

type ValExprFunc

type ValExprFunc = exprx.ValExprFunc

ValExprFunc exports

type ValExprGroup

type ValExprGroup = exprx.ValExprGroup

ValExprGroup exports

type ValExprSel

type ValExprSel = exprx.ValExprSel

ValExprSel exports

type ValFiltObj

type ValFiltObj = exprx.ValFiltObj

ValFiltObj exports

type ValMergeObj

type ValMergeObj = exprx.ValMergeObj

ValMergeObj exports

type ValNumber

type ValNumber = exprx.ValNumber

ValNumber exports

type ValObject

type ValObject = exprx.ValObject

ValObject exports

type ValString

type ValString = exprx.ValString

ValString exports

type ValTimestamp

type ValTimestamp = exprx.ValTimestamp

ValTimestamp exports

type Value

type Value = exprx.Value

Value exports

type ValueDefine

type ValueDefine = exprx.ValueDefine

ValueDefine represents the value of an input.

type ValueSet

type ValueSet = exprx.ValueSet

ValueSet exports

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL