Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertOp(e string) (string, error)
- func FullVarName(name string) string
- func GenLinehead(depth int) string
- func GetFactory() *factory.FlexObjFactory
- func GetFieldName(f string) string
- type APISampleInput
- type APISampleOutput
- type CondExpr
- type CondExprGroup
- type CreateSampleDataor
- type DelayedJSONDecoder
- type Enum
- func (e Enum) EncodingToMIME() (string, error)
- func (e Enum) IsAction() bool
- func (e Enum) IsArrayElem() bool
- func (e Enum) IsBody() bool
- func (e Enum) IsField() bool
- func (e Enum) IsHeader() bool
- func (e Enum) IsHeaderAcceptable() bool
- func (e Enum) IsHide() bool
- func (e Enum) IsNullable() bool
- func (e Enum) IsPath() bool
- func (e Enum) IsPredefineable() bool
- func (e Enum) IsQuery() bool
- func (e Enum) IsStringer() bool
- func (e Enum) IsTimestamp() bool
- func (e Enum) SameIn(o Enum) bool
- func (e Enum) String() string
- type Evaler
- type FieldMap
- type FieldRef
- type FlexJSONObject
- type FmtAPIInOut
- type GenSampler
- type InputNodeDetail
- type InputValue
- type NamedScriptElem
- type NamedType
- type NamedValue
- type OutputNodeDetail
- type RequestArgs
- type ScriptElem
- type Stringer
- type StringerWithError
- type Stringifier
- type SwagConstValue
- type SwagConstValueSet
- type ValAction
- type ValArray
- type ValArrayString
- func (v *ValArrayString) DelayedJSONDecode() error
- func (v ValArrayString) GenSample(val interface{}, titleFirst bool) value.JSONValue
- func (v ValArrayString) MarshalJSON() ([]byte, error)
- func (v *ValArrayString) SetString(s string)
- func (v ValArrayString) String() string
- func (v ValArrayString) ToScript(depth int, e Evaler) (string, error)
- func (v ValArrayString) TypeName() string
- func (v *ValArrayString) UnmarshalJSON(data []byte) error
- type ValArrayStringElem
- func (v *ValArrayStringElem) DelayedJSONDecode() error
- func (v ValArrayStringElem) GenSample(val interface{}, titleFirst bool) value.JSONValue
- func (v ValArrayStringElem) GetName(titleFirst bool) string
- func (v ValArrayStringElem) ToScript(depth int, e Evaler) (string, error)
- func (v ValArrayStringElem) TypeName() string
- type ValBoolean
- func (v *ValBoolean) DelayedJSONDecode() error
- func (v ValBoolean) GenSample(val interface{}, titleFirst bool) value.JSONValue
- func (v *ValBoolean) SetString(s string)
- func (v ValBoolean) String() string
- func (v ValBoolean) ToScript(depth int, e Evaler) (string, error)
- func (v ValBoolean) TypeName() string
- type ValDirectExpr
- func (v *ValDirectExpr) DelayedJSONDecode() error
- func (v *ValDirectExpr) SetString(s string)
- func (v *ValDirectExpr) SetStringWithError(s string) error
- func (v ValDirectExpr) String() string
- func (v ValDirectExpr) ToScript(depth int, e Evaler) (string, error)
- func (v ValDirectExpr) TypeName() string
- func (v ValDirectExpr) Validate() error
- type ValExpr
- type ValExprCmp
- type ValExprFunc
- type ValExprGroup
- type ValExprSel
- type ValFiltObj
- type ValMergeObj
- type ValNumber
- func (v *ValNumber) DelayedJSONDecode() error
- func (v ValNumber) GenSample(val interface{}, titleFirst bool) value.JSONValue
- func (v *ValNumber) SetString(s string)
- func (v ValNumber) String() string
- func (v ValNumber) ToScript(depth int, e Evaler) (string, error)
- func (v ValNumber) TypeName() string
- type ValObject
- type ValString
- func (v *ValString) DelayedJSONDecode() error
- func (v ValString) GenSample(val interface{}, titleFirst bool) value.JSONValue
- func (v *ValString) SetString(s string)
- func (v ValString) String() string
- func (v ValString) ToScript(depth int, e Evaler) (string, error)
- func (v ValString) TypeName() string
- type ValTimestamp
- func (v *ValTimestamp) DelayedJSONDecode() error
- func (v ValTimestamp) GenSample(val interface{}, titleFirst bool) value.JSONValue
- func (v *ValTimestamp) SetString(s string)
- func (v ValTimestamp) String() string
- func (v ValTimestamp) ToScript(depth int, e Evaler) (string, error)
- func (v ValTimestamp) TypeName() string
- type Value
- func (v Value) CreateSampleData(val interface{}, titleFirst bool) value.JSONValue
- func (v *Value) DelayedJSONDecode() error
- func (v Value) DenyFieldRefer() error
- func (v Value) Empty() bool
- func (v Value) GetAsString() string
- func (v Value) GetName(titleFirst bool) string
- func (v Value) ToScript(depth int, e Evaler) (string, error)
- type ValueDefine
- type ValueSet
- func (v *ValueSet) AddExKV(key, value string, kind, in Enum) error
- func (v *ValueSet) AddKV(key, value string, kind, in Enum) error
- func (v *ValueSet) DelayedJSONDecode() error
- func (v ValueSet) GetAction() *expr.InputValue
- func (v ValueSet) PrepareRequest(args *RequestArgs) error
- func (s *ValueSet) ReplacePathArgs(srcURL string, name string) (string, error)
- func (s *ValueSet) ResolvePathArgs(srcURL string, nodeName string) (string, []string, error)
- func (v ValueSet) ToScript(depth int, e Evaler) (string, error)
- type XInputValue
- func (v XInputValue) CreateSampleData(val interface{}, titleFirst bool) value.JSONValue
- func (v *XInputValue) DelayedJSONDecode() error
- func (v XInputValue) DenyFieldRefer() error
- func (v *XInputValue) Empty() bool
- func (v XInputValue) GetAsString() string
- func (v XInputValue) GetName(titleFirst bool) string
- func (v XInputValue) ToScript(depth int, e Evaler) (string, error)
Constants ¶
const ( // DefaultEncoding is default encoding when empty DefaultEncoding = consts.DefaultEncoding // PolyEncoding is encoding by poly api PolyEncoding = consts.PolyEncoding )
const (
// DefaultBufLen is default buffer length
DefaultBufLen = defaultBufLen
)
Variables ¶
var ( // EnumTypesEnum represents enum of enum types EnumTypesEnum = newEnumSet(nil) EnumNode = EnumTypesEnum.MustReg(consts.EnumNode) EnumValue = EnumTypesEnum.MustReg(consts.EnumValue) EnumOper = EnumTypesEnum.MustReg(consts.EnumOper) EnumCond = EnumTypesEnum.MustReg(consts.EnumCond) EnumCmp = EnumTypesEnum.MustReg(consts.EnumCmp) EnumIn = EnumTypesEnum.MustReg(consts.EnumIn) EnumAuth = EnumTypesEnum.MustReg(consts.EnumAuth) )
enum of enum types
var ( // ValTypeEnum input value enum set, basic value accept in Input node ValTypeEnum = newEnumSet(nil) // ValTypeNumber represent value like 123 ValTypeNumber = ValTypeEnum.MustReg("number") // ValTypeString represent value like "xyz" ValTypeString = ValTypeEnum.MustReg("string") // XValTypeAction represent value like action parameter ValTypeAction = ValTypeEnum.MustReg("action") // XValTypeTimestamp represent value like timestamp parameter ValTypeTimestamp = ValTypeEnum.MustReg("timestamp") // ValTypeBoolean represent value like true ValTypeBoolean = ValTypeEnum.MustReg("boolean") // ValTypeObject represent value like {...} ValTypeObject = ValTypeEnum.MustReg("object") // ValTypeArray represent value like [...] ValTypeArray = ValTypeEnum.MustReg("array") // ValTypeArrayString represent value like "foo,bar" => ["foo","bar"] ValTypeArrayString = ValTypeEnum.MustReg("array_string") )
basic types
var ( // XValTypeEnum extend value enum set, include ValEnum XValTypeEnum = newEnumSet(ValTypeEnum) // XValTypeUndefined represent value like undefined XValTypeUndefined = XValTypeEnum.MustReg("undefined") // undefined // XValTypeNull represent value like null XValTypeNull = XValTypeEnum.MustReg("null") // XValTypeMergeObj represent value like merged object, {a,b} + {c,d} => {a,b,c,d} XValTypeMergeObj = XValTypeEnum.MustReg("mergeobj") // XValTypeFilter represent value like use on Object|Array field XValTypeFilter = XValTypeEnum.MustReg("filter") // ValTypeArrayStringElem represent value like [...] as xxx.n XValTypeArrayStringElem = XValTypeEnum.MustReg("array_string_elem") // XValTypeField represent value like req.data.userId XValTypeField = XValTypeEnum.MustReg("field") )
extend value type
var ( // ExprTypeEnum represents expression type, single expression, eg: const,field ExprTypeEnum = newEnumSet(XValTypeEnum) // ExprTypeExpr represents expr like (x + y) * 2 ExprTypeExpr = ExprTypeEnum.MustReg("expr") // ExprTypeCmp represents compare expression, eg: a lt b ExprTypeCmp = ExprTypeEnum.MustReg("exprcmp") // ExprTypeSel represents select expression, eg: cond ? yesVal : noVal ExprTypeSel = ExprTypeEnum.MustReg("exprsel") // ExprTypeFunc represents // func(...), function call ExprTypeFunc = ExprTypeEnum.MustReg("exprfunc") // ExprTypeGroup represents group expression, eg: (a + b), (x and y) ExprTypeGroup = ExprTypeEnum.MustReg("exprgroup") // ExprTypeDirectExpr represents direct expression string, eg: "(req1.a+1)*2" ExprTypeDirectExpr = ExprTypeEnum.MustReg("direct_expr") )
expression types
var ( // OpEnum represents operator enum set OpEnum = newEnumSet(nil) // OpAdd represents operator + OpAdd = OpEnum.MustRegWithContent("add", "+", "") // OpSub represents operator - OpSub = OpEnum.MustRegWithContent("sub", "-", "") // OpMul represents operator * OpMul = OpEnum.MustRegWithContent("mul", "*", "") // OpDiv represents operator / OpDiv = OpEnum.MustRegWithContent("div", "/", "") )
operator enum set
var ( // CondEnum represents condition enum set CondEnum = newEnumSet(nil) // CondAnd represents logic operator && CondAnd = CondEnum.MustRegWithContent("and", "&&", "") // && // CondOr represents logic operator || CondOr = CondEnum.MustRegWithContent("or", "||", "") // CondNot represents logic operator ! CondNot = CondEnum.MustRegWithContent("not", "!", "") )
condition enum set
var ( // CmpEnum represents compare enum set CmpEnum = newEnumSet(nil) CmpLT = CmpEnum.MustRegWithContent("lt", "<", "") CmpGT = CmpEnum.MustRegWithContent("gt", ">", "") CmpLE = CmpEnum.MustRegWithContent("le", "<=", "") CmpGE = CmpEnum.MustRegWithContent("ge", ">=", "") CmpEQ = CmpEnum.MustRegWithContent("eq", "==", "") CmpNE = CmpEnum.MustRegWithContent("ne", "!=", "") )
compare enum set
var ( // EncodingEnum represents encoding format EncodingEnum = newEnumSet(nil) // EncodingJSON represents encoding JSON EncodingJSON = EncodingEnum.MustReg(consts.EncodingJSON) // EncodingXML represents encoding XML EncodingXML = EncodingEnum.MustReg(consts.EncodingXML) // EncodingYAML represents encoding YAML EncodingYAML = EncodingEnum.MustReg(consts.EncodingYAML) )
var ( // SchemaEnum represents API scheme SchemaEnum = newEnumSet(nil) // SchemaHTTP represents API scheme http SchemaHTTP = SchemaEnum.MustReg(consts.SchemaHTTP) // SchemaHTTPS represents API scheme https SchemaHTTPS = SchemaEnum.MustReg(consts.SchemaHTTPS) )
var ( // MethodEnum represents http API methods MethodEnum = newEnumSet(nil) MethodGet = MethodEnum.MustReg(consts.MethodGet) MethodPost = MethodEnum.MustReg(consts.MethodPost) MethodPut = MethodEnum.MustReg(consts.MethodPut) MethodDelete = MethodEnum.MustReg(consts.MethodDelete) MethodOPTIONS = MethodEnum.MustReg(consts.MethodOptions) MethodHEAD = MethodEnum.MustReg(consts.MethodHead) MethodTRACE = MethodEnum.MustReg(consts.MethodTrace) MethodCONNECT = MethodEnum.MustReg(consts.MethodConnect) )
http API methods
var ( // ParaTypeEnum represents parameter type ParaTypeEnum = newEnumSet(nil) ParaTypeHeader = ParaTypeEnum.MustReg(consts.ParaInHeader) ParaTypePath = ParaTypeEnum.MustReg(consts.ParaInPath) ParaTypeBody = ParaTypeEnum.MustReg(consts.ParaInBody) ParaTypeQuery = ParaTypeEnum.MustReg(consts.ParaInQuery) ParaTypeFormData = ParaTypeEnum.MustReg(consts.ParaInFormData) // ParaTypeHide represents hide parameter like skey ParaTypeHide = ParaTypeEnum.MustReg("hide") )
parameter type
var (
ValTypeForDocEnum = newEnumSet(nil)
)
doc type
Functions ¶
func FullVarName ¶
FullVarName get the full variable of poly API
func GetFieldName ¶
GetFieldName return the file name from field ref. eg: req1.data.x => x
Types ¶
type APISampleInput ¶
type APISampleInput struct { Header http.Header `json:"header,omitempty"` //Path map[string]string `json:"path,omitempty"` //body._hide{} Body json.RawMessage `json:"body,omitempty"` }
APISampleInput is the sample input of an API
type APISampleOutput ¶
type APISampleOutput struct { Header http.Header `json:"header,omitempty"` Resp json.RawMessage `json:"resp,omitempty"` }
APISampleOutput is the sample output of an API
type CondExprGroup ¶
type CondExprGroup = ValExprGroup
CondExprGroup represents a condition expression group
type CreateSampleDataor ¶
type CreateSampleDataor interface {
CreateSampleData(val interface{}, titleFirst bool) value.JSONValue
}
CreateSampleDataor represents value that can generate sample JSON value
type DelayedJSONDecoder ¶
type DelayedJSONDecoder interface {
DelayedJSONDecode() error // delay unmarshal flex json object
}
DelayedJSONDecoder define an object that need delay decode JSON
type Enum ¶
Enum exports
func (Enum) EncodingToMIME ¶
EncodingToMIME change encoding like JSON to MIME like "application/json"
func (Enum) IsArrayElem ¶
IsArrayElem judge if a value type is array show as ary.1=xxx
func (Enum) IsHeaderAcceptable ¶
IsHeaderAcceptable judege if is a header-acceptable parameter
func (Enum) IsNullable ¶
IsNullable judge if the data field is nullable
func (Enum) IsPredefineable ¶
IsPredefineable judge if a value is predefineable
func (Enum) IsStringer ¶
IsStringer judge if a value is able to convert to string
func (Enum) IsTimestamp ¶
IsTimestamp judge if a value type is timestamp
type FieldRef ¶
type FieldRef string
FieldRef is field reference
type FmtAPIInOut ¶
type FmtAPIInOut struct { Method string `json:"method"` URL string `json:"url"` Input InputNodeDetail `json:"input"` Output OutputNodeDetail `json:"output"` SampleIn [2]APISampleInput `json:"sampleInput"` // [0]normal [1]tilteFirst SampleOut [2]APISampleOutput `json:"sampleOutput"` // [0]normal [1]tilteFirst }
FmtAPIInOut is the formated API input and output
func (*FmtAPIInOut) DelayedJSONDecode ¶
func (d *FmtAPIInOut) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (*FmtAPIInOut) SetAccessURL ¶
func (d *FmtAPIInOut) SetAccessURL(apiPath string)
SetAccessURL update the api access path
type GenSampler ¶
GenSampler represents value that can generate sample JSON value
type InputNodeDetail ¶
type InputNodeDetail struct { Inputs []ValueDefine `json:"inputs,omitempty"` // input from header, path, body or uri(GET) Consts ValueSet `json:"consts,omitempty"` // const values provide by arrange }
InputNodeDetail represents the detail of an input node.
func (*InputNodeDetail) DelayedJSONDecode ¶
func (d *InputNodeDetail) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
type NamedScriptElem ¶
type NamedScriptElem interface { ScriptElem NamedValue }
NamedScriptElem define a script element with name
type NamedValue ¶
NamedValue define a value with name
type OutputNodeDetail ¶
type OutputNodeDetail struct { Header ValueSet `json:"header,omitempty"` // output from header Body Value `json:"body,omitempty"` // output from body Doc []ValueDefine `json:"doc,omitempty"` // output from body, for doc only }
OutputNodeDetail represents detail of an output node
func (*OutputNodeDetail) DelayedJSONDecode ¶
func (d *OutputNodeDetail) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
type RequestArgs ¶
type RequestArgs = expr.RequestArgs
RequestArgs represents a request parament of a request
type ScriptElem ¶
ScriptElem define a script element
type Stringer ¶
Stringer define an interface with String()
func NewStringer ¶
NewStringer create a string-like value
type StringerWithError ¶
StringerWithError define an interface with SetStringWithError()
type Stringifier ¶
type Stringifier interface {
String() string
}
Stringifier is an interface to convert to string only
type ValAction ¶
type ValAction ValString
ValAction represents action string
func (*ValAction) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
type ValArray ¶
type ValArray []Value
ValArray represents an array value, [...]
func (*ValArray) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
type ValArrayString ¶
type ValArrayString []string
ValArrayString enable parse a single string as string array
func (*ValArrayString) DelayedJSONDecode ¶
func (v *ValArrayString) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValArrayString) GenSample ¶
func (v ValArrayString) GenSample(val interface{}, titleFirst bool) value.JSONValue
GenSample generate a sample JSON value
func (ValArrayString) MarshalJSON ¶
func (v ValArrayString) MarshalJSON() ([]byte, error)
MarshalJSON encoding array as single string
func (*ValArrayString) SetString ¶
func (v *ValArrayString) SetString(s string)
SetString decode string as ValArrayString
func (ValArrayString) String ¶
func (v ValArrayString) String() string
String encode ValArrayString as string
func (ValArrayString) ToScript ¶
func (v ValArrayString) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValArrayString) TypeName ¶
func (v ValArrayString) TypeName() string
TypeName returns name of the type
func (*ValArrayString) UnmarshalJSON ¶
func (v *ValArrayString) UnmarshalJSON(data []byte) error
UnmarshalJSON splist data as string array
type ValArrayStringElem ¶
type ValArrayStringElem struct { Name string `json:"name"` Array ValArrayString `json:"array"` }
ValArrayStringElem enable parse a single string as string array that output as ary.1=xxx
func (*ValArrayStringElem) DelayedJSONDecode ¶
func (v *ValArrayStringElem) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValArrayStringElem) GenSample ¶
func (v ValArrayStringElem) GenSample(val interface{}, titleFirst bool) value.JSONValue
GenSample generate a sample JSON value
func (ValArrayStringElem) GetName ¶
func (v ValArrayStringElem) GetName(titleFirst bool) string
GetName returns Name of the value.
func (ValArrayStringElem) ToScript ¶
func (v ValArrayStringElem) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValArrayStringElem) TypeName ¶
func (v ValArrayStringElem) TypeName() string
TypeName returns name of the type
type ValBoolean ¶
type ValBoolean ValString
ValBoolean represents boolean value
func (*ValBoolean) DelayedJSONDecode ¶
func (v *ValBoolean) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValBoolean) GenSample ¶
func (v ValBoolean) GenSample(val interface{}, titleFirst bool) value.JSONValue
GenSample generate a sample JSON value
func (*ValBoolean) SetString ¶
func (v *ValBoolean) SetString(s string)
SetString set a string to Value
func (ValBoolean) ToScript ¶
func (v ValBoolean) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValBoolean) TypeName ¶
func (v ValBoolean) TypeName() string
TypeName returns name of the type
type ValDirectExpr ¶
type ValDirectExpr ValString // direct expression string
ValDirectExpr represents an direct JS expression
func (*ValDirectExpr) DelayedJSONDecode ¶
func (v *ValDirectExpr) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (*ValDirectExpr) SetString ¶
func (v *ValDirectExpr) SetString(s string)
SetString set a string to Value
func (*ValDirectExpr) SetStringWithError ¶
func (v *ValDirectExpr) SetStringWithError(s string) error
SetStringWithError set a string to Value with format check
func (ValDirectExpr) ToScript ¶
func (v ValDirectExpr) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValDirectExpr) TypeName ¶
func (v ValDirectExpr) TypeName() string
TypeName returns name of the type
func (ValDirectExpr) Validate ¶
func (v ValDirectExpr) Validate() error
Validate verify the value of object
type ValExprCmp ¶
type ValExprCmp struct { LValue Value `json:"lvalue"` // Left value Cmp string `json:"cmp"` // ""|lt|gt|le|ge|eq|ne RValue Value `json:"rvalue"` // Right value }
ValExprCmp represents a compare expression, eg: a eq b
func (*ValExprCmp) DelayedJSONDecode ¶
func (v *ValExprCmp) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValExprCmp) ToScript ¶
func (v ValExprCmp) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValExprCmp) TypeName ¶
func (v ValExprCmp) TypeName() string
TypeName returns name of the type
type ValExprFunc ¶
type ValExprFunc struct { Func string `json:"func"` // function name Paras []Value `json:"paras"` // parameters }
ValExprFunc represents a value of function call
func (*ValExprFunc) DelayedJSONDecode ¶
func (v *ValExprFunc) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValExprFunc) ToScript ¶
func (v ValExprFunc) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValExprFunc) TypeName ¶
func (v ValExprFunc) TypeName() string
TypeName returns name of the type
type ValExprGroup ¶
type ValExprGroup []ValExpr
ValExprGroup represents expression group, eg: (b+c)
func (*ValExprGroup) DelayedJSONDecode ¶
func (v *ValExprGroup) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValExprGroup) ToScript ¶
func (v ValExprGroup) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValExprGroup) TypeName ¶
func (v ValExprGroup) TypeName() string
TypeName returns name of the type
type ValExprSel ¶
type ValExprSel struct { Cond CondExpr `json:"cond"` // check condition Yes Value `json:"yes"` // yes value No Value `json:"no"` // no value }
ValExprSel represents a select expression, eg: cond ? yesVal : noVal
func (*ValExprSel) DelayedJSONDecode ¶
func (v *ValExprSel) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValExprSel) ToScript ¶
func (v ValExprSel) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValExprSel) TypeName ¶
func (v ValExprSel) TypeName() string
TypeName returns name of the type
type ValFiltObj ¶
type ValFiltObj struct { Source FieldRef `json:"source"` // field of object or array type White FieldMap `json:"white"` // white list of field name mapping, oldName->newName Black FieldMap `json:"black"` // black list of field name mapping Filter CondExpr `json:"filter"` // data fielter for an array // contains filtered or unexported fields }
ValFiltObj represents data filter expression
func (*ValFiltObj) DelayedJSONDecode ¶
func (v *ValFiltObj) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValFiltObj) GetName ¶
func (v ValFiltObj) GetName(titleFirst bool) string
GetName returns Name of the elem
func (ValFiltObj) ToScript ¶
func (v ValFiltObj) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValFiltObj) TypeName ¶
func (v ValFiltObj) TypeName() string
TypeName returns name of the type
type ValMergeObj ¶
type ValMergeObj []Value
ValMergeObj merge multi objects as one. eg: {a,b}+{c,d} => {a,b,c,d}
func (*ValMergeObj) DelayedJSONDecode ¶
func (v *ValMergeObj) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValMergeObj) ToScript ¶
func (v ValMergeObj) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValMergeObj) TypeName ¶
func (v ValMergeObj) TypeName() string
TypeName returns name of the type
type ValNumber ¶
type ValNumber ValString
ValNumber represents number value, deal as string
func (*ValNumber) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
type ValObject ¶
type ValObject ValArray
ValObject represents an object value, {...}
func (*ValObject) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
type ValString ¶
type ValString string
ValString represents string value
func (*ValString) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
type ValTimestamp ¶
type ValTimestamp ValString
ValTimestamp represents timestamp value
func (*ValTimestamp) DelayedJSONDecode ¶
func (v *ValTimestamp) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (ValTimestamp) GenSample ¶
func (v ValTimestamp) GenSample(val interface{}, titleFirst bool) value.JSONValue
GenSample generate a sample JSON value
func (*ValTimestamp) SetString ¶
func (v *ValTimestamp) SetString(s string)
SetString set a string to Value
func (ValTimestamp) ToScript ¶
func (v ValTimestamp) ToScript(depth int, e Evaler) (string, error)
ToScript returns the script of this element represent
func (ValTimestamp) TypeName ¶
func (v ValTimestamp) TypeName() string
TypeName returns name of the type
type Value ¶
type Value struct { // type of this value: // number|string|boolean|object|array|array_elem|array_string_elem|array_string| // undefined|null|mergeobj|filter|path|header|skey|action|signature|timestamp| // field|expr|exprcmp|exprsel|exprfunc|exprgroup|direct_expr Type Enum `json:"type"` Name string `json:"name"` // new name of this value Title string `json:"title,omitempty"` Desc string `json:"desc,omitempty"` // description of this value Appendix bool `json:"$appendix$,omitempty"` // NOTE: Appendix value, platform only Required bool `json:"required,omitempty"` // required Field FieldRef `json:"field,omitempty"` // field refer for this value, eg: "req1.data.x" Data FlexJSONObject `json:"data,omitempty"` // specific value for non-field content }
Value represents a value with given type It use Field value firstly.
func (Value) CreateSampleData ¶
CreateSampleData generate a sample JSON value
func (*Value) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
func (Value) DenyFieldRefer ¶
DenyFieldRefer assert this value don't refer a field value
func (Value) GetAsString ¶
GetAsString return Value as string if it contains that.
type ValueDefine ¶
type ValueDefine struct { InputValue //value Key bool `json:"key,omitempty"` // key field, for name check of referenced Default string `json:"default,omitempty"` // default value Mock string `json:"mock,omitempty"` // mock value Enums []string `json:"enums,omitempty"` // valid value enum of this input Ranges []string `json:"ranges,omitempty"` // valid value ranges [min,max)[min,max)... of this input }
ValueDefine represents the value of an input.
type ValueSet ¶
ValueSet represents a set of value for input
func (*ValueSet) AddExKV ¶
AddExKV add or update a named string value in this object without type check
func (*ValueSet) DelayedJSONDecode ¶
DelayedJSONDecode delay unmarshal flex json object
func (ValueSet) GetAction ¶
func (v ValueSet) GetAction() *expr.InputValue
GetAction return the action predef value
func (ValueSet) PrepareRequest ¶
func (v ValueSet) PrepareRequest(args *RequestArgs) error
PrepareRequest solve the input parameters from predefined values
func (*ValueSet) ReplacePathArgs ¶
ReplacePathArgs replace args in path from the input values
func (*ValueSet) ResolvePathArgs ¶
ResolvePathArgs repalce the path with fmt string and return it's fmt args. eg: "/api/:x" => ("/api/%v", ["$x"])
type XInputValue ¶
type XInputValue expr.InputValue
XInputValue is entended InputValue
func (XInputValue) CreateSampleData ¶
func (v XInputValue) CreateSampleData(val interface{}, titleFirst bool) value.JSONValue
CreateSampleData generate a sample JSON value
func (*XInputValue) DelayedJSONDecode ¶
func (v *XInputValue) DelayedJSONDecode() error
DelayedJSONDecode delay unmarshal flex json object
func (XInputValue) DenyFieldRefer ¶
func (v XInputValue) DenyFieldRefer() error
DenyFieldRefer assert this value don't refer a field value
func (XInputValue) GetAsString ¶
func (v XInputValue) GetAsString() string
GetAsString return Value as string if it contains that.
func (XInputValue) GetName ¶
func (v XInputValue) GetName(titleFirst bool) string
GetName return name of input value