riverui

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: MPL-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FrontendIndex embed.FS

Functions

func NormalizePathPrefix added in v0.4.0

func NormalizePathPrefix(prefix string) string

Types

type DBTXWithBegin added in v0.2.0

type DBTXWithBegin interface {
	Begin(ctx context.Context) (pgx.Tx, error)
	dbsqlc.DBTX
}

type HandlerOpts

type HandlerOpts struct {
	// Client is the River client to use for API requests.
	Client *river.Client[pgx.Tx]
	// DBPool is the database connection pool to use for API requests.
	DBPool DBTXWithBegin
	// DevMode is whether the server is running in development mode.
	DevMode bool
	// LiveFS is whether to use the live filesystem for the frontend.
	LiveFS bool
	// Logger is the logger to use logging errors within the handler.
	Logger *slog.Logger
	// Prefix is the path prefix to use for the API and UI HTTP requests.
	Prefix string
}

HandlerOpts are the options for creating a new Handler.

type RiverJob

type RiverJob struct {
	ID          int64                    `json:"id"`
	Args        json.RawMessage          `json:"args"`
	Attempt     int                      `json:"attempt"`
	AttemptedAt *time.Time               `json:"attempted_at"`
	AttemptedBy []string                 `json:"attempted_by"`
	CreatedAt   time.Time                `json:"created_at"`
	Errors      []rivertype.AttemptError `json:"errors"`
	FinalizedAt *time.Time               `json:"finalized_at"`
	Kind        string                   `json:"kind"`
	MaxAttempts int                      `json:"max_attempts"`
	Metadata    json.RawMessage          `json:"metadata"`
	Priority    int                      `json:"priority"`
	Queue       string                   `json:"queue"`
	ScheduledAt time.Time                `json:"scheduled_at"`
	State       string                   `json:"state"`
	Tags        []string                 `json:"tags"`
}

type RiverQueue

type RiverQueue struct {
	CountAvailable int             `json:"count_available"`
	CountRunning   int             `json:"count_running"`
	CreatedAt      time.Time       `json:"created_at"`
	Metadata       json.RawMessage `json:"metadata"`
	Name           string          `json:"name"`
	PausedAt       *time.Time      `json:"paused_at"`
	UpdatedAt      time.Time       `json:"updated_at"`
}

type Server added in v0.4.0

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

func NewServer added in v0.4.0

func NewServer(opts *HandlerOpts) (*Server, error)

NewServer creates a new http.Handler that serves the River UI and API.

func (*Server) Handler added in v0.4.0

func (s *Server) Handler() http.Handler

Handler returns an http.Handler that can be mounted to serve HTTP requests.

func (*Server) Start added in v0.4.0

func (s *Server) Start(ctx context.Context) error

Start starts the server's background services. Notably, this does _not_ cause the server to start listening for HTTP in any way. To do that, call Handler and mount or run it using Go's built in `net/http`.

Directories

Path Synopsis
cmd
riverui command
internal
apiendpoint
Package apiendpoint provides a lightweight API framework for use with River UI.
Package apiendpoint provides a lightweight API framework for use with River UI.
apierror
Package apierror contains a variety of marshalable API errors that adhere to a unified error response convention.
Package apierror contains a variety of marshalable API errors that adhere to a unified error response convention.
validate
Package validate internalizes Go Playground's Validator framework, setting some common options that we use everywhere, providing some useful helpers, and exporting a simplified API.
Package validate internalizes Go Playground's Validator framework, setting some common options that we use everywhere, providing some useful helpers, and exporting a simplified API.

Jump to

Keyboard shortcuts

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