stickies

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 10 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 stickies keeps the sticky notes users put on Web UI pages.

A basedir holds one file, <basedir>/stickies.json, mapping a page key (the page's route inside the Web UI, an arbitrary string rather than a path) to the notes on that page. Notes are free-form reminders: no job, run, or result depends on them. Knows nothing of HTTP.

Index

Constants

View Source
const (
	MaxNotesPerPage = 100
	MaxPages        = 1000
	MaxTextRunes    = 4000
	MaxIDLength     = 64
	MaxPageKeyBytes = 1024
	MaxCoordinate   = 1e6

	// Sizes are in pixels; a note of size 0 has the default size.
	MinWidth  = 120
	MinHeight = 80
	MaxSize   = 2000
)

Variables

View Source
var Colors = []string{"yellow", "pink", "green", "blue", "orange"}

Colors are the colours a note may have; the first is the default.

Functions

func Save

func Save(baseDir, page string, notes []Note) error

Save replaces the notes on a page; no notes removes the page.

func Validate

func Validate(page string, notes []Note) error

Validate reports why notes cannot be saved for a page.

Types

type Note

type Note struct {
	ID    string  `json:"id"`
	Text  string  `json:"text"`
	Color string  `json:"color"`
	X     float64 `json:"x"`
	Y     float64 `json:"y"`
	// Width and Height are the note's size in pixels, 0 for the default.
	Width  float64 `json:"width"`
	Height float64 `json:"height"`
	// CreatedAt is when the note was made, RFC 3339; Save fills it in for a
	// note that has none.
	CreatedAt string `json:"created_at"`
}

Note is one sticky note. X and Y are pixels from the page's top-left corner.

func Load

func Load(baseDir, page string) ([]Note, error)

Load returns the notes on a page; a page without notes has none.

type Page

type Page struct {
	Page  string `json:"page"`
	Notes []Note `json:"notes"`
}

Page is a page key with its notes.

func Pages

func Pages(baseDir string) ([]Page, error)

Pages returns every page that has notes, ordered by page key.

func Search(pages []Page, query string) ([]Page, error)

Search keeps the notes whose text contains every whitespace-separated word of query, ignoring case, and the pages that still have notes. Pages keep their order, notes theirs. A query without words is an error, not "everything".

Jump to

Keyboard shortcuts

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