db

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = fmt.Errorf("not found")
)

Functions

This section is empty.

Types

type CreateAndReturnNodeParams added in v0.3.2

type CreateAndReturnNodeParams struct {
	QueueItemID uuid.UUID
	Name        string
}

type CreateEdgeParams

type CreateEdgeParams struct {
	ParentID int32
	ChildID  int32
}

type CreateIOSpecParams

type CreateIOSpecParams struct {
	NodeID   int32
	Type     IoSpecType
	NodeName string
	InputID  string
	Root     bool
	Value    sql.NullString
	Path     sql.NullString
	Context  sql.NullString
}

type CreateQueueItemParams

type CreateQueueItemParams struct {
	ID        uuid.UUID
	Inputs    []string
	CreatedAt time.Time
}

type CreateResultParams

type CreateResultParams struct {
	NodeID      int32
	ExecutionID sql.NullString
	Stdout      sql.NullString
	Stderr      sql.NullString
	Skipped     sql.NullBool
}

type CreateStatusParams

type CreateStatusParams struct {
	NodeID    int32
	Submitted time.Time
	Started   sql.NullTime
	Ended     sql.NullTime
	Status    string
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Edge

type Edge struct {
	ID       int32
	ParentID int32
	ChildID  int32
}

type GetNodeByIDRow

type GetNodeByIDRow struct {
	ID          sql.NullInt32
	QueueItemID uuid.NullUUID
	Name        sql.NullString
	Submitted   time.Time
	Started     sql.NullTime
	Ended       sql.NullTime
	Status      string
	ExecutionID sql.NullString
	Stdout      sql.NullString
	Stderr      sql.NullString
	Skipped     sql.NullBool
	Inputs      []int32
	Outputs     []int32
	Parents     []int32
	Children    []int32
}

type IoSpec

type IoSpec struct {
	ID       int32
	NodeID   int32
	Type     IoSpecType
	NodeName string
	InputID  string
	Root     bool
	Value    sql.NullString
	Path     sql.NullString
	Context  sql.NullString
}

type IoSpecType

type IoSpecType string
const (
	IoSpecTypeInput  IoSpecType = "input"
	IoSpecTypeOutput IoSpecType = "output"
)

func (*IoSpecType) Scan

func (e *IoSpecType) Scan(src interface{}) error

type ListQueueItemsParams added in v0.3.6

type ListQueueItemsParams struct {
	Limit         int32
	Createdbefore time.Time
	Reverse       bool
}

type Node

type Node struct {
	ID          int32
	QueueItemID uuid.UUID
	Name        string
}

type NodePersistence

type NodePersistence interface {
	CreateAndReturnNode(ctx context.Context, arg CreateAndReturnNodeParams) (Node, error)
	GetNodeByID(ctx context.Context, id int32) (GetNodeByIDRow, error)
	CreateEdge(ctx context.Context, arg CreateEdgeParams) error
	CreateIOSpec(ctx context.Context, arg CreateIOSpecParams) error
	GetIOSpecByID(ctx context.Context, id int32) (IoSpec, error)
	CreateStatus(ctx context.Context, arg CreateStatusParams) error
	CreateResult(ctx context.Context, arg CreateResultParams) error
}

type NullIoSpecType

type NullIoSpecType struct {
	IoSpecType IoSpecType
	Valid      bool // Valid is true if IoSpecType is not NULL
}

func (*NullIoSpecType) Scan

func (ns *NullIoSpecType) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullIoSpecType) Value

func (ns NullIoSpecType) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Persistence

type Persistence interface {
	NodePersistence
	Queue
}

func NewInMemDB

func NewInMemDB() Persistence

func NewPostgresDB

func NewPostgresDB(connStr string) (Persistence, error)

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CreateAndReturnNode added in v0.3.2

func (q *Queries) CreateAndReturnNode(ctx context.Context, arg CreateAndReturnNodeParams) (Node, error)

func (*Queries) CreateEdge

func (q *Queries) CreateEdge(ctx context.Context, arg CreateEdgeParams) error

func (*Queries) CreateIOSpec

func (q *Queries) CreateIOSpec(ctx context.Context, arg CreateIOSpecParams) error

func (*Queries) CreateQueueItem

func (q *Queries) CreateQueueItem(ctx context.Context, arg CreateQueueItemParams) error

func (*Queries) CreateResult

func (q *Queries) CreateResult(ctx context.Context, arg CreateResultParams) error

func (*Queries) CreateStatus

func (q *Queries) CreateStatus(ctx context.Context, arg CreateStatusParams) error

func (*Queries) GetIOSpecByID

func (q *Queries) GetIOSpecByID(ctx context.Context, id int32) (IoSpec, error)

func (*Queries) GetNodeByID

func (q *Queries) GetNodeByID(ctx context.Context, nodeID int32) (GetNodeByIDRow, error)

func (*Queries) GetNodesByQueueItemID

func (q *Queries) GetNodesByQueueItemID(ctx context.Context, queueItemID uuid.UUID) ([]Node, error)

func (*Queries) GetQueueItemDetail

func (q *Queries) GetQueueItemDetail(ctx context.Context, id uuid.UUID) (QueueItem, error)

func (*Queries) ListQueueItems

func (q *Queries) ListQueueItems(ctx context.Context, arg ListQueueItemsParams) ([]QueueItem, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Queue

type Queue interface {
	CreateQueueItem(ctx context.Context, arg CreateQueueItemParams) error
	GetQueueItemDetail(ctx context.Context, id uuid.UUID) (QueueItem, error)
	ListQueueItems(ctx context.Context, arg ListQueueItemsParams) ([]QueueItem, error)
	GetNodesByQueueItemID(ctx context.Context, queueItemID uuid.UUID) ([]Node, error)
}

type QueueItem

type QueueItem struct {
	ID        uuid.UUID
	Inputs    []string
	CreatedAt time.Time
}

type Result

type Result struct {
	ID          int32
	Ts          sql.NullTime
	NodeID      int32
	ExecutionID sql.NullString
	Stdout      sql.NullString
	Stderr      sql.NullString
	Skipped     sql.NullBool
}

type Status

type Status struct {
	ID        int32
	Ts        sql.NullTime
	NodeID    int32
	Submitted time.Time
	Status    string
	Started   sql.NullTime
	Ended     sql.NullTime
}

Jump to

Keyboard shortcuts

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