configmanager

package
v0.0.0-...-caa15a9 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2026 License: AGPL-3.0 Imports: 5 Imported by: ? 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Merge

func Merge(json string, values []MergeValues) (string, error)

Merge merges values into the json. Values are only merged if the path already exists in the original json.

func SetConfig

func SetConfig[T ConfigData](ctx context.Context, c dahuarpc.Conn, config Config[T]) error

func SetConfigArray

func SetConfigArray[T ConfigData](ctx context.Context, c dahuarpc.Conn, config ConfigArray[T]) error

Types

type Config

type Config[T ConfigData] struct {
	Tables ConfigTable[T]
	// contains filtered or unexported fields
}

func GetConfig

func GetConfig[T ConfigData](ctx context.Context, c dahuarpc.Conn, name string) (Config[T], error)

type ConfigArray

type ConfigArray[T ConfigData] struct {
	Tables []ConfigTable[T]
	// contains filtered or unexported fields
}

func GetConfigArray

func GetConfigArray[T ConfigData](ctx context.Context, c dahuarpc.Conn, name string) (ConfigArray[T], error)

type ConfigData

type ConfigData interface {
	// Merge should merge its own data with the input js.
	// The return should be the merged data.
	Merge(js string) (string, error)
	// Validate is run when unmarshalling.
	Validate() error
}

type ConfigTable

type ConfigTable[T ConfigData] struct {
	Data T
	// contains filtered or unexported fields
}

func (*ConfigTable[T]) MarshalJSON

func (ct *ConfigTable[T]) MarshalJSON() ([]byte, error)

func (*ConfigTable[T]) UnmarshalJSON

func (ct *ConfigTable[T]) UnmarshalJSON(data []byte) error

type MergeValues

type MergeValues struct {
	Path  string
	Value any
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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