models

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CurrentVersion = "v2021.06.15_a"

Functions

func CreateWrapper

func CreateWrapper(tx *gorm.DB, v interface{}) rc.ReturnCode

CreateWrapper - wrapper for database create function (gets returncode and write database error to log)

func CreatingDefaultModels

func CreatingDefaultModels(isUpdateAnyWhere bool)

func UpdateDB

func UpdateDB(currentVersion string) rc.ReturnCode

Types

type Event

type Event struct {
	gorm.Model
	InstanceID      uint
	Instance        Instance
	StatusID        uint
	Status          Status
	EventCreationDt *time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}

func (*Event) Create

func (event *Event) Create(tx *gorm.DB) rc.ReturnCode

func (*Event) Print

func (event *Event) Print()

func (*Event) TableName

func (event *Event) TableName() string

func (*Event) ToString

func (event *Event) ToString() string

type EventExtended

type EventExtended struct {
	Status          Status
	EventCreationDt *time.Time `gorm:"default:CURRENT_TIMESTAMP"`
}

type Instance

type Instance struct {
	gorm.Model
	InstanceToken                 string
	InstanceTimeout               int
	ObjectID                      uint
	Object                        Object
	InstanceIsFinished            bool
	InstanceIsFinishedDescription string
}

func (*Instance) BeforeCreate

func (instance *Instance) BeforeCreate(tx *gorm.DB) (err error)

func (*Instance) FinishInstance

func (instance *Instance) FinishInstance(db *gorm.DB, instanceIsFinishedDescription string) rc.ReturnCode

func (*Instance) GetInstance

func (instance *Instance) GetInstance(db *gorm.DB, instanceToken string, isForUpdate bool) rc.ReturnCode

func (*Instance) TableName

func (instance *Instance) TableName() string

type InstanceInfo

type InstanceInfo struct {
	Instance Instance
	Events   []Event
	Statuses []Status
}

func (*InstanceInfo) GetInstanceInfo

func (instanceInfo *InstanceInfo) GetInstanceInfo(db *gorm.DB, instanceToken string, isForUpdate bool) rc.ReturnCode

func (*InstanceInfo) Print

func (instanceInfo *InstanceInfo) Print()

func (*InstanceInfo) RefreshEvents

func (instanceInfo *InstanceInfo) RefreshEvents(db *gorm.DB) rc.ReturnCode

func (*InstanceInfo) RefreshStatuses

func (instanceInfo *InstanceInfo) RefreshStatuses(db *gorm.DB) rc.ReturnCode

func (*InstanceInfo) ToString

func (instanceInfo *InstanceInfo) ToString() string

type Object

type Object struct {
	gorm.Model
	ObjectName string
}

func (*Object) GetObject

func (object *Object) GetObject(db *gorm.DB, objectName string) rc.ReturnCode

func (*Object) TableName

func (object *Object) TableName() string

type Status

type Status struct {
	gorm.Model
	ObjectID   uint
	Object     Object `json:"-"`
	StatusName string
	StatusDesc string
	StatusType string `gorm:"not null"`
}

func (*Status) GetStatus

func (status *Status) GetStatus(tx *gorm.DB, statusName string, objectID uint) rc.ReturnCode

func (*Status) GetStatusById

func (status *Status) GetStatusById(tx *gorm.DB, statusId uint) rc.ReturnCode

func (*Status) TableName

func (status *Status) TableName() string

type StatusInfo

type StatusInfo struct {
	Status       Status
	PrevStatuses []Status
	NextStatuses []Status
}

func (*StatusInfo) GetStatusInfo

func (statusInfo *StatusInfo) GetStatusInfo(tx *gorm.DB, statusName string, objectID uint) rc.ReturnCode

GetStatusInfo - get status info by statusName & objectID

func (*StatusInfo) Print

func (statusInfo *StatusInfo) Print()

func (*StatusInfo) ToString

func (statusInfo *StatusInfo) ToString() string

type Version

type Version struct {
	gorm.Model
	VersionNumber string
}

Version -

func (Version) TableName

func (Version) TableName() string

type Workflow

type Workflow struct {
	gorm.Model
	StatusPrevID uint
	StatusPrev   Status
	StatusNextID uint
	StatusNext   Status
}

Workflow -

func (*Workflow) TableName

func (workflow *Workflow) TableName() string

TableName -

Jump to

Keyboard shortcuts

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