db

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: Apache-2.0 Imports: 17 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 Analytics added in v0.5.2

type Analytics interface {
	QueryTopResultsByKey(ctx context.Context, arg QueryTopResultsByKeyParams) ([]QueryTopResultsByKeyRow, error)
	CreateResultMetadata(ctx context.Context, arg CreateResultMetadataParams) error
}

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 CreateResultMetadataParams added in v0.5.2

type CreateResultMetadataParams struct {
	QueueItemID uuid.UUID
	Type        string
	Value       string
}

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 {
	Reverse    bool
	Sort       string
	PageNumber int32
	PageSize   int32
}

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
	Analytics
}

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) CountQueueItems added in v0.5.0

func (q *Queries) CountQueueItems(ctx context.Context) (int64, error)

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) CreateResultMetadata added in v0.5.2

func (q *Queries) CreateResultMetadata(ctx context.Context, arg CreateResultMetadataParams) 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) QueryTopResultsByKey added in v0.5.2

func (q *Queries) QueryTopResultsByKey(ctx context.Context, arg QueryTopResultsByKeyParams) ([]QueryTopResultsByKeyRow, error)

func (*Queries) WithTx

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

type QueryTopResultsByKeyParams added in v0.5.2

type QueryTopResultsByKeyParams struct {
	Key      string
	PageSize int32
}

type QueryTopResultsByKeyRow added in v0.5.2

type QueryTopResultsByKeyRow struct {
	Value string
	Count int64
}

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)
	CountQueueItems(ctx context.Context) (int64, error)
	GetNodesByQueueItemID(ctx context.Context, queueItemID uuid.UUID) ([]Node, error)
	CreateResultMetadata(ctx context.Context, arg CreateResultMetadataParams) 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 ResultMeta added in v0.5.2

type ResultMeta struct {
	Type  string
	Value string
}

type ResultMetadataType added in v0.5.2

type ResultMetadataType struct {
	ID    int32
	Value string
}

type ResultMetadatum added in v0.5.2

type ResultMetadatum struct {
	ID          int32
	QueueItemID uuid.UUID
	TypeID      int32
	Value       string
}

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