dvaction

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 29 Imported by: 1

Documentation

Overview

********************************************************************** MicroCore Copyright 2020 - 2020 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

********************************************************************** MicroCore Copyright 2020 - 2022 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

********************************************************************** MicroCore Copyright 2020 - 2023 by Danyil Dobryvechir (dobrivecher@yahoo.com ddobryvechir@gmail.com) ***********************************************************************

*********************************** The Version function assumes the original version to be stored as either an object with multiple versions, for example:

{
   "module1": "0.0.0.1",
   "module2": "1.2.3",
   "module3": "20",
}

or a single string (for example: "20.0") Versions in the same format must be stored in 2 places: source and destination. It executes actions only if any of those versions in the source are higher than in the destination. In case of a single string: I. A specified subroutine ("mainUpdate")is executed, which receives as a parameter the highest version ||. A specified subroutine ("versionUpdate") is executed to store the version in the destination (it is stored in VERSION_VALUE variable") In case of multiple versions, the execution depends on the mode as follows: "mode": = "simple" or "combined" In case of "simple", "mainUpdate" is executed for each key where version is higher Parameters are "VERSION_VALUE", "VERSION_KEY" The final version of the object is stored by special action ("versionUpdate") In case of combined, a filter is created for multiple versions to contain only those keys where the version is higher It is executed only once with this object of key:version as a parameter ("mainUpdate") For both modes, the saving of the versions in the destinations is saved as combined

Index

Constants

View Source
const (
	CommandCall          = "call"
	CommandCompareJson   = "compare"
	CommandConvert       = "convert"
	CommandFile          = "file"
	CommandFor           = "for"
	CommandHttp          = "http"
	CommandIf            = "if"
	CommandIfArray       = "ifarray"
	CommandIfEmpty       = "ifempty"
	CommandJs            = "js"
	CommandNet           = "net"
	CommandOs            = "os"
	CommandPaging        = "paging"
	CommandPortForward   = "forward"
	CommandProxy         = "proxy"
	CommandRange         = "range"
	CommandRecordBind    = "recordbind"
	CommandRecordCreate  = "recordcreate"
	CommandRecordDelete  = "recorddelete"
	CommandRecordReadAll = "recordreadall"
	CommandRecordReadOne = "recordreadone"
	CommandRecordScan    = "recordscan"
	CommandRecordUpdate  = "recordupdate"
	CommandReturn        = "return"
	CommandStore         = "store"
	CommandSql           = "sql"
	CommandSwitch        = "switch"
	CommandUpsert        = "upsert"
	CommandValidate      = "validate"
	CommandVar           = "var"
	CommandVersion       = "version"
	CommandVoid          = "void"
)
View Source
const (
	ExSeqPrefix                = "EXSEQ_"
	ExSeqIP                    = "IP"
	ExSeqActionName            = "ACTION_NAME"
	ExSeqLevel                 = ExSeqPrefix + "LEVEL"
	ExSeqSuffix                = "_"
	ExSeqReturn                = "ACTION_RETURN"
	ExSeqIgnoreReturn          = "_"
	ExSeqCurrentLevel          = ExSeqPrefix + "CURRENT_LEVEL"
	ExSeqReturnAllDefaultNames = ""
	ExSeqReturnSingleDefault   = "RETURN"
	ExActionLog                = "__ACTION_LOG__"
)
View Source
const (
	ACT_NORMAL = iota
	ACT_BREAK
	ACT_REMOVE
	ACT_REPLACE
	ACT_REPLACE_BREAK
)
View Source
const (
	M2MTokenPrefix = "M2M_TOKEN_"
	M2MTokenPath   = "M2MTOKEN_PATH"
	M2M            = "M2M"
	M2M_USERNAME   = "M2M_USERNAME"
	M2M_PASSWORD   = "M2M_PASSWORD"
	M2M_           = "M2M_"
)
View Source
const (
	ActionPrefix = "ACTION_"
)
View Source
const (
	Authorization = "Authorization"
)

Variables

View Source
var ActionLog bool = false

Functions

func ActCalculation

func ActCalculation(env *dvevaluation.DvObject, ctx *dvcontext.RequestContext, wholeAssign string) int

func ActionContextResult

func ActionContextResult(ctx *dvcontext.RequestContext)

func ActionExceptionByError

func ActionExceptionByError(comment string, err error, ctx *dvcontext.RequestContext)

func ActionExternalException

func ActionExternalException(status int, body []byte, ctx *dvcontext.RequestContext)

func ActionFinalException

func ActionFinalException(status int, body []byte, ctx *dvcontext.RequestContext)

func ActionInternalException

func ActionInternalException(status int, shortMessage string, longMessage string, ctx *dvcontext.RequestContext)

func ActionProcessResult

func ActionProcessResult(ctx *dvcontext.RequestContext, res bool)

func AddProcessFunction

func AddProcessFunction(key string, processor ProcessFunction)

func AddProcessFunctions

func AddProcessFunctions(pf map[string]ProcessFunction)

func CleanM2MTokenInCache

func CleanM2MTokenInCache(microserviceName string)

func CompareJsonByConfig

func CompareJsonByConfig(config *CompareJsonConfig, ctx *dvcontext.RequestContext) bool

func DebugShowVariable

func DebugShowVariable(ctx *dvcontext.RequestContext, name string)

func DebugShowVariablesByEnvList

func DebugShowVariablesByEnvList(ctx *dvcontext.RequestContext, lstName string)

func DebugShowVariablesByList

func DebugShowVariablesByList(ctx *dvcontext.RequestContext, lst string)

func DefaultInitWithObject

func DefaultInitWithObject(command string, result interface{}, env *dvevaluation.DvObject) bool

func DefaultOrSimpleInitWithObject

func DefaultOrSimpleInitWithObject(command string, result interface{}, env *dvevaluation.DvObject) (bool, string)

func DeleteActionResult

func DeleteActionResult(result string, ctx *dvcontext.RequestContext)

func ExecCall

func ExecCall(config *ExecCallConfig, ctx *dvcontext.RequestContext) bool

func ExecFor

func ExecFor(config *ExecForConfig, ctx *dvcontext.RequestContext) bool

func ExecIf

func ExecIf(config *ExecIfConfig, ctx *dvcontext.RequestContext) bool

func ExecIfArray

func ExecIfArray(config *ExecIfArrayConfig, ctx *dvcontext.RequestContext) bool

func ExecIfEmpty

func ExecIfEmpty(config *ExecIfEmptyConfig, ctx *dvcontext.RequestContext) bool

func ExecRange

func ExecRange(config *ExecRangeConfig, ctx *dvcontext.RequestContext) bool

func ExecReturn

func ExecReturn(config *ExecReturnConfig, ctx *dvcontext.RequestContext) bool

func ExecReturnShort

func ExecReturnShort(result string, ctx *dvcontext.RequestContext) bool

func ExecSwitch

func ExecSwitch(config *ExecSwitchConfig, ctx *dvcontext.RequestContext) bool

func ExecuteAddSubsequence

func ExecuteAddSubsequence(ctx *dvcontext.RequestContext, actionName string,
	paramStr map[string]string, returnKey string)

func ExecuteAddSubsequenceShort

func ExecuteAddSubsequenceShort(ctx *dvcontext.RequestContext, actionName string)

func ExecuteCalculate

func ExecuteCalculate(ctx *dvcontext.RequestContext, data map[string]string)

func ExecuteProcessFunction

func ExecuteProcessFunction(fn *ProcessFunction, pauseTime int, totalTime int, command string, group *sync.WaitGroup, ctx *dvcontext.RequestContext, debugList string) bool

func ExecuteReturnSubsequence

func ExecuteReturnSubsequence(ctx *dvcontext.RequestContext, retValue string)

func ExecuteSequence

func ExecuteSequence(startActionName string, ctx *dvcontext.RequestContext, initialParams map[string]string) bool

func ExecuteSequenceCycle

func ExecuteSequenceCycle(ctx *dvcontext.RequestContext, cycleLevel int) bool

func ExecuteSingleCommand

func ExecuteSingleCommand(pauseTime int, totalTime int, prefix string, command string) bool

func FilterOutByConditionSetUnset

func FilterOutByConditionSetUnset(env *dvevaluation.DvObject, src *dvevaluation.DvVariable, filter *FilterOutBlock)

func FindChangeByConfig

func FindChangeByConfig(config *FindChangeConfig, ctx *dvcontext.RequestContext) bool

func GetContextFileResult

func GetContextFileResult(ctx *dvcontext.RequestContext, fileName string) ([]byte, error)

func GetContextVarResult

func GetContextVarResult(ctx *dvcontext.RequestContext, varName string) ([]byte, error)

func GetIdentityProviderClientCredentials

func GetIdentityProviderClientCredentials(microServiceName string) (user string, pw string, ok bool)

func GetM2MToken

func GetM2MToken(microserviceName string) (token string, okFinal bool)

func GetM2MTokenFromFileSystem

func GetM2MTokenFromFileSystem(microserviceName string) (token string, ok bool)

func GetMicroServicePropertyName

func GetMicroServicePropertyName(microServiceName string) string

func IsLikeJson

func IsLikeJson(s string) bool

func JsRunByConfig

func JsRunByConfig(config *JsConfig, ctx *dvcontext.RequestContext) bool

func JsonConvertConcat

func JsonConvertConcat(push *JsonRead, dst *dvevaluation.DvVariable, ctx *dvcontext.RequestContext)

func JsonConvertPush

func JsonConvertPush(push *JsonRead, dst *dvevaluation.DvVariable, ctx *dvcontext.RequestContext)

func JsonConvertRunByConfig

func JsonConvertRunByConfig(config *JsonConvertConfig, ctx *dvcontext.RequestContext) bool

func JsonExtract

func JsonExtract(info *JsonRead, ctx *dvcontext.RequestContext) (interface{}, error)

func JsonExtractExtended

func JsonExtractExtended(place string, path string, filter string, sort []string,
	afterPath string, noReadOfUndefined bool, errorSignificant bool, ids []string, convert string,
	ctx *dvcontext.RequestContext) (interface{}, error)

func NetRequest

func NetRequest(method string, url string, body string, headers map[string]string, options map[string]interface{}, forceM2mSimple bool) ([]byte, error, http.Header, int)

func PagingRunByConfig

func PagingRunByConfig(config *PagingConfig, ctx *dvcontext.RequestContext) bool

func ProcessSavingActionResult

func ProcessSavingActionResult(result string, data interface{}, ctx *dvcontext.RequestContext, err error, message1 string, message2 string) bool

func ProcessSingleFile

func ProcessSingleFile(fileName string, config *ReadFileConfig, ctx *dvcontext.RequestContext, isMulti bool) bool

func ProxyNetInit

func ProxyNetInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)

