ini

package
v1.2.77 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNil = errors.New("nil value")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Values map[string]string
}

func NewConfig

func NewConfig() *Config

func ReadConfig

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

func ReadConfigFile

func ReadConfigFile(name string) (*Config, error)

func (*Config) GetBool

func (c *Config) GetBool(key string) (bool, error)

bool: true, false, 0, 1, or ""

func (*Config) GetInt

func (c *Config) GetInt(key string) (int, error)

func (*Config) GetInt64

func (c *Config) GetInt64(key string) (int64, error)

int may be pure number or below format:

# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
# 1gb => 1024*1024*1024 bytes

func (*Config) GetString

func (c *Config) GetString(key string) (string, error)

func (*Config) GetUint64

func (c *Config) GetUint64(key string) (uint64, error)

func (*Config) Read

func (c *Config) Read(r io.Reader) error

func (*Config) SetBool

func (c *Config) SetBool(key string, v bool)

func (*Config) SetInt

func (c *Config) SetInt(key string, n int)

func (*Config) SetInt64

func (c *Config) SetInt64(key string, n int64)

func (*Config) SetString

func (c *Config) SetString(key string, value string)

func (*Config) SetUint64

func (c *Config) SetUint64(key string, n uint64)

func (*Config) Write

func (c *Config) Write(w io.Writer) error

func (*Config) WriteFile

func (c *Config) WriteFile(filePath string) error

Jump to

Keyboard shortcuts

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