config

package
v0.0.0-...-8595b8b Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: MIT Imports: 9 Imported by: 0

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