func ProxyNetRun

func ProxyNetRun(data []interface{}) bool

func ProxyNetRunByConfig

func ProxyNetRunByConfig(config *ProxyNetConfig, ctx *dvcontext.RequestContext) bool

func ReadActionResult

func ReadActionResult(result string, ctx *dvcontext.RequestContext) (res interface{}, ok bool)

func ReadFileByConfigKind

func ReadFileByConfigKind(config *ReadFileConfig, ctx *dvcontext.RequestContext) bool

func ReadJsonTrimmed

func ReadJsonTrimmed(data []byte, path string, noReadOfUndefined bool, env *dvevaluation.DvObject) (interface{}, error)

func RegisterCredentialProvider

func RegisterCredentialProvider(provider CredentialProvider)

func RegisterOC

func RegisterOC() bool

func RegisterStorageActionProvider

func RegisterStorageActionProvider(name string, provider StorageActionProvider)

func SaveActionResult

func SaveActionResult(result string, data interface{}, ctx *dvcontext.RequestContext)

func SaveHeaderResult

func SaveHeaderResult(result string, heads http.Header, env *dvevaluation.DvObject)

func SaveM2MTokenInFileSystem

func SaveM2MTokenInFileSystem(microserviceName string, accessToken *AccessToken)

func SetReturnParameters

