fixture

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 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 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 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"`
	Secret   string           `json:"-"`
	Count    int64            `json:"count,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) 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