widgets

package
v1.41.2 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 2 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 widgets is the module of the spectest test app: its request types, the functions that answer them and the models they return.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminRequest

type AdminRequest struct {
	ID int64 `json:"id"`
}

func (*AdminRequest) Validate

func (r *AdminRequest) Validate() error

type AdminWidget

type AdminWidget struct {
	Widget
	Owner string `json:"owner"`
}

AdminWidget is a widget with the fields only an administrator sees.

func GetAdmin

func GetAdmin(ctx context.Context, request *AdminRequest) (*AdminWidget, error)

type CreateRequest

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

func (*CreateRequest) Validate

func (r *CreateRequest) Validate() error

type File

type File struct {
	Path string `json:"path"`
	Size int64  `json:"size"`
}

File is a stored file.

func GetFile

func GetFile(ctx context.Context, request *FileRequest) (*File, error)

type FileRequest

type FileRequest struct {
	Path string `json:"path"`
}

func (*FileRequest) Validate

func (r *FileRequest) Validate() error

type GetRequest

type GetRequest struct {
	ID int64 `json:"id"`
}

func (*GetRequest) Validate

func (r *GetRequest) Validate() error

type ListRequest

type ListRequest struct {
	Search string `json:"search"`
}

func (*ListRequest) Validate

func (r *ListRequest) Validate() error

type ListResponse

type ListResponse struct {
	Widgets []Widget `json:"widgets"`
}

func List

func List(ctx context.Context, request *ListRequest) (*ListResponse, error)

type Widget

type Widget struct {
	ID        int64     `json:"id"`
	Name      string    `json:"name"`
	Tags      []string  `json:"tags"`
	Note      string    `json:"note,omitempty"`
	Parent    *Widget   `json:"parent"`
	CreatedAt time.Time `json:"created_at"`
}

Widget is the model the widget routes return.

func Create

func Create(ctx context.Context, request *CreateRequest) (*Widget, error)

func Get

func Get(ctx context.Context, request *GetRequest) (*Widget, error)

Jump to

Keyboard shortcuts

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