Documentation ¶
Index ¶
- Variables
- func AutoMigrate(db *gorm.DB) error
- func ConnectDb(dsnConfig DsnConfig, maxRetries int, retryDelay time.Duration) (*gorm.DB, error)
- type AuditLog
- type BpmnResource
- type DsnConfig
- type Fetcher
- func (f *Fetcher) GetAuditLogsForInstance(ctx context.Context, pagination *Pagination, instanceKey int64) (Paginated[AuditLog], error)
- func (f *Fetcher) GetBpmnResource(ctx context.Context, processDefKey int64) (BpmnResource, error)
- func (f *Fetcher) GetIncidents(ctx context.Context, pagination *Pagination) (Paginated[Incident], error)
- func (f *Fetcher) GetIncidentsForInstance(ctx context.Context, pagination *Pagination, instanceKey int64) (Paginated[Incident], error)
- func (f *Fetcher) GetInstance(ctx context.Context, instanceKey int64) (Instance, error)
- func (f *Fetcher) GetInstances(ctx context.Context, pagination *Pagination) (Paginated[Instance], error)
- func (f *Fetcher) GetInstancesForProcess(ctx context.Context, pagination *Pagination, processDefKey int64) (Paginated[Instance], error)
- func (f *Fetcher) GetJobs(ctx context.Context, pagination *Pagination) (Paginated[Job], error)
- func (f *Fetcher) GetJobsForInstance(ctx context.Context, pagination *Pagination, instanceKey int64) (Paginated[Job], error)
- func (f *Fetcher) GetProcess(ctx context.Context, processDefKey int64) (Process, error)
- func (f *Fetcher) GetProcesses(ctx context.Context, pagination *Pagination) (Paginated[Process], error)
- func (f *Fetcher) GetVariablesForInstance(ctx context.Context, pagination *Pagination, filter *Filter, instanceKey int64) (Paginated[Variable], error)
- type Filter
- type FilterType
- type Incident
- type Instance
- type Job
- type Paginated
- type Pagination
- type Process
- type Storer
- type Tabler
- type Variable
Constants ¶
This section is empty.
Variables ¶
var TableMigrations = []any{ &Instance{}, &Process{}, &AuditLog{}, &Incident{}, &Job{}, &Variable{}, &BpmnResource{}, }
List of migrations to be run on database during initialization.
Functions ¶
func AutoMigrate ¶
Migrate all tables in database automatically.
Types ¶
type AuditLog ¶
type BpmnResource ¶
type BpmnResource struct { ProcessDefinitionKey int64 `gorm:"primarykey;autoIncrement:false"` // A base64 encoded string of the BPMN XML file. BpmnFile string `gorm:"not null"` }
BpmnResource model struct for the 'bpmn_resources' database table.
This table is used to store the BPMN XML files which are relatively large in size. The XML files are stored in the database as a base64 encoded string.
func (BpmnResource) TableName ¶
func (BpmnResource) TableName() string
type DsnConfig ¶
type DsnConfig struct { // Username used to log in to the database. User string // Password of the logging in user. Password string // Database name to be accessed. DatabaseName string // The host used to host the database. Host string // The port used to connect to the database. Port uint16 }
Configuration to connect to database.
type Fetcher ¶
type Fetcher struct {
// contains filtered or unexported fields
}
Fetcher is used by the API to fetch data from the database.
func (*Fetcher) GetAuditLogsForInstance ¶
func (f *Fetcher) GetAuditLogsForInstance(ctx context.Context, pagination *Pagination, instanceKey int64) (Paginated[AuditLog], error)
Gets all audit logs for an instance.
func (*Fetcher) GetBpmnResource ¶
Gets a BPMN resource by its process ID.
func (*Fetcher) GetIncidents ¶
func (f *Fetcher) GetIncidents(ctx context.Context, pagination *Pagination) (Paginated[Incident], error)
Gets all incidents.
func (*Fetcher) GetIncidentsForInstance ¶
func (f *Fetcher) GetIncidentsForInstance(ctx context.Context, pagination *Pagination, instanceKey int64) (Paginated[Incident], error)
Gets all incidents for an instance.
func (*Fetcher) GetInstance ¶
Gets an instance by its key.
func (*Fetcher) GetInstances ¶
func (f *Fetcher) GetInstances(ctx context.Context, pagination *Pagination) (Paginated[Instance], error)
Gets all instances for all processes.
func (*Fetcher) GetInstancesForProcess ¶
func (f *Fetcher) GetInstancesForProcess(ctx context.Context, pagination *Pagination, processDefKey int64) (Paginated[Instance], error)
Gets all instances for a process based on its definition key.
func (*Fetcher) GetJobsForInstance ¶
func (f *Fetcher) GetJobsForInstance(ctx context.Context, pagination *Pagination, instanceKey int64) (Paginated[Job], error)
Gets all jobs for an instance.
func (*Fetcher) GetProcess ¶
Gets a process by its key.
func (*Fetcher) GetProcesses ¶
func (f *Fetcher) GetProcesses(ctx context.Context, pagination *Pagination) (Paginated[Process], error)
Gets all processes.
type Filter ¶
type Filter struct { Input string Type FilterType }
Filter is used to filter results with given input on a given field.
type FilterType ¶
type FilterType string
const ( FilterTypeIs FilterType = "IS" FilterTypeIsNot FilterType = "IS_NOT" FilterTypeContains FilterType = "CONTAINS" )
type Incident ¶
type Instance ¶
type Instance struct { ProcessInstanceKey int64 `gorm:"primarykey"` ProcessDefinitionKey int64 `gorm:"not null"` Version int64 `gorm:"not null"` Status string `gorm:"not null"` StartTime time.Time `gorm:"not null"` EndTime sql.NullTime AuditLogs []AuditLog `gorm:"foreignKey:ProcessInstanceKey;references:ProcessInstanceKey"` Incidents []Incident `gorm:"foreignKey:ProcessInstanceKey;references:ProcessInstanceKey"` Jobs []Job `gorm:"foreignKey:ProcessInstanceKey;references:ProcessInstanceKey"` Variables []Variable `gorm:"foreignKey:ProcessInstanceKey;references:ProcessInstanceKey"` }
Instance model struct for the 'instances' database table.
type Job ¶
type Job struct { Key int64 `gorm:"primarykey"` ElementID string `gorm:"not null"` ProcessInstanceKey int64 `gorm:"not null"` Type string `gorm:"not null"` Retries int64 `gorm:"not null"` Worker string `gorm:"not null"` State string `gorm:"not null"` Time time.Time `gorm:"not null"` }
Job model struct for the 'jobs' database table.
type Pagination ¶
Pagination is used to limit the number of results returned by a query for performance reasons in tabular views.
type Process ¶
type Process struct { ProcessDefinitionKey int64 `gorm:"primarykey"` BpmnProcessID string `gorm:"not null"` Version int64 `gorm:"not null"` DeploymentTime time.Time `gorm:"not null"` BpmnResource BpmnResource `gorm:"foreignKey:ProcessDefinitionKey;references:ProcessDefinitionKey"` Instances []Instance `gorm:"foreignKey:ProcessDefinitionKey;references:ProcessDefinitionKey"` }
Process model struct for the 'processes' database table.
type Storer ¶
type Storer interface { ProcessDeployed( processDefinitionKey int64, bpmnProcessID string, version int64, deploymentTime time.Time, bpmnResourceRaw []byte, ) error ProcessInstanceActivated( processInstanceKey int64, processDefinitionKey int64, version int64, startTime time.Time, ) error ProcessInstanceCompleted( processInstanceKey int64, endTime time.Time, ) error ProcessInstanceTerminated( processInstanceKey int64, endTime time.Time, ) error VariableCreated( processInstanceKey int64, name string, value string, time time.Time, ) error VariableUpdated( processInstanceKey int64, name string, value string, time time.Time, ) error IncidentCreated( key int64, processInstanceKey int64, elementID string, errorType string, errorMessage string, time time.Time, ) error IncidentResolved( key int64, time time.Time, ) error AuditLogEventOccurred( position int64, processInstanceKey int64, elementID string, elementType string, intent string, time time.Time, ) error JobCreated( key int64, elementID string, processInstanceKey int64, jobType string, retries int64, worker string, time time.Time, ) error JobUpdated( key int64, retries int64, worker string, state string, time time.Time, ) error }
type Tabler ¶
type Tabler interface {
TableName() string
}
Interface for models that have a table name. Implementing this interface changes the table's name in GORM and allows it to be queried by generic functions.