funcs

package
v0.0.0-...-df163ab Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSharpFuncs

type CSharpFuncs struct {
}

func (*CSharpFuncs) Execute

func (cf *CSharpFuncs) Execute(f *Funcs)

func (*CSharpFuncs) Testfunction

func (cf *CSharpFuncs) Testfunction(content string, inputs interface{}, outputs []string) (map[string]interface{}, error)

func (*CSharpFuncs) Validate

func (cf *CSharpFuncs) Validate(f *Funcs) (bool, error)

type CollectionDeleteFuncs

type CollectionDeleteFuncs struct {
}

func (*CollectionDeleteFuncs) Execute

func (cf *CollectionDeleteFuncs) Execute(f *Funcs)

type CollectionInsertFuncs

type CollectionInsertFuncs struct {
}

func (*CollectionInsertFuncs) Execute

func (cf *CollectionInsertFuncs) Execute(f *Funcs)

type CollectionUpdateFuncs

type CollectionUpdateFuncs struct {
}

func (*CollectionUpdateFuncs) Execute

func (cf *CollectionUpdateFuncs) Execute(f *Funcs)

type EmailFuncs

type EmailFuncs struct{}

func (*EmailFuncs) Execute

func (cf *EmailFuncs) Execute(f *Funcs)

Execute executes the SendEmail function. It validates the email configuration, sets up the email parameters, and sends the email using the provided SMTP server. If an attachment is specified, it sends the email with the attachment, otherwise it sends the email without any attachment.

func (*EmailFuncs) Validate

func (cf *EmailFuncs) Validate(f *Funcs) (bool, EmailStru)

Validate validates the inputs for sending an email. It checks if the required fields (ToEmails, Subject, Body) are not empty. If any of the required fields are empty, it returns false along with the empty email structure. Otherwise, it returns true along with the populated email structure.

type EmailStru

type EmailStru struct {
	ToEmailList  []string
	FromEmail    string
	Subject      string
	Body         string
	Attachment   string
	SmtpServer   string
	SmtpPort     int
	SmtpUser     string
	SmtpPassword string
}

type Funcs

type Funcs struct {
	Fobj                types.Function
	DBTx                *sql.Tx
	Ctx                 context.Context
	CtxCancel           context.CancelFunc
	SystemSession       map[string]interface{} // {sessionanme: value}
	UserSession         map[string]interface{} // {sessionanme: value}
	Externalinputs      map[string]interface{} // {sessionanme: value}
	Externaloutputs     map[string]interface{} // {sessionanme: value}
	FuncCachedVariables map[string]interface{}

	FunctionInputs       []map[string]interface{}
	FunctionOutputs      []map[string]interface{}
	ExecutionNumber      int
	ExecutionCount       int
	FunctionMappedInputs map[string]interface{}
	DocDBCon             *documents.DocDB
	SignalRClient        signalr.Client
	ErrorMessage         string
	TestwithSc           bool
	TestResults          []map[string]interface{}
	// contains filtered or unexported fields
}

func NewFuncs

func NewFuncs(DocDBCon *documents.DocDB, SignalRClient signalr.Client, dbTx *sql.Tx, fobj types.Function, systemSession, userSession, externalinputs, externaloutputs, funcCachedVariables map[string]interface{}, ctx context.Context, ctxcancel context.CancelFunc) *Funcs

func (*Funcs) CancelExecution

func (f *Funcs) CancelExecution(errormessage string)

CancelExecution cancels the execution of the function and rolls back any database transaction. It takes an error message as input and logs the error message along with the function name. It also cancels the context and returns.

func (*Funcs) ConvertfromBytes

func (f *Funcs) ConvertfromBytes(bytesbuffer []byte) map[string]interface{}

func (*Funcs) ConverttoBool

func (f *Funcs) ConverttoBool(str string) bool

func (*Funcs) ConverttoDateTime

func (f *Funcs) ConverttoDateTime(str string) time.Time

func (*Funcs) ConverttoFloat

func (f *Funcs) ConverttoFloat(str string) float64

func (*Funcs) ConverttoInt

func (f *Funcs) ConverttoInt(str string) int

func (*Funcs) Execute

func (f *Funcs) Execute()

Execute executes the function. It measures the execution time, handles panics, and executes the appropriate function based on the function type. It also sets the function outputs and updates the execution count.

func (*Funcs) HandleInputs

func (f *Funcs) HandleInputs() ([]string, []string, map[string]interface{}, error)

func (*Funcs) SetInputs

func (f *Funcs) SetInputs() ([]string, []string, map[string]interface{})

func (*Funcs) SetOutputs

func (f *Funcs) SetOutputs(outputs map[string]interface{})

func (*Funcs) SetfuncOutputs

func (f *Funcs) SetfuncOutputs()

func (*Funcs) SetfuncSingleOutputs

func (f *Funcs) SetfuncSingleOutputs(outputs map[string]interface{})

