Documentation
¶
Index ¶
- func ReadAppConfig(configFile string) (*app.Config, map[string]*definition.DefinitionRep, error)
- func ToSnakeCase(str string) string
- func WriteAppConfig(config *app.Config, outFile string) error
- type Action
- type Components
- type Condition
- type Contract
- type Info
- type Input
- type Parameter
- type Rule
- type Schema
- type Spec
- type Transaction
- func (tx *Transaction) ContainsParameter(name string) bool
- func (tx *Transaction) ParameterDef() (string, error)
- func (tx *Transaction) ToHandler(fe bool) (*trigger.HandlerConfig, error)
- func (tx *Transaction) ToHandlerSchema() (*trigger.SchemaConfig, error)
- func (tx *Transaction) ToResource(schm *trigger.SchemaConfig, cid string) (string, *definition.DefinitionRep, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadAppConfig ¶
func ReadAppConfig(configFile string) (*app.Config, map[string]*definition.DefinitionRep, error)
ReadAppConfig reads a Flogo app json file and returns app.Config
func ToSnakeCase ¶
ToSnakeCase converts camel case string to snake case
Types ¶
type Action ¶
type Action struct {
Activity string `json:"activity"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
Ledger map[string]interface{} `json:"ledger,omitempty"`
Config map[string]interface{} `json:"config,omitempty"`
Input *Input `json:"input,omitempty"`
}
Action defines an activity for processing a transaction
type Components ¶
Components contains reusable schema definitions
type Condition ¶
type Condition struct {
Name string `json:"name,omitempty"`
Description string `json:"description"`
Prerequisite string `json:"prerequisite,omitempty"`
Expr string `json:"expr,omitempty"`
}
Condition defines condition for executing list of actions for a transaction
type Contract ¶
type Contract struct {
Name string `json:"name"`
CID string `json:"cid"`
Transactions []*Transaction `json:"transactions"`
Info *Info `json:"info,omitempty"`
}
Contract defines a smart contract
type Info ¶
type Info struct {
Title string `json:"title"`
Version string `json:"version"`
Description string `json:"description,omitempty"`
}
Info defines general metadata of a contract spec
type Input ¶
type Input struct {
Schema map[string]interface{} `json:"schema,omitempty"`
Sample map[string]interface{} `json:"sample,omitempty"`
Mapping map[string]interface{} `json:"mapping"`
}
Input defines schema and mapping of an activity input
type Parameter ¶
type Parameter struct {
Name string `json:"name"`
Schema map[string]interface{} `json:"schema"`
Description string `json:"description,omitempty"`
Required bool `json:"required,omitempty"`
}
Parameter defines a parameter of transaction
type Rule ¶
type Rule struct {
Description string `json:"description,omitempty"`
Condition *Condition `json:"condition,omitempty"`
Actions []*Action `json:"actions"`
}
Rule defines condition and actions for processing a transaction
type Schema ¶
type Schema struct {
ID string `json:"$id"`
Properties map[string]interface{} `json:"properties"`
Required []string `json:"required,omitempty"`
}
Schema defines reusable JSON schema
type Spec ¶
type Spec struct {
Info *Info `json:"info"`
Imports []string `json:"imports"`
Contracts map[string]*Contract `json:"contracts"`
Components *Components `json:"components"`
}
Spec specifies one or more smart contracts
func ReadContract ¶
ReadContract reads a contract file and returns the contract spec
func (*Spec) ConvertAppSchemas ¶
ConvertAppSchemas converts schemas in contract spec to Flogo schema def
type Transaction ¶
type Transaction struct {
Name string `json:"name"`
Tag []string `json:"tag,omitempty"`
Parameters []*Parameter `json:"parameters"`
Transient map[string]interface{} `json:"transient"`
Returns map[string]interface{} `json:"returns"`
Rules []*Rule `json:"rules"`
}
Transaction defines a transaction in a contract
func (*Transaction) ContainsParameter ¶
func (tx *Transaction) ContainsParameter(name string) bool
ContainsParameter returns true if a parameter matches the specified name
func (*Transaction) ParameterDef ¶
func (tx *Transaction) ParameterDef() (string, error)
ParameterDef returns comma-delimited string of transaction parameters
func (*Transaction) ToHandler ¶
func (tx *Transaction) ToHandler(fe bool) (*trigger.HandlerConfig, error)
ToHandler converts a contract transaction to trigger handler config
func (*Transaction) ToHandlerSchema ¶
func (tx *Transaction) ToHandlerSchema() (*trigger.SchemaConfig, error)
ToHandlerSchema extracts schema config from a contract transaction
func (*Transaction) ToResource ¶
func (tx *Transaction) ToResource(schm *trigger.SchemaConfig, cid string) (string, *definition.DefinitionRep, error)
ToResource converts a contract transaction to flow resource definition