fixture

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package fixture declares types used to test the TypeScript generator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel added in v0.1.17

type Channel struct {
	Name string `json:"name"`
}

Channel groups tasks, and shares its name with the runtime's stream type.

type Page

type Page[T any] struct {
	Items []T    `json:"items"`
	Next  string `json:"next,omitempty"`
}

Page is a page of results.

type Priority

type Priority int

Priority orders tasks.

const (
	Low Priority = iota
	Medium
	High
)

Priorities.

type Promise added in v0.1.17

type Promise struct {
	Done bool `json:"done"`
}

Promise shares its name with the return type of generated methods.

type Record added in v0.1.17

type Record struct {
	Values map[string]string `json:"values"`
}

Record has a map that uses TypeScript's Record utility type.

type Status

type Status string

Status is the state of a task.

const (
	StatusTodo Status = "todo"
	StatusDone Status = "done"
)

Task states.

type Task

type Task struct {
	ID int64 `json:"id"`
	// Title of the task.
	Title    string           `json:"title"`
	Status   Status           `json:"status"`
	Priority Priority         `json:"priority"`
	Tags     []string         `json:"tags"`
	Due      *time.Time       `json:"due"`
	Meta     map[string]any   `json:"meta,omitempty"`
	Parent   *Task            `json:"parent,omitzero"`
	Channel  *Channel         `json:"channel,omitzero"`
	Record   *Record          `json:"record,omitzero"`
	Promise  *Promise         `json:"promise,omitzero"`
	Secret   string           `json:"-"`
	Count    int64            `json:"count,string"`
	CountPtr *int64           `json:"countPtr,string"`
	Raw      json.RawMessage  `json:"raw"`
	Data     []byte           `json:"data"`
	Scores   map[int]float64  `json:"scores"`
	Matrix   [][]int          `json:"matrix"`
	Children []*Task          `json:"children"`
	Extra    struct{ A bool } `json:"extra"`
	NoTag    string

	Timestamps
	// contains filtered or unexported fields
}

Task is a unit of work.

type Tasks

type Tasks struct{}

Tasks manages tasks.

func (*Tasks) Add

func (*Tasks) Add(tasks ...Task) error

Add adds tasks.

It fails when a task has no title.

func (Tasks) Count

func (Tasks) Count() int

Count counts tasks.

func (Tasks) Delete

func (Tasks) Delete(int64)

Delete removes a task; the parameter is unnamed on purpose.

func (Tasks) Dispatch added in v0.1.17

func (Tasks) Dispatch(call, call_ string)

Dispatch deliberately names parameters after the runtime's call function.

func (Tasks) DispatchMany added in v0.1.17

func (Tasks) DispatchMany(call ...string)

DispatchMany uses the runtime's call name for a variadic parameter.

func (Tasks) List

func (Tasks) List(ctx context.Context, status Status, limit int) (Page[Task], error)

List returns tasks with the given status.

func (Tasks) Watch

func (Tasks) Watch(status Status, updates Task)

Watch sends the tasks with the given status as they change. The test declares updates a channel of tasks.

type Timestamps

type Timestamps struct {
	CreatedAt time.Time `json:"createdAt"`
}

Timestamps is embedded in records.

Jump to

Keyboard shortcuts

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