libapplication

package
v0.0.0-...-ec57856 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const TimeType = "time.time"

Variables

View Source
var MappingAggregate map[*libdomain.AggregateDefinition]*Aggregate

Definition is used to declare the information of a model, so it can generate its code.

Functions

func ExecuteActivity

func ExecuteActivity(
	d OrchestratorClient, wk *Workflow,
	activity ActivityInterface, activityClient TransactionClient,

) (interface{}, error)

Types

type ActivityInterface

type ActivityInterface interface {
	// MarshalArgs() ([]byte, error)
	// UnmarshalArgs([]byte) error
	MarshalResult(interface{}) ([]byte, error)
	UnmarshalResult([]byte, interface{}) error
	Run(context.Context) (interface{}, error)
}

type ActivityRunInterface

type ActivityRunInterface interface {
	Get(*Workflow, TransactionClient) (interface{}, error)
}

type Aggregate

type Aggregate struct {
	// contains filtered or unexported fields
}

Definition is used to declare the information of a model, so it can generate its code.

func (*Aggregate) Definition

func (a *Aggregate) Definition() *Definition

func (*Aggregate) SetDefinition

func (a *Aggregate) SetDefinition(definition *Definition)

type AggregateInterface

type AggregateInterface interface {
	Definition() *Definition
}

Definition is used to declare the information of a model, so it can generate its code.

type Arg

type Arg struct {
	Name     string
	Type     libdata.FieldType
	Required bool
}

Arg represent the argument of a custom function.

type ArgData

type ArgData struct {
	Name     string
	Title    string
	Type     string
	Required bool
	Arg      *Arg
}

ArgData represent the argument of a custom function, in a format usable by templates.

type AuthAggregate

type AuthAggregate interface {
	GetUserFromToken(
		libdomain.WorkflowInterface, *userpb.UserGetUserFromTokenCommand,
	) (*userpb.UserGetUserFromTokenResults, error)
}

type CustomFunc

type CustomFunc struct {
	Name   string
	Args   []*Arg
	Result *Arg
}

CustomFunc represent a custom function.

func (*CustomFunc) GetCustomFuncData

func (c *CustomFunc) GetCustomFuncData() *CustomFuncData

GetCustomFuncData return the custom function information, in a format usable by templates.

type CustomFuncData

type CustomFuncData struct {
	Name   string
	Title  string
	Args   []*ArgData
	Result *ArgData
}

CustomFuncData represent a custom function, in a format usable by templates.

type Definition

type Definition struct {
	Aggregate   libdomain.AggregateInterface
	GenDomain   string
	Create      *RequestConfig
	Update      *RequestConfig
	Delete      *RequestConfig
	CustomFuncs []*libdomain.CustomCommand

	Event bool
	// contains filtered or unexported fields
}

Definition is used to declare the information of a model, so it can generate its code.

func (*Definition) GetCustomFuncByName

func (d *Definition) GetCustomFuncByName(name string) *libdomain.CustomCommand

GetCustomFuncByName return the custom function by it's name

type Definitions

type Definitions struct {
	Prefix     string
	Repository string
	Tenant     bool
	Auth       bool
	// contains filtered or unexported fields
}

Definitions contains all the grpc definitions in the service.

func (*Definitions) GetByID

func (ds *Definitions) GetByID(id string) *Definition

GetByID return the specified definition by its ID.

func (*Definitions) Register

func (ds *Definitions) Register(d *Definition)

Register is used to register a new definition into the service.

func (*Definitions) Slice

func (ds *Definitions) Slice() []*Definition

Slice return the definitions as a slice.

type OrchestratorClient