SetfuncSingleOutputs sets the single outputs of the Funcs object based on the provided map of outputs. It iterates through the outputs of the Funcs object and assigns the corresponding values from the map to the appropriate destinations. The UserSession, Externaloutputs, and FuncCachedVariables are updated accordingly. If an error occurs during the process, it is recovered and logged. The performance duration of the function is also logged. Parameters: - outputs: A map of string keys and interface{} values representing the outputs. Returns: - An error if there was an error in the process.

func (*Funcs) Validate

func (f *Funcs) Validate() (bool, error)

type GoExprFuncs

type GoExprFuncs struct {
}

func (*GoExprFuncs) Execute

func (cf *GoExprFuncs) Execute(f *Funcs)

func (*GoExprFuncs) Testfunction

func (cf *GoExprFuncs) Testfunction(content string, inputs interface{}, outputs []string) (map[string]interface{}, error)

func (*GoExprFuncs) Validate

func (cf *GoExprFuncs) Validate(f *Funcs) (bool, error)

type InputMapFuncs

type InputMapFuncs struct{}

func (*InputMapFuncs) Execute

func (cf *InputMapFuncs) Execute(f *Funcs)

func (*InputMapFuncs) Validate

func (cf *InputMapFuncs) Validate(f *Funcs) bool

type JSFuncs

type JSFuncs struct {
}

func (*JSFuncs) Execute

func (cf *JSFuncs) Execute(f *Funcs)

Execute executes the JavaScript function defined in the Funcs object. It sets the inputs, runs the JavaScript code, and sets the outputs. If there is an error during execution, it logs the error and returns. The execution time is also logged.

func (*JSFuncs) Execute_otto

func (cf *JSFuncs) Execute_otto(f *Funcs)

func (*JSFuncs) Testfunction

func (cf *JSFuncs) Testfunction(content string, inputs interface{}, outputs []string) (map[string]interface{}, error)

Testfunction is a function that executes JavaScript code using the goja VM. It takes a content string, inputs interface{}, and outputs []string as parameters. The function returns a map[string]interface{} containing the values of the specified outputs, and an error if there was an error during execution. The execution time is also logged.

func (*JSFuncs) Testfunction_otto

func (cf *JSFuncs) Testfunction_otto(content string, inputs interface{}, outputs []string) (map[string]interface{}, error)

func (*JSFuncs) Validate

func (cf *JSFuncs) Validate(f *Funcs) (bool, error)

func (*JSFuncs) Validate_otto

func (cf *JSFuncs) Validate_otto(f *Funcs) (bool, error)

type QueryFuncs

type QueryFuncs struct {
}

func (*QueryFuncs) Execute

func (cf *QueryFuncs) Execute(f *Funcs)

Execute executes the query function. It measures the execution time and logs performance metrics. If there is an error during execution, it logs the error and sets the error message. It sets the user session and creates a SELECT clause with aliases. It performs the query operation using the provided database connection. It logs the outputs, column count, and row count. Finally, it sets the outputs of the function.

func (*QueryFuncs) Testfunction

func (cf *QueryFuncs) Testfunction(f *Funcs) (bool, error)

func (*QueryFuncs) Validate

func (cf *QueryFuncs) Validate(f *Funcs) (bool, error)

type Response

type Response struct {
	Data interface{} `json:"data"`
}

type SendMessageFuncs

type SendMessageFuncs struct {
}

func (*SendMessageFuncs) Execute

func (cf *SendMessageFuncs) Execute(f *Funcs)

Execute executes the SendMessageFuncs function. It sets the start time, defers the calculation of elapsed time and logging of performance, and recovers from any panics that occur during execution. It retrieves the inputs, sets the topic and data, and marshals the data into JSON format. If the topic is empty, it logs an error and returns. It then invokes the SignalRClient or IACMessageBusClient to send the message. Finally, it sets the outputs of the function.

func (*SendMessageFuncs) Validate

func (cf *SendMessageFuncs) Validate(f *Funcs) (bool, error)

Validate validates the SendMessageFuncs function. It checks if the namelist and valuelist are empty, and if the "Topic" name is present in the namelist. Returns true if the validation passes, otherwise returns false with an error. It also logs the performance of the function.

type SendMessagebyActiveMQ

type SendMessagebyActiveMQ struct {
}

func (*SendMessagebyActiveMQ) Execute

func (w *SendMessagebyActiveMQ) Execute(f *Funcs)

type SendMessagebyKafka

type SendMessagebyKafka struct {
}

func (*SendMessagebyKafka) Execute

func (cf *SendMessagebyKafka) Execute(f *Funcs)

func (*SendMessagebyKafka) Validate

func (cf *SendMessagebyKafka) Validate(f *Funcs) (bool, error)

Validate validates the SendMessagebyKafka function. It checks if the namelist and valuelist are empty, and if the "Topic" name is present in the namelist. Returns true if the validation passes, otherwise returns false with an error. It also logs the performance of the function.

