patchnote

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 10 Imported by: 1 module, 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

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrLocked = errors.New("note is read-only, unlock it first")
	ErrStale  = errors.New("note changed elsewhere since it was read")
)

Functions

func Process

func Process(ctx context.Context, db bun.IDB, input Input) *run

Process changes the fields given of a note, used by PATCH /api/notes/{id} and `edit note`. The #tags of the content are the tags of the note, unless the tags are given: they then rewrite it. Pinning or locking alone leaves the note as it is, updated_at included. A locked note refuses content and tags, unless unlocked in the same call. TODO: the read is not locked, two edits within the same instant can both pass the UpdatedAt check; SELECT … FOR UPDATE if that happens.

Types

type Input

type Input struct {
	ID       string
	Pinned   *bool
	Readonly *bool
	Content  *string
	Tags     *[]string
	// UpdatedAt is the version the text was written over: content and tags are refused once the note changed since.
	UpdatedAt *time.Time
	// Restore is a version restored: the text it replaces is kept even within a session, it may be nowhere else.
	Restore bool
}

Input has pointers to tell a field left out from an empty one: editnote replaces everything, so a change without tags must keep them, not clear them.

Jump to

Keyboard shortcuts

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