type OrchestratorClient interface {
	GetOrchestratorTransaction() interface{}
	RollbackOrchestratorTransaction(tx interface{})
	CommitOrchestratorTransaction(tx interface{})
	SearchWorkflow(string) (string, error)
	NewWorkflow(
		name string, idempotencyKey string, serializedArgs []byte,
	) (string, error)
	GetWorkflow(id string) (
		string, string, []byte, []byte, error)
	OnWorkflowError(name string) error
	OnWorkflowSuccess(name string, serializedResult []byte) error
	SearchActivity(
		workflowID string, step int,
	) ([]byte, error)
	// NewActivity(
	// 	workflowID string, step int, serializedArgs []byte,
	// ) (string, error)
	// GetActivity(id string) (		string, string, int, []byte, []byte, error)
	OnActivitySuccess(workflowID string, step int, serializedResult []byte) error
}

type RegisterEventsActivity

type RegisterEventsActivity struct {
	EventStoreClient libdomain.EventStoreClient
	Workflow         *Workflow
	Aggregate        libdomain.AggregateInterface
	Events           []*libdomain.Event
}

func (*RegisterEventsActivity) MarshalArgs

func (a *RegisterEventsActivity) MarshalArgs() ([]byte, error)

func (*RegisterEventsActivity) MarshalResult

func (a *RegisterEventsActivity) MarshalResult(result interface{}) ([]byte, error)

func (*RegisterEventsActivity) Run

func (a *RegisterEventsActivity) Run(
	ctx context.Context,
) (interface{}, error)

func (*RegisterEventsActivity) UnmarshalArgs

func (a *RegisterEventsActivity) UnmarshalArgs(data []byte) error

func (*RegisterEventsActivity) UnmarshalResult

func (a *RegisterEventsActivity) UnmarshalResult(data []byte, resultInterface interface{}) error

type RequestConfig

type RequestConfig struct {
	Groups        *[]string
	Authenticated bool
}

type StartWorkflowOptions

type StartWorkflowOptions struct {
	ID           string
	Model        string
	Function     string
	JWT          string
	JWTDecrypted *libdomain.JWTClaims
}

type TransactionClient

type TransactionClient interface {
	BeginTransaction(*Workflow, bool) error
	RollbackTransaction(*Workflow) error
	CommitTransaction(*Workflow) error
}

type WorkerInterface

type WorkerInterface interface {
	RegisterWorkflow(string, string, interface{}) error
	RegisterActivity(a interface{}) error
	Run(i <-chan interface{}) error
}

type Workflow

type Workflow struct {
	WorkflowID   string
	WorkflowStep int
	// TenantID   string
	Transaction             interface{}
	TransactionClient       TransactionClient
	TransactionAlwaysCommit bool
	UseTenants              bool
	TenantClient            libdomain.AggregateInterface
	OrchestratorClient      OrchestratorClient
	// contains filtered or unexported fields
}

func (*Workflow) SetWorkflow

func (w *Workflow) SetWorkflow(workflow *libdomain.Workflow)

func (*Workflow) Workflow

func (w *Workflow) Workflow() *libdomain.Workflow

type WorkflowInterface

type WorkflowInterface interface {
	GetName() string
	MarshalArgs() ([]byte, error)
	UnmarshalArgs([]byte) error
	MarshalResult(interface{}) ([]byte, error)
	UnmarshalResult([]byte, interface{}) error
	Run(*Workflow) (interface{}, error)
}

type WorkflowRun

type WorkflowRun struct {
	// contains filtered or unexported fields
}

func (*WorkflowRun) Get

func (r *WorkflowRun) Get(ctx context.Context) (interface{}, error)

type WorkflowRunInterface

type WorkflowRunInterface interface {
	Get(context.Context) (interface{}, error)
}

func ExecuteWorkflow

func ExecuteWorkflow(
	ctx context.Context, d OrchestratorClient, m *libdomain.AggregateDefinition, tenantID string, idempotencyKey string,
	workflow WorkflowInterface, options StartWorkflowOptions,
	transactionClient TransactionClient, tenantAggregate libdomain.AggregateInterface,
) (WorkflowRunInterface, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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