config

package
v0.0.0-...-8b2f4f0 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 9 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindMaxKeyLength

func FindMaxKeyLength(lines []Line) int

func Join

func Join(key string, chunks ...string) string

func Keys

func Keys(configData []byte) []string

func View

func View(configData []byte) string

func ViewLine

func ViewLine(line Line, maxKeyLength int) string

Types

type Config

type Config interface {
	Get(path string) (value any, has bool)
	GetString(path string) (value string, has bool)
	Type(path string) ValueType
	Set(path string, value any) error
	Save() error
	View() string
	Keys() []string
	Path() string
}

func Reload

func Reload(directory directory) (Config, error)

type Line

type Line struct {
	Key   string
	Value string
}

func ViewLines

func ViewLines(configData []byte) []Line

func Walk

func Walk(node gjson.Result, key string) []Line

type ValueType

type ValueType string
const (
	TypeNull   ValueType = "null"
	TypeBool   ValueType = "bool"
	TypeNumber ValueType = "number"
	TypeString ValueType = "string"
	TypeArray  ValueType = "array"
	TypeObject ValueType = "object"
)

Jump to

Keyboard shortcuts

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