configmanager

package
v0.0.0-...-72e33f6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 6 Imported by: 0

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

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, array bool) (Config[T], error)

type ConfigData

type ConfigData interface {
	Merge(js string) (string, error)
	Validate() error
}

type ConfigTable

type ConfigTable[T ConfigData] struct {
	Data T
	JSON json.RawMessage
}

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