Documentation ¶
Overview ¶
Package misc implements a differents trivial functions
Package misc implements a differents trivial functions
Index ¶
- Constants
- Variables
- func AbsPath(name string) (string, error)
- func AbsPathEx(name string, base string) (string, error)
- func AddExitFunc(name string, f ExitFunc, param interface{})
- func AppExecName() string
- func AppExecPath() string
- func AppFullName() string
- func AppName() string
- func AppStartTime() time.Time
- func AppStarted() bool
- func AppTags() string
- func AppVersion() string
- func AppWorkDir() string
- func BuildTime() string
- func BuildTimeTS() time.Time
- func Copyright() string
- func DelExitFunc(name string)
- func Exit()
- func ExitCode() int
- func GetFuncName(shift int, shortName bool) string
- func GetMyIPs() (map[string]bool, error)
- func GzipPack(data io.Reader) (b *bytes.Buffer, err error)
- func GzipRepack(data io.Reader) (b *bytes.Buffer, err error)
- func GzipUnpack(data io.Reader) (b *bytes.Buffer, err error)
- func Iface2Float(x interface{}) (v float64, err error)
- func Iface2Int(x interface{}) (v int64, err error)
- func Iface2String(x interface{}) (v string, err error)
- func Iface2Uint(x interface{}) (v uint64, err error)
- func IsDebug() bool
- func IsMyIP(ip string) (bool, error)
- func LoadEnv(fileName string) (e error)
- func LogProcessingTime(facility string, level string, id uint64, module string, message string, ...) int64
- func MarshalBin(src interface{}) (buf *bytes.Buffer, err error)
- func NormalizeSlashes(u string) string
- func NowUTC() time.Time
- func NowUnix() int64
- func NowUnixNano() int64
- func ParseJSONtime(s string) (t time.Time, err error)
- func Sleep(duration time.Duration) bool
- func StopApp(code int)
- func Time2JSON(t time.Time) string
- func TrimStringAsFloat(s string) string
- func UnixNano2JSON(ts int64) string
- func UnixNano2UTC(ts int64) time.Time
- func UnmarshalBin(buf *bytes.Buffer, dst interface{}) (err error)
- func WaitingForStop()
- type BoolMap
- type ByteSliceMap
- type CallStackFrame
- type CtxInt64
- type CtxString
- type CtxUint64
- type Error
- type ExitFunc
- type Float64Map
- type Int64Map
- type IntMap
- type InterfaceMap
- type Messages
- type Replace
- type StringMap
- type Uint64Map
- type UintMap
Constants ¶
const ( // ExPanic -- ExPanic int = iota + 200 // ExStopped -- ExStopped // ExVersion -- ExVersion // ExMissingConfigFile -- ExMissingConfigFile // ExIncorrectConfigFile -- ExIncorrectConfigFile // ExConfigIncorrect -- ExConfigIncorrect // ExConfigErrors -- ExConfigErrors // ExCreateListenerError -- ExCreateListenerError // ExStartListenerError -- ExStartListenerError // ExServiceInitializationError -- ExServiceInitializationError // ExServiceError -- ExServiceError // ExAccessDenied -- ExAccessDenied // ExProgrammerError -- ExProgrammerError )
Appliction exit codes
const DateFormat string = "02-01-2006"
DateFormat -- standard format of the date
const DateFormatRev string = "2006-01-02"
DateFormatRev -- reversed format of the date
const DateTimeFormat string = DateFormat + " " + TimeFormat
DateTimeFormat -- format of the date and time
const DateTimeFormatJSON string = DateFormatRev + "T" + TimeFormatWithMS + "Z"
DateTimeFormatJSON -- JSON format
const DateTimeFormatJSONTZ string = DateFormatRev + "T" + TimeFormatWithMS + DateTimeFormatTZ
DateTimeFormatJSONTZ -- JSON format with TZ
const DateTimeFormatRev string = DateFormatRev + " " + TimeFormat
DateTimeFormatRev -- standard format of the date and time with reversed date
const DateTimeFormatRevWithMS string = DateFormatRev + " " + TimeFormatWithMS
DateTimeFormatRevWithMS -- standard format of the date and time with reversed date and milliseconds
const DateTimeFormatShortJSON string = DateFormatRev + "T" + TimeFormat
DateTimeFormatShortJSON -- Short JSON format
const DateTimeFormatShortJSONTZ string = DateFormatRev + "T" + TimeFormat + DateTimeFormatTZ
DateTimeFormatShortJSONTZ -- Short JSON format with TZ
const DateTimeFormatTZ = "Z07:00"
DateTimeFormatTZ --
const DateTimeFormatWithMS string = DateFormat + " " + TimeFormatWithMS
DateTimeFormatWithMS -- standard format of the date and time with milliseconds
const EOS string = "\n"
EOS -- EndOfString
const TimeFormat string = "15:04:05"
TimeFormat -- format of the time
const TimeFormatWithMS string = "15:04:05.000"
TimeFormatWithMS -- format of the time with milliseconds
Variables ¶
var (
// Logger --
Logger loggerFunc
)
var ( // TEST -- test mode TEST = false )
Functions ¶
func AppExecPath ¶
func AppExecPath() string
AppExecPath -- full path of the application executable file
func AppName ¶
func AppName() string
AppName -- name of the application executable file without last extension
func GetFuncName ¶
GetFuncName -- name of the function from call stack
func GzipRepack ¶ added in v0.1.18
GzipRepack -- data will be truncated by ReadFrom!
func GzipUnpack ¶ added in v0.1.18
GzipUnpack -- data will be truncated by ReadFrom!
func LogProcessingTime ¶
func LogProcessingTime(facility string, level string, id uint64, module string, message string, t0 int64) int64
LogProcessingTime --
func ParseJSONtime ¶ added in v0.1.25
ParseJSONtime --
func UnmarshalBin ¶
UnmarshalBin --
Types ¶
type CallStackFrame ¶
CallStackFrame -- call stack element
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error --
func (*Error) SetMessage ¶
SetMessage --
type InterfaceMap ¶
type InterfaceMap map[string]interface{}
InterfaceMap --
func (InterfaceMap) GetFloat ¶
func (m InterfaceMap) GetFloat(name string) (v float64, err error)
GetFloat --
func (InterfaceMap) GetInt ¶
func (m InterfaceMap) GetInt(name string) (v int64, err error)
GetInt --
type Messages ¶ added in v0.1.21
type Messages []string
Messages --