func SetReturnParameters(params map[string]string, ctx *dvcontext.RequestContext)

func SmartNetInit

func SmartNetInit(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)

func SmartNetRun

func SmartNetRun(data []interface{}) bool

func SmartNetRunByConfig

func SmartNetRunByConfig(config *SmartNetConfig, ctx *dvcontext.RequestContext) bool

func SseExecutor

func SseExecutor(ctx *dvcontext.RequestContext, v interface{}) interface{}

func SseServe

func SseServe(ctx *dvcontext.RequestContext, control *dvcontext.Stage) bool

func StoreRunByConfig

func StoreRunByConfig(config *StoreConfig, ctx *dvcontext.RequestContext) bool

func StoreValue

func StoreValue(path string, data interface{}, format string, before string, after string, storage string, env *dvevaluation.DvObject) (err error)

func UpsertJsonByConfig

func UpsertJsonByConfig(config *UpsertJsonConfig, ctx *dvcontext.RequestContext) bool

func ValidateCondition

func ValidateCondition(data string, env *dvevaluation.DvObject) (bool, bool)

func ValidateExists

func ValidateExists(data string, env *dvevaluation.DvObject) bool

func ValidateItem

func ValidateItem(item *ValidationItem, env *dvevaluation.DvObject) (int, string, bool)

