replacenotes

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 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 ErrNoValue = errors.New("no text to replace")

Functions

func Process

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

Process replaces a text in the content of every live note of the account, through patchnote in one transaction: the locked notes are skipped and counted, and each note changed keeps a version of its text before. TODO: every note goes through patchnote within the 30 s of a request, fine for a few thousand changed; a job if more.

Types

type Input

type Input struct {
	Find    string `json:"find"`
	Replace string `json:"replace"`
	DryRun  bool   `json:"dry_run,omitempty" binding:"optional"`
	Folder  string `json:"folder,omitempty" binding:"optional"` // a folder id: only its notes, its subfolders included
}

Input is a plain text, no regex, found with its case. DryRun only counts, for the confirmation.

type Result

type Result struct {
	Notes       int `json:"notes"`
	Occurrences int `json:"occurrences"`
	Locked      int `json:"locked"`
}

Result counts the notes holding the text and its occurrences in them; the locked notes are left as they are.

Jump to

Keyboard shortcuts

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