config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SaveConfig

func SaveConfig(appName string, c *Config) error

SaveConfig to file

Types

type Config

type Config struct {
	Users map[string]User `json:"users"`
}

func LoadConfig

func LoadConfig(appName string) (Config, error)

LoadConfig from file, init empty config if file not found

func (*Config) CheckExist

func (c *Config) CheckExist(nickname string) bool

func (*Config) Delete

func (c *Config) Delete(nickname string)

func (*Config) DeleteAll

func (c *Config) DeleteAll()

func (*Config) Get

func (c *Config) Get(nickname string) (User, bool)

func (*Config) GetAll

func (c *Config) GetAll() map[string]User

func (*Config) Update

func (c *Config) Update(nickname string, user User)

type User

type User struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

Jump to

Keyboard shortcuts

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