sqlmodel

package
v0.0.0-...-bf83fb3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProcessTable
	ProcessTable = "process"

	ECode030201                     = e.Code0302 + "01"
	ECode030202                     = e.Code0302 + "02"
	ECode030203                     = e.Code0302 + "03"
	ECode030204                     = e.Code0302 + "04"
	ECode030205                     = e.Code0302 + "05"
	ECode030206_getByCode_notFound  = e.Code0302 + "06"
	ECode030207                     = e.Code0302 + "07"
	ECode030208                     = e.Code0302 + "08"
	ECode030209                     = e.Code0302 + "09"
	ECode03020A                     = e.Code0302 + "0A"
	ECode03020B                     = e.Code0302 + "0B"
	ECode03020C                     = e.Code0302 + "0C"
	ECode03020D                     = e.Code0302 + "0D"
	ECode03020E                     = e.Code0302 + "0E"
	ECode03020F_lock_alreadyRunning = e.Code0302 + "0F"
	ECode03020G_lock_statusInactive = e.Code0302 + "0G"
	ECode03020H_lock_notReady       = e.Code0302 + "0H"
)
View Source
const (
	// ProcessRunTable
	ProcessRunTable = "process_run"

	ECode030301 = e.Code0303 + "01"
	ECode030302 = e.Code0303 + "02"
	ECode030303 = e.Code0303 + "03"
	ECode030304 = e.Code0303 + "04"
	ECode030305 = e.Code0303 + "05"
	ECode030306 = e.Code0303 + "06"
	ECode030307 = e.Code0303 + "07"
)

Variables

This section is empty.

Functions

func ProcessDelete

func ProcessDelete(db *sql.Connection, code string) (err error)

ProcessDelete permanently removes the specified record from the process table

func ProcessGet

func ProcessGet(db *sql.Connection, p *ProcessGetParam) (pList []*model.Process, count int, err error)

ProcessGet fetches records from db

func ProcessGetByCode

func ProcessGetByCode(db *sql.Connection, code string) (p *model.Process, err error)

ProcessGetByCode returns the process record with the specified code

func ProcessGetByID

func ProcessGetByID(db *sql.Connection, id int) (p *model.Process, err error)

ProcessGetByID returns the process record with the specified id

func ProcessLock

func ProcessLock(db *sql.Connection, id int) (p *model.Process, err error)

ProcessLock attempts to establish a lock on the specified process. The process will be skipped in the following scenarios: 1. The process is already running (the row is already locked) 2. The process is no longer active 3. The process has an interval and it is not currently past the process's next run time

func ProcessRunComplete

func ProcessRunComplete(db *sql.Connection, id int, msg string, runTime time.Duration) (err error)

ProcessRunComplete marks record as completed

func ProcessRunCreate

func ProcessRunCreate(db *sql.Connection, processID int) (pr *model.ProcessRun, err error)

ProcessRunCreate inserts a new record

func ProcessRunDelete

func ProcessRunDelete(db *sql.Connection, id int, msg string) (err error)

ProcessRunDelete deletes record

func ProcessRunFail

func ProcessRunFail(db *sql.Connection, id int, msg string, runTime time.Duration) (err error)

ProcessRunFail marks record as failed

func ProcessRunGet

func ProcessRunGet(db *sql.Connection, p *ProcessRunGetParam) (dList []*model.ProcessRun, count int, err error)

ProcessRunGet performs the DB query to return the list of docks

func ProcessSetInterval

func ProcessSetInterval(db *sql.Connection, id int, interval time.Duration) (err error)

ProcessSetInterval update the interval for the process. Will also set the next run time based on the last run time (or now if it does not have a last run time) and the new interval

func ProcessSetLastSuccess

func ProcessSetLastSuccess(db *sql.Connection, id int, runTime time.Duration) (err error)

ProcessSetLastSuccess sets the process's last successful run time as now and updates the process success statistics, which include:

  1. The total number of successful runs
  2. The average run time

func ProcessSetRunTime

func ProcessSetRunTime(db *sql.Connection, id int) (err error)

ProcessSetRunTime sets the process's last run time as now and the next run time based on the interval

func ProcessSetStatusByCode

func ProcessSetStatusByCode(db *sql.Connection, code, status string) (err error)

ProcessUpdate updates the specified dock record

func ProcessUpsert

func ProcessUpsert(db *sql.Connection, p *model.Process) (id int, err error)

ProcessUpsert upsert a record into the process table

Types

type ProcessGetParam

type ProcessGetParam struct {
	Limit                int
	Offset               int
	ID                   *int
	Code                 *string
	FlagCount            bool
	OrderByID            string
	ForNoKeyUpdateNoWait bool
	Status               string
	IsNextRunTime        bool
}

ProcessGetParam get params

type ProcessRunGetParam

type ProcessRunGetParam struct {
	Limit     int
	Offset    int
	ID        *int
	ProcessID *int
	FlagCount bool
	OrderByID string
}

ProcessRunGetParam get params

Jump to

Keyboard shortcuts

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