utils

package
v0.0.0-...-899e583 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2018 License: GPL-2.0, GPL-3.0 Imports: 10 Imported by: 7

Documentation

Index

Constants

View Source
const (
	TypeJson = iota // .json
	TypeYaml        // .yml & .yaml
)
View Source
const (
	Prefix      = "[SpecterGO] "
	ErrorPrefix = "[Error] "
	DebugPrefix = "[Debug] "
	WarnPrefix  = "[Warn] "
	FatalPrefix = "[Fatal] "

	NewLine = "\n"
)
View Source
const (
	DirectorySeparator = "/"
)

Variables

View Source
var (
	LogFile string
)

Functions

func ArrayToMap

func ArrayToMap(array []string) map[int]string

func ExtMatchType

func ExtMatchType(ext string, configType int) bool

func FileExists

func FileExists(file string) bool

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

func GetServerPath

func GetServerPath() string

func GetTimeString

func GetTimeString() string

func HandleError

func HandleError(err error)

func IntToString

func IntToString(int int) string

func InterfaceToInt

func InterfaceToInt(i interface{}) int

func InterfaceToString

func InterfaceToString(i interface{}) string

func MapToArray

func MapToArray(m map[int]string) []string

func SetLogFile

func SetLogFile(path string)

Types

type Config

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

func NewConfig

func NewConfig(file string, configType int, defaults map[string]interface{}) Config

func (*Config) CheckDefault

func (c *Config) CheckDefault(key string, value interface{})

func (*Config) Config

func (c *Config) Config() Content

func (*Config) ConfigType

func (c *Config) ConfigType() int

func (*Config) Exist

func (c *Config) Exist(key string) bool

func (*Config) File

func (c *Config) File() string

func (*Config) Get

func (c *Config) Get(key string) interface{}

func (*Config) Marshal

func (c *Config) Marshal() ([]byte, error)

func (*Config) Remove

func (c *Config) Remove(key string)

func (*Config) Save

func (c *Config) Save()

func (*Config) Set

func (c *Config) Set(key string, value interface{})

func (*Config) SetConfig

func (c *Config) SetConfig(config Content)

func (*Config) SetConfigType

func (c *Config) SetConfigType(configType int)

func (*Config) SetFile

func (c *Config) SetFile(file string)

func (*Config) Unmarshal

func (c *Config) Unmarshal() Content

type Content

type Content map[string]interface{}

type Logger

type Logger struct {
}

func NewLogger

func NewLogger() Logger

func (*Logger) Debug

func (l *Logger) Debug(log ...interface{})

func (*Logger) Error

func (l *Logger) Error(log ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(log ...interface{})

func (*Logger) Info

func (l *Logger) Info(log ...interface{})

func (*Logger) Log

func (l *Logger) Log(log ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(log ...interface{})

Jump to

Keyboard shortcuts

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