func ValidateNonEmpty

func ValidateNonEmpty(data string, env *dvevaluation.DvObject) bool

func ValidationRunByConfig

func ValidationRunByConfig(config *ValidationConfig, ctx *dvcontext.RequestContext) bool

func VarTransformRunByConfig

func VarTransformRunByConfig(config *VarTransformConfig, ctx *dvcontext.RequestContext) bool

func VersionKeyValueExecution

func VersionKeyValueExecution(src map[string]string, dst map[string]string, config *VersionConfig, ctx *dvcontext.RequestContext)

func VersionRunByConfig

func VersionRunByConfig(config *VersionConfig, ctx *dvcontext.RequestContext) bool

func VersionStringExecution

func VersionStringExecution(src string, dst string, config *VersionConfig, ctx *dvcontext.RequestContext)

Types

type AccessToken

type AccessToken struct {
	AccessToken      string `json:"access_token"`
	TokenType        string `json:"token_type"`
	ExpiresIn        int    `json:"expires_in"`
	RefreshExpiresIn int    `json:"refresh_expires_in"`
	RefreshToken     string `json:"refresh_token"`
	NotBeforePolicy  int    `json:"not-before-policy"`
	SessionState     string `json:"session_state"`
	Scope            string `json:"scope"`
}

type AssignInfo

type AssignInfo struct {
	Var       string `json:"var"`
	Condition string `json:"condition"`
	IfNotSet  string `json:"if_not_set"`
	IfEmpty   string `json:"if_empty"`
}

type AssignmentBlock

type AssignmentBlock struct {
	Source string `json:"source"`
	Field  string `json:"field"`
	Value  string `json:"value"`
}

type Collection

type Collection struct {
	Source    string             `json:"source"`
	Unique    []string           `json:"unique"`
	Assign    []*AssignmentBlock `json:"assign"`
	MergeMode int                `json:"merge_mode"`
	Append    bool               `json:"append"`
}

func (*Collection) AddItem

func (collection *Collection) AddItem(env *dvevaluation.DvObject)

func (*Collection) AddItemSecondary

func (collection *Collection) AddItemSecondary(env *dvevaluation.DvObject)

func (*Collection) Initialize

func (collection *Collection) Initialize(env *dvevaluation.DvObject)

type CompareJsonConfig

type CompareJsonConfig struct {
	Sample             *JsonRead `json:"sample"`
	Ref                *JsonRead `json:"ref"`
	Added              string    `json:"added"`
	Removed            string    `json:"removed"`
	Updated            string    `json:"updated"`
	UpdatedRef         string    `json:"updatedRef"`
	Unchanged          string    `json:"unchanged"`
	UnchangedAsUpdated bool      `json:"unchangedAsUpdated"`
}

type ConcatObjectInfo

type ConcatObjectInfo struct {
	Sources []string `json:"sources"`
	Dst     string   `json:"dst"`
}

type ConditionBlock

type ConditionBlock struct {
	Condition       string             `json:"condition"`
	SetList         []string           `json:"set"`
	UnsetList       []string           `json:"unset"`
	ThenAssign      []*AssignmentBlock `json:"then_assign"`
	ElseAssign      []*AssignmentBlock `json:"else_assign"`
	ThenWholeAssign string             `json:"then_to_whole"`
	ElseWholeAssign string             `json:"else_to_whole"`
	ThenCollection  *Collection        `json:"then_collection"`
	ElseCollection  *Collection        `json:"else_collection"`
	Match           string             `json:"match"`
	Item            string             `json:"item"`
	// contains filtered or unexported fields
}

