edituser

package
v0.0.0-...-4d14c86 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 11 Imported by: 0

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")
	ErrInvalidPlan        = errors.New("unknown plan")
	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", MaxSavedSearches)
	ErrInvalidSidebar     = errors.New("the sidebar sections are known lists, each at most once")
)

Functions

func Process

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

Process changes the settings of the account of ctx.

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"`
	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
	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
}

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
⌂ 换网址