database

package
v0.0.0-...-fe8ab6f Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PostgresDB = "psql"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBCredentials

type DBCredentials struct {
	Host         string `json:"db_host"`
	User         string `json:"db_username"`
	Password     string `json:"db_password"`
	DatabaseName string `json:"db_database"`
}

type Dao

type Dao interface {
	GetAllUsers() ([]User, error)
	CreateUser(name string, email string) (int64, error)
	UpdateUser(user *User) error
	DeleteUser(id int64) error
	GetUserById(id int64) (*User, error)

	GetAllWorkflows() ([]Workflow, error)
	CreateWorkflow(userId int64, lastTaskCompleted int64, definition string, hash string, stats string, inputs JsonBytesMap, output string, status string, metadata JsonBytesMap) (int64, error)
	UpdateWorkflow(workflow *Workflow) error
	DeleteWorkflow(id int64) error
	GetWorkflowById(id int64) (*Workflow, error)

	GetAllTasks() ([]Task, error)
	CreateTask(wf_id int64, name string, hash string, stats string, input JsonBytesMap, output string, status string, taskError string, wf_status string) (int64, error)
	UpdateTask(task *Task) error
	DeleteTask(id int64) error
	GetTaskById(id int64) (*Task, error)

	KillDao()
}

func DaoFactory

func DaoFactory(daoType string) Dao

type JsonBytesMap

type JsonBytesMap map[string]interface{}

func (*JsonBytesMap) Scan

func (p *JsonBytesMap) Scan(src interface{}) error

func (JsonBytesMap) Value

func (p JsonBytesMap) Value() (driver.Value, error)

type PSQLDao

type PSQLDao struct {
	Host         string
	User         string
	Password     string
	DBName       string
	DBConnection *sqlx.DB
}

func NewPSQLDao

func NewPSQLDao() *PSQLDao

func (*PSQLDao) CreateTask

func (psqlDao *PSQLDao) CreateTask(wf_id int64, name string, hash string, stats string, input JsonBytesMap, output string, status string, taskError string, wf_status string) (int64, error)

func (*PSQLDao) CreateUser

func (psqlDao *PSQLDao) CreateUser(name string, email string) (int64, error)

func (*PSQLDao) CreateWorkflow

func (psqlDao *PSQLDao) CreateWorkflow(userId int64, lastTaskCompleted int64, definition string, hash string, stats string, inputs JsonBytesMap, outputs string, status string, metadata JsonBytesMap) (int64, error)

func (*PSQLDao) DeleteTask

func (psqlDao *PSQLDao) DeleteTask(id int64) error

func (*PSQLDao) DeleteUser

func (psqlDao *PSQLDao) DeleteUser(id int64) error

func (*PSQLDao) DeleteWorkflow

func (psqlDao *PSQLDao) DeleteWorkflow(id int64) error

func (*PSQLDao) GetAllTasks

func (psqlDao *PSQLDao) GetAllTasks() ([]Task, error)

func (*PSQLDao) GetAllUsers

func (psqlDao *PSQLDao) GetAllUsers() ([]User, error)

func (*PSQLDao) GetAllWorkflows

func (psqlDao *PSQLDao) GetAllWorkflows() ([]Workflow, error)

func (*PSQLDao) GetTaskById

func (psqlDao *PSQLDao) GetTaskById(id int64) (*Task, error)

func (*PSQLDao) GetUserById

func (psqlDao *PSQLDao) GetUserById(id int64) (*User, error)

func (*PSQLDao) GetWorkflowById

func (psqlDao *PSQLDao) GetWorkflowById(id int64) (*Workflow, error)

func (*PSQLDao) KillDao

func (psqlDao *PSQLDao) KillDao()

func (*PSQLDao) UpdateTask

func (psqlDao *PSQLDao) UpdateTask(task *Task) error

func (*PSQLDao) UpdateUser

func (psqlDao *PSQLDao) UpdateUser(user *User) error

func (*PSQLDao) UpdateWorkflow

func (psqlDao *PSQLDao) UpdateWorkflow(workflow *Workflow) error

type Task

type Task struct {
	TaskId         int64        `db:"task_id"`
	WorkFlowID     int64        `db:"wf_id"`
	Name           string       `db:"name"`
	Hash           string       `db:"hash"`
	Stats          string       `db:"stats"`
	Input          JsonBytesMap `db:"input"`
	Output         string       `db:"output"`
	Attempt        int64        `db:"attempt"`
	Status         string       `db:"status"`
	ReturnCode     int64        `db:"return_code"`
	Error          string       `db:"error"`
	WorkFlowStatus string       `db:"wf_status"`
	CreatedAt      time.Time    `db:"created_at"`
	UpdatedAt      time.Time    `db:"updated_at"`
}

type User

type User struct {
	ID        int64     `db:"id"`
	Name      string    `db:"name"`
	Email     string    `db:"email"`
	CreatedAt time.Time `db:"created_at"`
}

type Workflow

type Workflow struct {
	WorkFlowID        int64        `db:"wf_id"`
	UserId            int64        `db:"usr_id"`
	LastTaskCompleted int64        `db:"last_task_completed"`
	Definition        string       `db:"definition"`
	Hash              string       `db:"hash"`
	Stats             string       `db:"stats"`
	Inputs            JsonBytesMap `db:"inputs"`
	Outputs           string       `db:"outputs"`
	Status            string       `db:"status"`
	StartedAt         time.Time    `db:"started_at"`
	EndedAt           time.Time    `db:"ended_at"`
	CreatedAt         time.Time    `db:"created_at"`
	UpdatedAt         time.Time    `db:"updated_at"`
	Metadata          JsonBytesMap `db:"metadata"`
}

Jump to

Keyboard shortcuts

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