func (*ConditionBlock) EvaluateSuccess

func (b *ConditionBlock) EvaluateSuccess(env *dvevaluation.DvObject, ctx *dvcontext.RequestContext, fields []string) bool

func (*ConditionBlock) Process

func (*ConditionBlock) ProcessSingle

func (b *ConditionBlock) ProcessSingle(f *dvevaluation.DvVariable, env *dvevaluation.DvObject, ctx *dvcontext.RequestContext, fields []string) int

type ConvertReplaceBlock

type ConvertReplaceBlock struct {
	FindObject    string `json:"find_object"`
	FindCondition string `json:"find_condition"`
	IsLast        bool   `json:"is_last"`
	ReplaceWith   string `json:"replace_with"`
	ReplaceMode   string `json:"replace_mode"`
	InDefault     string `json:"in_default"`
}

type CredentialProvider

type CredentialProvider func(string) (string, string, bool)

type ErrorActionProvider

type ErrorActionProvider struct{}

func (*ErrorActionProvider) Delete

func (provider *ErrorActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*ErrorActionProvider) PathSupported

func (provider *ErrorActionProvider) PathSupported() bool

func (*ErrorActionProvider) Read

func (provider *ErrorActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*ErrorActionProvider) Save

func (provider *ErrorActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type ExecCallConfig

type ExecCallConfig struct {
	Action string            `json:"action"`
	Params map[string]string `json:"params"`
	Result string            `json:"result"`
}

type ExecForConfig

type ExecForConfig struct {
	Params     map[string]string `json:"initial"`
	Condition  string            `json:"condition"`
	Next       map[string]string `json:"next"`
	BodyAction string            `json:"body"`
	Result     string            `json:"result"`
}

type ExecIfArrayConfig

type ExecIfArrayConfig struct {
	Source string          `json:"source"`
	Then   *ExecCallConfig `json:"then"`
	Else   *ExecCallConfig `json:"else"`
	Ensure string          `json:"ensure"`
}

type ExecIfConfig

type ExecIfConfig struct {
	Condition string          `json:"condition"`
	Then      *ExecCallConfig `json:"then"`
	Else      *ExecCallConfig `json:"else"`
	OnError   *ExecCallConfig `json:"on_error"`
	Error     int             `json:"error"`
}

type ExecIfEmptyConfig

type ExecIfEmptyConfig struct {
	Source string          `json:"source"`
	Then   *ExecCallConfig `json:"then"`
	Else   *ExecCallConfig `json:"else"`
}

type ExecRangeConfig

type ExecRangeConfig struct {
	Params     map[string]string `json:"params"`
	MapObject  string            `json:"range"`
	BodyAction string            `json:"body"`
	Result     string            `json:"result"`
}

type ExecReturnConfig

type ExecReturnConfig struct {
	Result string `json:"result"`
}

type ExecSwitchConfig

type ExecSwitchConfig struct {
	DefaultAction string            `json:"defaultAction"`
	Params        map[string]string `json:"params"`
	Cases         map[string]string `json:"cases"`
	Result        string            `json:"result"`
}

type FileActionProvider

type FileActionProvider struct{}

func (*FileActionProvider) Delete

func (provider *FileActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*FileActionProvider) PathSupported

func (provider *FileActionProvider) PathSupported() bool

func (*FileActionProvider) Read

func (provider *FileActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*FileActionProvider) Save

func (provider *FileActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type FileSizeActionProvider

type FileSizeActionProvider struct{}

func (*FileSizeActionProvider) Delete

func (provider *FileSizeActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*FileSizeActionProvider) PathSupported

func (provider *FileSizeActionProvider) PathSupported() bool

func (*FileSizeActionProvider) Read

func (provider *FileSizeActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*FileSizeActionProvider) Save

func (provider *FileSizeActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type FilterOutBlock

type FilterOutBlock struct {
	Condition string   `json:"condition"`
	Set       []string `json:"set"`
	Unset     []string `json:"unset"`
	NoEmpty   bool     `json:"no_empty"`
}

type FindChangeConfig

type FindChangeConfig struct {
	Sample       *JsonRead `json:"sample"`
	Ref          *JsonRead `json:"ref"`
	Result       string    `json:"result"`
	Algorithm    string    `json:"algorithm"`
	AddFieldName string    `json:"add_field_name"`
}

type ForEachBlock

type ForEachBlock struct {
	PreCondition string            `json:"pre_condition"`
	WildCardPath string            `json:"path"`
	Blocks       []*ConditionBlock `json:"blocks"`
}

func (*ForEachBlock) ForEachProcessing

func (proc *ForEachBlock) ForEachProcessing(src *dvevaluation.DvVariable, env *dvevaluation.DvObject, ctx *dvcontext.RequestContext)

func (*ForEachBlock) ForEachProcessingWithPath

func (proc *ForEachBlock) ForEachProcessingWithPath(forEachPathKeys *dvevaluation.DvVariable, forEachPathValues *dvevaluation.DvVariable, pathes []string, src *dvevaluation.DvVariable, env *dvevaluation.DvObject, ctx *dvcontext.RequestContext)

func (*ForEachBlock) ForEachProcessingWithoutPath

func (proc *ForEachBlock) ForEachProcessingWithoutPath(src *dvevaluation.DvVariable, env *dvevaluation.DvObject, ctx *dvcontext.RequestContext)

type GlobalActionProvider

type GlobalActionProvider struct{}

func (*GlobalActionProvider) Delete

func (provider *GlobalActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*GlobalActionProvider) PathSupported

func (provider *GlobalActionProvider) PathSupported() bool

********************************************************************************************************

func (*GlobalActionProvider) Read

func (provider *GlobalActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*GlobalActionProvider) Save

func (provider *GlobalActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type IncreaseVersionInfo

type IncreaseVersionInfo struct {
	Var        string `json:"var"`
	Limit      int    `json:"limit"`
	DefVersion string `json:"def_version"`
}

type JsConfig

type JsConfig struct {
	File   string `json:"file"`
	Result string `json:"result"`
}

type JsonConvertConfig

type JsonConvertConfig struct {
	Source       *JsonRead            `json:"source"`
	Result       string               `json:"result"`
	Add          []*JsonRead          `json:"add"`
	Merge        []*JsonRead          `json:"merge"`
	Replace      []*JsonRead          `json:"replace"`
	Update       []*JsonRead          `json:"update"`
	Push         []*JsonRead          `json:"push"`
	Concat       []*JsonRead          `json:"concat"`
	Remove       []string             `json:"remove"`
	ForEach      *ForEachBlock        `json:"for_each"`
	Filter       *FilterOutBlock      `json:"filter"`
	ReplaceBlock *ConvertReplaceBlock `json:"replace_block"`
}

type JsonParseData

type JsonParseData struct {
	Var        string `json:"string"`
	Evaluation int    `json:"evaluation"`
}

type JsonRead

type JsonRead struct {
	Var               string   `json:"var"`
	Path              string   `json:"path"`
	Filter            string   `json:"filter"`
	Sort              []string `json:"sort"`
	AfterPath         string   `json:"afterPath"`
	NoReadOfUndefined bool     `json:"noReadOfUndefined"`
	ErrorSignificant  bool     `json:"errorSignificant"`
	Convert           string   `json:"convert"`
	Ids               []string `json:"ids"`
	Destination       string   `json:"destination"`
}

type LogActionProvider

type LogActionProvider struct{}

func (*LogActionProvider) Delete

func (provider *LogActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*LogActionProvider) PathSupported

func (provider *LogActionProvider) PathSupported() bool

func (*LogActionProvider) Read

func (provider *LogActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*LogActionProvider) Save

func (provider *LogActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type MapActionProvider

type MapActionProvider struct{}

func (*MapActionProvider) Delete

func (provider *MapActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*MapActionProvider) PathSupported

func (provider *MapActionProvider) PathSupported() bool

********************************************************************************************************

func (*MapActionProvider) Read

func (provider *MapActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*MapActionProvider) Save

func (provider *MapActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type ObjectByArrayInfo

type ObjectByArrayInfo struct {
	Src         *JsonRead `json:"src"`
	Dst         string    `json:"dst"`
	Key         string    `json:"key"`
	Value       string    `json:"value"`
	KeyPolicy   int       `json:"key_policy"`
	ValuePolicy int       `json:"value_policy"`
}

type ObjectByObjectInfo

type ObjectByObjectInfo struct {
	Src         *JsonRead `json:"src"`
	Dst         string    `json:"dst"`
	Key         string    `json:"key"`
	Value       string    `json:"value"`
	KeyPolicy   int       `json:"key_policy"`
	ValuePolicy int       `json:"value_policy"`
}

type PagingConfig

type PagingConfig struct {
	Source      *JsonRead `json:"source"`
	Result      string    `json:"result"`
	StorePrefix string    `json:"prefix"`
	PageSize    int       `json:"pageSize"`
	CurrentPage int       `json:"currentPage"`
}

type PlaceRegExpression

type PlaceRegExpression struct {
	RegExpr  string `json:"reg-expr"`
	Group    string `json:"group"`
	DefValue string `json:"def-value"`
	Source   string `json:"source"`
	IsAll    bool   `json:"is-all"`
	Count    int    `json:"count"`
}

type ProcessFunction

type ProcessFunction struct {
	Init  func(command string, ctx *dvcontext.RequestContext) ([]interface{}, bool)
	Run   func([]interface{}) bool
	Async bool
}

type ProxyNetConfig

type ProxyNetConfig struct {
	Url               string `json:"url"`
	Method            string `json:"method"`
	Headers           string `json:"headers"`
	ContentType       string `json:"type"`
	Result            string `json:"result"`
	Body              string `json:"body"`
	DefaultResult     string `json:"default"`
	NotProxyHeaders   bool   `json:"not_proxy_headers"`
	NotProxyUrlParams bool   `json:"not_proxy_url_params"`
	NotAddUrlPath     bool   `json:"not_add_url_path"`
	NotProxyBody      bool   `json:"not_proxy_body"`
	NotReturnHeaders  bool   `json:"not_return_headers"`
	Ignorable         bool   `json:"ignorable"`
	M2MSimple         bool   `json:"m2m_simple"`
	UrlFromParam      string `json:"url_from_param"`
}

type ReadFileConfig

type ReadFileConfig struct {
	FileName          string   `json:"name"`
	Kind              string   `json:"kind"`
	Result            string   `json:"result"`
	Path              string   `json:"path"`
	Filter            string   `json:"filter"`
	Sort              []string `json:"sort"`
	Joiner            string   `json:"joiner"`
	Append            int      `json:"append"`
	NoReadOfUndefined bool     `json:"noReadOfUndefined"`
	ErrorSignificant  bool     `json:"errorSignificant"`
	IsTemplate        bool     `json:"template"`
	EolJoiner         bool     `json:"eol_joiner"`
}

type RemoveByKeysInfo

type RemoveByKeysInfo struct {
	Src  *JsonRead `json:"src"`
	Dst  string    `json:"dst"`
	Keys []string  `json:"keys"`
}

type ReplaceRegExpression

type ReplaceRegExpression struct {
	RegExpr     string `json:"reg-expr"`
	Replacement string `json:"replacement"`
	Source      string `json:"source"`
	Literal     bool   `json:"literal"`
}

type ReplaceTextInfo

type ReplaceTextInfo struct {
	Src   string `json:"src"`
	Dst   string `json:"dst"`
	Rules string `json:"rules"`
}

type RequestActionProvider

type RequestActionProvider struct{}

func (*RequestActionProvider) Delete

func (provider *RequestActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*RequestActionProvider) PathSupported

func (provider *RequestActionProvider) PathSupported() bool

********************************************************************************************************

func (*RequestActionProvider) Read

func (provider *RequestActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*RequestActionProvider) Save

func (provider *RequestActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type SessionActionProvider

type SessionActionProvider struct{}

func (*SessionActionProvider) Delete

func (provider *SessionActionProvider) Delete(ctx *dvcontext.RequestContext, prefix string, key string) error

func (*SessionActionProvider) PathSupported

func (provider *SessionActionProvider) PathSupported() bool

func (*SessionActionProvider) Read

func (provider *SessionActionProvider) Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)

func (*SessionActionProvider) Save

func (provider *SessionActionProvider) Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error

type SmartNetConfig

type SmartNetConfig struct {
	Url           string                 `json:"url"`
	Method        string                 `json:"method"`
	Headers       string                 `json:"headers"`
	Template      SmartNetConfigTemplate `json:"template"`
	ContentType   string                 `json:"type"`
	Result        string                 `json:"result"`
	DefaultResult string                 `json:"default"`
	Body          string                 `json:"body"`
	Ignorable     bool                   `json:"ignorable"`
	M2MSimple     bool                   `json:"m2m_simple"`
}

type SmartNetConfigTemplate

type SmartNetConfigTemplate struct {
	Src string `json:"src"`
	Dst string `json:"dst"`
}

type StorageActionProvider

type StorageActionProvider interface {
	PathSupported() bool
	Read(ctx *dvcontext.RequestContext, prefix string, key string) (interface{}, bool, error)
	Save(ctx *dvcontext.RequestContext, prefix string, key string, value interface{}) error
	Delete(ctx *dvcontext.RequestContext, prefix string, key string) error
}

func GetLevelMainPath

func GetLevelMainPath(data string) (level string, subLevel string, result string, path string, prePath string, isFatal bool, pathSevere bool, provider StorageActionProvider)

type StoreConfig

type StoreConfig struct {
	Storage string            `json:"storage"`
	Data    map[string]string `json:"data"`
	Format  string            `json:"format"`
	Before  string            `json:"before"`
	After   string            `json:"after"`
}

type UpsertJsonConfig

type UpsertJsonConfig struct {
	Sample        *JsonRead `json:"change"`
	Ref           *JsonRead `json:"stored"`
	DisableUpdate int       `json:"disable_update"`
	DisableInsert int       `json:"disable_insert"`
}

type ValidationConfig

type ValidationConfig struct {
	Check  []*ValidationItem `json:"check"`
	Errors []string          `json:"errors"`
	Code   int               `json:"code"`
}

type ValidationItem

type ValidationItem struct {
	Data  string `json:"data"`
	Part  string `json:"part"`
	Kind  string `json:"kind"`
	Error string `json:"error"`
	Code  int    `json:"code"`
}

type VarTransformConfig

type VarTransformConfig struct {
	JsonParse       map[string]*JsonParseData        `json:"parse"`
	Read            map[string]*JsonRead             `json:"read"`
	ToInteger       map[string]string                `json:"to_integer"`
	Transform       map[string]string                `json:"transform"`
	Clone           map[string]string                `json:"clone"`
	DefaultString   map[string]string                `json:"default_string"`
	Assign          map[string]*AssignInfo           `json:"assign"`
	DefaultAny      map[string]string                `json:"default_any"`
	FindRegExpr     map[string]*PlaceRegExpression   `json:"find"`
	ReplaceRegExpr  map[string]*ReplaceRegExpression `json:"replace"`
	IncreaseVersion map[string]*IncreaseVersionInfo  `json:"increase_version"`
	RemoveVars      []string                         `json:"remove_vars"`
	CreateObject    map[string]map[string]string     `json:"create_object"`
	CreateArray     map[string][]string              `json:"create_array"`
	ConcatObjects   *ConcatObjectInfo                `json:"concat_objects"`
	ObjectByArray   *ObjectByArrayInfo               `json:"object_by_array"`
	ObjectByObject  *ObjectByObjectInfo              `json:"object_by_object"`
	RemoveByKeys    *RemoveByKeysInfo                `json:"remove_by_keys"`
	ReplaceText     *ReplaceTextInfo                 `json:"replace_text"`
	ErrorMessage    string                           `json:"error_message"`
}

type VersionConfig

type VersionConfig struct {
	Source         string `json:"src"`
	Destination    string `json:"dst"`
	SourcePath     string `json:"srcPath"`
	DstPath        string `json:"dstPath"`
	Mode           string `json:"mode"`
	MainUpdate     string `json:"mainUpdate"`
	VersionUpdate  string `json:"versionUpdate"`
	VersionVarName string `json:"versionVarName"`
	KeyVarName     string `json:"keyVarName"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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