settingsjson

package
v1.148.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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