present

package
v0.0.0-...-c14c6da Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package present loads state from the database and turns it into properties to expose to the frontend.

It leverages SQLite's speed to keep loading simple and return rich data by loading it from the database whenever it's needed, even if it's already been loaded previously.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration

func Duration(dt time.Duration) string

func RenderJSON

func RenderJSON(payload []byte) (string, error)

func ThunkAvatar

func ThunkAvatar(thunkDigest string) (string, error)

Types

type Line

type Line struct {
	Content string `json:"content"`
}

type Run

type Run struct {
	ID string `json:"id"`

	StartedAt   string `json:"started_at"`
	CompletedAt string `json:"completed_at,omitempty"`
	Duration    string `json:"duration"`
	Succeeded   bool   `json:"succeeded"`

	User  *User  `json:"user"`
	Thunk *Thunk `json:"thunk"`

	Meta models.Meta `json:"meta,omitempty"`
}

func NewRun

func NewRun(ctx context.Context, db models.DB, model *models.Run) (*Run, error)

type Thunk

type Thunk struct {
	Digest string `json:"digest"`
	Avatar string `json:"avatar"`
}

func NewThunk

func NewThunk(ctx context.Context, db models.DB, model *models.Thunk) (*Thunk, error)

type User

type User struct {
	Login string `json:"login"`
	URL   string `json:"url"`
}

func NewUser

func NewUser(user *models.User) *User

type Vertex

type Vertex struct {
	Num      int     `json:"num"`
	Name     string  `json:"name"`
	Duration string  `json:"duration"`
	Lines    []*Line `json:"lines"`
	Cached   bool    `json:"cached"`
	Error    string  `json:"error,omitempty"`
}

func Vertexes

func Vertexes(ctx context.Context, conn models.DB, bucket *blobs.Bucket, vertexModels []*models.Vertex) ([]*Vertex, error)

type Workaround

type Workaround struct{}

Jump to

Keyboard shortcuts

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