ini

package
v0.0.0-...-ade9fc0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Config ini config

func NewConfig

func NewConfig(filename string) (*Config, error)

NewConfig create ini config from file

func NewConfigFromData

func NewConfigFromData(data []byte) (*Config, error)

NewConfigFromData create ini config from data.

func (*Config) Bool

func (conf *Config) Bool(key string) (bool, error)

Bool get bool by key

func (*Config) DIY

func (conf *Config) DIY(key string) (interface{}, error)

DIY return raw value for a given key.

func (*Config) DefaultBool

func (conf *Config) DefaultBool(key string, defaultval bool) bool

DefaultBool returns the boolean value for a given key. if err != nil return defaultval

func (*Config) DefaultFloat

func (conf *Config) DefaultFloat(key string, defaultval float64) float64

DefaultFloat returns float64 value for a given key. if err != nil return defaultval

func (*Config) DefaultInt

func (conf *Config) DefaultInt(key string, defaultval int) int

DefaultInt returns the integer value for a given key. if err != nil return defaultval

func (*Config) DefaultInt64

func (conf *Config) DefaultInt64(key string, defaultval int64) int64

DefaultInt64 returns the int64 value for a given key. if err != nil return defaultval

func (*Config) DefaultString

func (conf *Config) DefaultString(key string, defaultval string) string

DefaultString returns the string value for a given key. if err != nil return defaultval

func (*Config) DefaultStrings

func (conf *Config) DefaultStrings(key string, defaultval []string) []string

DefaultStrings returns the []string value for a given key. if err != nil return defaultval

func (*Config) Float

func (conf *Config) Float(key string) (float64, error)

Float returns float64 value for a given key.

func (*Config) FormatBeauty

func (conf *Config) FormatBeauty() []byte

FormatBeauty format beauty style

func (*Config) GetSection

func (conf *Config) GetSection(sectionName string) (map[string]string, error)

GetSection returns map for given section

func (*Config) Int

func (conf *Config) Int(key string) (int, error)

Int get int by key

func (*Config) Int64

func (conf *Config) Int64(key string) (int64, error)

Int64 get int64 by key

func (*Config) SaveConfigFile

func (conf *Config) SaveConfigFile(filename string) error

SaveConfigFile save config to file.

func (*Config) Set

func (conf *Config) Set(key, value string) error

Set set key = value key can be "section::key"

func (*Config) String

func (conf *Config) String(key string) string

String get string by key

func (*Config) Strings

func (conf *Config) Strings(key string) []string

Strings get string slice by key

type Line

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

Line one line

type Section

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

Section section

func NewSection

func NewSection(name string) *Section

NewSection create an section

Directories

Path Synopsis
example

Jump to

Keyboard shortcuts

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