type SendMessagebyMQTT

type SendMessagebyMQTT struct {
}

func (*SendMessagebyMQTT) Execute

func (w *SendMessagebyMQTT) Execute(f *Funcs)

type StoreProcFuncs

type StoreProcFuncs struct {
}

func (*StoreProcFuncs) Execute

func (cf *StoreProcFuncs) Execute(f *Funcs)

func (*StoreProcFuncs) Testfunction

func (cf *StoreProcFuncs) Testfunction(f *Funcs) (bool, error)

func (*StoreProcFuncs) Validate

func (cf *StoreProcFuncs) Validate(f *Funcs) (bool, error)

type SubTranCode

type SubTranCode struct {
}

type SubTranCodeFuncs

type SubTranCodeFuncs struct {
	TranFlowstr TranFlow
}

func NewSubTran

func NewSubTran(tci TranFlow) *SubTranCodeFuncs

NewSubTran creates a new instance of SubTranCodeFuncs with the provided TranFlow. It returns a pointer to the newly created SubTranCodeFuncs.

func (*SubTranCodeFuncs) Execute

func (cf *SubTranCodeFuncs) Execute(f *Funcs)

Execute executes the subtran function. It sets the inputs, retrieves the transaction code, and calls the callback function to execute the transaction code. The outputs are then converted and set as the function outputs. If there is an error during execution, it logs the error and sets the error message. It also logs the performance of the function.

func (*SubTranCodeFuncs) Validate

func (cf *SubTranCodeFuncs) Validate(f *Funcs) (bool, error)

Validate is a method of the SubTranCodeFuncs struct that validates the function. It measures the performance of the function and logs the duration. It returns a boolean value indicating the success of the validation and an error if any. It also logs the performance of the function.

type TableDeleteFuncs

type TableDeleteFuncs struct {
}

func (*TableDeleteFuncs) Execute

func (cf *TableDeleteFuncs) Execute(f *Funcs)

Execute executes the TableDeleteFuncs function. It retrieves the input values, constructs the WHERE clause based on the key columns, and performs a table delete operation using the provided table name and WHERE clause. The result is stored in the "RowCount" output. If any error occurs during the execution, it is logged and returned.

func (*TableDeleteFuncs) Testfunction

func (cf *TableDeleteFuncs) Testfunction(f *Funcs) (bool, error)

func (*TableDeleteFuncs) Validate

func (cf *TableDeleteFuncs) Validate(f *Funcs) (bool, error)

type TableInsertFuncs

type TableInsertFuncs struct {
}

func (*TableInsertFuncs) Execute

func (cf *TableInsertFuncs) Execute(f *Funcs)

func (*TableInsertFuncs) Testfunction

func (cf *TableInsertFuncs) Testfunction(f *Funcs) (bool, error)

func (*TableInsertFuncs) Validate

func (cf *TableInsertFuncs) Validate(f *Funcs) (bool, error)

Validate validates the TableInsertFuncs. It measures the performance of the function and logs the duration. It returns true if the validation is successful, otherwise it returns an error. It also logs the performance of the function.

type TableUpdateFuncs

type TableUpdateFuncs struct {
}

func (*TableUpdateFuncs) Execute

func (cf *TableUpdateFuncs) Execute(f *Funcs)

func (*TableUpdateFuncs) Testfunction

func (cf *TableUpdateFuncs) Testfunction(f *Funcs) (bool, error)

func (*TableUpdateFuncs) Validate

func (cf *TableUpdateFuncs) Validate(f *Funcs) (bool, error)

type ThrowErrorFuncs

type ThrowErrorFuncs struct {
}

func (*ThrowErrorFuncs) Execute

func (cf *ThrowErrorFuncs) Execute(f *Funcs)

Execute executes the ThrowErrorFuncs function. It measures the execution time and logs the performance. It recovers from any panics and logs the error. It rolls back the database transaction, cancels the execution context, and sets the error message.

type TranFlow

type TranFlow interface {
	Execute(string, map[string]interface{}, context.Context, context.CancelFunc, *sql.Tx) (map[string]interface{}, error)
}

type WebServiceCallFunc

type WebServiceCallFunc struct{}

func (*WebServiceCallFunc) Execute

func (w *WebServiceCallFunc) Execute(f *Funcs)

type WorkFlowFunc

type WorkFlowFunc struct{}

func (*WorkFlowFunc) Execute_CompleteTask

func (w *WorkFlowFunc) Execute_CompleteTask(f *Funcs)

func (*WorkFlowFunc) Execute_Explode

func (w *WorkFlowFunc) Execute_Explode(f *Funcs)

func (*WorkFlowFunc) Execute_StartTask

func (w *WorkFlowFunc) Execute_StartTask(f *Funcs)

Jump to

Keyboard shortcuts

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