settingsjson

package
v1.169.5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: Apache-2.0 Imports: 6 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 settingsjson stores one platform_settings section as a JSON value of a Go type: the read, the upsert, and the audit columns beside the value. Each alert and feature with an admin-written section used to carry its own copy of the two statements; a section added since #2148 is one of these.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("settingsjson: section not written")

ErrNotFound is returned by Get when the section has never been written.

Functions

This section is empty.

Types

type Section

type Section[T any] struct {
	// contains filtered or unexported fields
}

Section is one platform_settings section holding a T.

func New

func New[T any](db *sql.DB, name string) *Section[T]

New returns the section name over db.

func (*Section[T]) Get

func (s *Section[T]) Get(ctx context.Context) (Stored[T], error)

Get returns the stored value, or ErrNotFound.

func (*Section[T]) Set

func (s *Section[T]) Set(ctx context.Context, v T, author string) error

Set upserts the value, recording author as its writer.

type Stored

type Stored[T any] struct {
	Value     T
	UpdatedBy string
	UpdatedAt time.Time
}

Stored is a section's value with who wrote it last and when.

Jump to

Keyboard shortcuts

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