konfig

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: MIT Imports: 14 Imported by: 1

README

konfig

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(structPtr Config)

func Load

func Load(dst Config, filename string) error

func Marshal

func Marshal(src Config, w io.Writer) error

func Save

func Save(src Config, filename string) error

func Unmarshal

func Unmarshal(dst Config, r io.Reader) error

Types

type AES

type AES struct {
	Key string // need len 16 or 32
	Val string
}

func NewAES

func NewAES(val, key string) *AES

func (*AES) GetString

func (f *AES) GetString(converted bool) string

func (*AES) SetString

func (f *AES) SetString(value string, converted bool)

func (*AES) String

func (f *AES) String() string

type Base64

type Base64 string

func (Base64) GetString

func (s Base64) GetString(converted bool) string

func (*Base64) SetString

func (s *Base64) SetString(value string, converted bool)

func (Base64) String

func (s Base64) String() string

type Config

type Config interface {
	GetValue() *Value
	SetValue(path, value string, converted, allowEmpty bool) (ok bool)
	SetDefaults()
	ScanValues(converted bool, iter valueField) error
}

type Duration

type Duration struct{ time.Duration }

Duration pretty type based on time.Duration

func NewDuration

func NewDuration(d time.Duration) Duration

func ParseDuration

func ParseDuration(s string) (d Duration, ok bool)

ParseDuration string "- 0d 0h 0m 0s 0ms 0us 0ns"

func (Duration) GetString

func (dt Duration) GetString(converted bool) string

func (Duration) Seconds

func (dt Duration) Seconds() int

func (*Duration) SetString

func (dt *Duration) SetString(value string, converted bool)

SetString "- 0d 0h 0m 0s 0ms 0us 0ns"

func (Duration) String

func (dt Duration) String() string

String returns (without spaces) "- 0d 0h 0m 0s 0ms 0us 0ns"

type Field

type Field interface {
	GetString(converted bool) string
	SetString(value string, converted bool)
}

type Value

type Value struct {
	// contains filtered or unexported fields
}

func (*Value) GetValue

func (val *Value) GetValue() *Value

func (*Value) ScanValues

func (val *Value) ScanValues(converted bool, iter valueField) error

func (*Value) SetDefaults

func (val *Value) SetDefaults()

func (*Value) SetValue

func (val *Value) SetValue(path, value string, converted, allowEmpty bool) (ok bool)

Jump to

Keyboard shortcuts

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