edituser

package
v1.17.8 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 13 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

View Source
const (
	MaxSnippets    = 100
	MaxSnippetSize = 64 << 10
)

MaxSnippets and MaxSnippetSize keep the snippets of an account a small list.

View Source
const (
	MaxSavedSearches  = 100
	MaxSavedSearchIDs = 50
)

MaxSavedSearches and MaxSavedSearchIDs keep the saved searches of an account a small list, each with a short enough set of tags/folders that a WHERE ... IN (?) stays cheap.

View Source
const MaxRetentionDays = 3650

MaxRetentionDays keeps the trash retention a sane number of days, ten years.

Variables

View Source
var (
	ErrInvalidLocale      = errors.New("unknown locale")
	ErrInvalidTheme       = errors.New("unknown theme")
	ErrInvalidColorMode   = errors.New("unknown color mode")
	ErrInvalidView        = errors.New("unknown view")
	ErrInvalidSort        = errors.New("unknown sort")
	ErrInvalidPlan        = errors.New("unknown plan")
	ErrInvalidAfterMerge  = errors.New("unknown choice after a merge")
	ErrInvalidRetention   = fmt.Errorf("the trash retention is between 0 and %d days", MaxRetentionDays)
	ErrInvalidNeighbors   = errors.New("unknown limit of neighbors")
	ErrInvalidAvatar      = errors.New("the avatar is not an image of the account")
	ErrInvalidSnippet     = fmt.Errorf("a snippet needs a name, at most %d of them of %d bytes each", MaxSnippets, MaxSnippetSize)
	ErrInvalidSavedSearch = fmt.Errorf("a saved search needs a name and a known tag/folder mode, at most %d of them with %d ids per list, and any_tag_ids only beside tag_ids in all mode", MaxSavedSearches, MaxSavedSearchIDs)
	ErrInvalidSidebar     = errors.New("the sidebar sections are known lists, each at most once")
	ErrNoSavedSearches    = errors.New("the plan of this account does not include savedSearches")
	ErrStale              = errors.New("account settings changed elsewhere since they were read")
)

Functions

func Process

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

Process changes the settings of the account of ctx.

func ValidSavedSearchIDs added in v1.11.0

func ValidSavedSearchIDs(search domain.SavedSearch) bool

ValidSavedSearchIDs is true when each list of tag or folder ids of search is short enough.

Types

type Input

type Input struct {
	Locale             *string                  `json:"locale,omitempty" binding:"optional"`
	Theme              *string                  `json:"theme,omitempty" binding:"optional"`
	ColorMode          *string                  `json:"color_mode,omitempty" binding:"optional"`
	View               *string                  `json:"view,omitempty" binding:"optional"`
	Sort               *string                  `json:"sort,omitempty" binding:"optional"` // see domain.SortKeys, "" for the neutral order
	Plan               *string                  `json:"plan,omitempty" binding:"optional"`
	TrashRetentionDays *int                     `json:"trash_retention_days,omitempty" binding:"optional"`
	NeighborsLimit     *int                     `json:"neighbors_limit,omitempty" binding:"optional"` // one of domain.NeighborsLimits
	AfterMerge         *string                  `json:"after_merge,omitempty" binding:"optional"`     // one of domain.AfterMerges
	Name               *string                  `json:"name,omitempty" binding:"optional"`
	Avatar             *string                  `json:"avatar,omitempty" binding:"optional"`           // the id of an image of the account, "" for none
	Snippets           *[]domain.Snippet        `json:"snippets,omitempty" binding:"optional"`         // the whole list, it replaces the saved one
	SavedSearches      *[]domain.SavedSearch    `json:"saved_searches,omitempty" binding:"optional"`   // the whole list, it replaces the saved one
	SidebarSections    *[]domain.SidebarSection `json:"sidebar_sections,omitempty" binding:"optional"` // the whole list, in order
	// UpdatedAt is the updated_at of the account as read: a 409 if its settings changed since, nothing written.
	UpdatedAt *time.Time `json:"updated_at,omitempty" binding:"optional"`
}

Input holds the settings to change: a nil one is kept.

Jump to

Keyboard shortcuts

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