trancode

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: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bytetoobj

func Bytetoobj(config []byte) (types.TranCode, error)

func Configtoobj

func Configtoobj(config string) (types.TranCode, error)

func Execute

func Execute(trancode string, data map[string]interface{}, systemsessions map[string]interface{}) (map[string]interface{}, error)

func ExecuteUnitTest

func ExecuteUnitTest(trancode string, systemsessions map[string]interface{}) (map[string]interface{}, error)

func ExecuteUnitTestWithTestData

func ExecuteUnitTestWithTestData(trancode string, testcase map[string]interface{}, systemsessions map[string]interface{}) (map[string]interface{}, error)

func ExecutebyExternal

func ExecutebyExternal(trancode string, data map[string]interface{}, DBTx *sql.Tx, DBCon *documents.DocDB, sc signalr.Client) (map[string]interface{}, error)

func GetTranCodeDatabyCode

func GetTranCodeDatabyCode(Code string) (types.TranCode, error)

func GetTransCode

func GetTransCode(name string) (types.TranCode, error)

GetTransCode retrieves the transaction code for the given name. It reads the transaction code configuration file and returns the corresponding TranCode object. If an error occurs during the process, it returns an empty TranCode object and an error.

Types

type TranCodeData

type TranCodeData struct {
	TranCode string `json:"code"`
	// contains filtered or unexported fields
}

type TranFlow

type TranFlow struct {
	Tcode          types.TranCode
	DBTx           *sql.Tx
	Ctx            context.Context
	CtxCancel      context.CancelFunc
	Externalinputs map[string]interface{} // {sessionanme: value}

	SystemSession map[string]interface{}

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

func NewTranFlow

func NewTranFlow(tcode types.TranCode, externalinputs, systemSession map[string]interface{}, ctx context.Context, ctxcancel context.CancelFunc, dbTx ...*sql.Tx) *TranFlow

func (*TranFlow) Execute

func (t *TranFlow) Execute() (map[string]interface{}, error)

Execute executes the transaction flow. It starts the timer to measure the execution time and logs the performance duration. It recovers from any panics and logs the error message. It retrieves the system session, external inputs, and external outputs from the transaction flow. It starts a new database transaction if one doesn't exist. It starts a new context with a timeout if one doesn't exist. It executes the first function group of the transaction code and iterates through subsequent function groups until the code is no longer 1. It commits the database transaction if it was started in this function. It returns the external outputs and nil error if successful.

func (*TranFlow) UnitTest

func (t *TranFlow) UnitTest() (map[string]interface{}, error)

func (*TranFlow) UnitTestbyTestData

func (t *TranFlow) UnitTestbyTestData(testdata types.TestData) (map[string]interface{}, error)

type TranFlowstr

type TranFlowstr struct {
	TestwithSc bool `json:"TestwithSc,omitempty"`
}

func (*TranFlowstr) Execute

func (t *TranFlowstr) Execute(tcode string, inputs map[string]interface{}, sc signalr.Client, docdbconn *documents.DocDB, ctx context.Context, ctxcancel context.CancelFunc, dbTx ...*sql.Tx) (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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