Documentation ¶
Index ¶
- Constants
- Variables
- func AddShutdownHook(f func() error)
- func Capitalize(txt string) string
- func CleanPath(path string) string
- func Cleanup()
- func ClearDate(v time.Time) time.Time
- func ClearTime(v time.Time) time.Time
- func CompareDate(t1 time.Time, t2 time.Time) time.Duration
- func CompareIgnoreCase(s0 string, s1 string) bool
- func CompareTime(t1 time.Time, t2 time.Time) time.Duration
- func ContainsWildcard(s string) bool
- func ConvertToOSspecificLF(s string) string
- func CreateTempDir() (string, error)
- func CreateTempFile() (file *os.File, err error)
- func CurDir() (string, error)
- func Debug(t string, arg ...interface{})
- func DebugError(err error)
- func DebugFunc()
- func DefaultConsoleEncoding() string
- func DefaultEncoding() string
- func DetectMimeType(buf []byte) (string, string)
- func EqualWildcards(s, mask string) (bool, error)
- func Error(err error)
- func Eval(b bool, tf interface{}, ff interface{}) interface{}
- func Exit(code int)
- func Fatal(err error)
- func File(txt string)
- func FileBackup(filename string, count int) error
- func FileCopy(src string, dst string) error
- func FileExists(filename string) (bool, error)
- func FileName(filename string) string
- func FileNameExt(filename string) string
- func FileNamePart(filename string) string
- func FileSize(filename string) (int64, error)
- func FileStore(filename string, r io.Reader) error
- func GetRune(s string, index int) (rune, error)
- func IndexOf(slice interface{}, search interface{}) (int, error)
- func Info(t string, arg ...interface{})
- func IsAMD64() bool
- func IsDebugMode() bool
- func IsDirectory(path string) (bool, error)
- func IsFile(path string) bool
- func IsFileReadOnly(path string) (result bool, err error)
- func IsLinuxOS() bool
- func IsMacOS() bool
- func IsSymbolicLink(path string) bool
- func IsWindowsOS() bool
- func New(application *App, mandatoryFlags []string)
- func ParseDateTime(mask string, v string) (time.Time, error)
- func Rnd(max int) int
- func Run()
- func RuntimeInfo(pos int) ri
- func SetFileReadOnly(path string, readonly bool) (err error)
- func SetTime(t time.Time, f string, v int) time.Time
- func Shortener(s string, max int) string
- func ShowBanner()
- func SplitWithQuotation(txt string) []string
- func SurroundWith(str []string, prefixSuffix string) []string
- func TempDir() (string, error)
- func ToBool(s string) bool
- func ToString(cmd exec.Cmd) string
- func ToStrings(slice interface{}) ([]string, error)
- func ToTime(v asDateTime) time.Time
- func ToUTF8(r io.Reader, cs string) ([]byte, error)
- func ToUTF8String(s string, cs string) (string, error)
- func Translate(msg string, args ...interface{}) string
- func Trim4Path(path string) string
- func TruncateTime(t time.Time, f string) time.Time
- func Unzip(dest, src string) error
- func Warn(t string, arg ...interface{})
- func Zip(filename string, files []string) error
- type App
- type ChannelError
- type ErrFileNotFound
- type ErrInvalidType
- type Jason
- func (jason *Jason) Array(key string, index int) (*Jason, error)
- func (jason *Jason) ArrayCount(key string) int
- func (jason *Jason) Bool(key string, def ...bool) (bool, error)
- func (jason *Jason) Count() int
- func (jason *Jason) Element(key string) (*Jason, error)
- func (jason *Jason) Elements() []string
- func (jason *Jason) Exists(key string) bool
- func (jason *Jason) Int(key string, def ...int) (int, error)
- func (jason *Jason) IsArray(key string) bool
- func (jason *Jason) IsBool(key string) bool
- func (jason *Jason) IsInt(key string) bool
- func (jason *Jason) IsString(key string) bool
- func (jason *Jason) Pretty() (string, error)
- func (jason *Jason) String(key string, def ...string) (string, error)
- type OrderedMap
- func (o *OrderedMap) Clear() *OrderedMap
- func (o *OrderedMap) Delete(key interface{}) *OrderedMap
- func (o *OrderedMap) Get(key interface{}) (interface{}, bool)
- func (o *OrderedMap) Keys() []interface{}
- func (o *OrderedMap) Len() int
- func (o *OrderedMap) Set(key interface{}, value interface{}) *OrderedMap
- func (o *OrderedMap) SetMap(m ...interface{}) *OrderedMap
- type Quantum
Constants ¶
const ( // Apache license APACHE string = "https://www.apache.org/licenses/LICENSE-2.0.html" // GPL2 license GPL2 string = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html" )
const ( SERVICE = "service" SERVICE_USER = "service-user" SERVICE_PASSWORD = "service-password" )
const ( //Year parse mask Year = "2006" //Month parse mask Month = "01" //Day parse mask Day = "02" //Hour parse mask Hour = "15" //Minute parse mask Minute = "04" //Second parse mask Second = "05" //Milli parse mask Msec = ".000" //DateSeparator parse mask DateSeparator = "." //TimeSeparator parse mask TimeSeparator = ":" //Separator parse mask Separator = " " )
const ( // DB level LEVEL_FILE = iota // LEVEL_DEBUG level LEVEL_DEBUG // LEVEL_INFO level LEVEL_INFO // LEVEL_ERROR level LEVEL_WARN // LEVEL_ERROR level LEVEL_ERROR // LEVEL_FATAL level LEVEL_FATAL )
const ( BIG5 = "big5" IBM437 = "ibm437" IBM850 = "ibm850" IBM866 = "ibm866" ISO_8859_1 = "iso-8859-1" ISO_8859_10 = "iso-8859-10" ISO_8859_2 = "iso-8859-2" ISO_8859_3 = "iso-8859-3" ISO_8859_4 = "iso-8859-4" ISO_8859_5 = "iso-8859-5" ISO_8859_6 = "iso-8859-6" ISO_8859_7 = "iso-8859-7" ISO_8859_8 = "iso-8859-8" ISO_8859_9 = "iso-8859-9" KOI8_R = "koi8-r" US_ASCII = "us-ascii" UTF_16 = "utf-16" UTF_16BE = "utf-16be" UTF_16LE = "utf-16le" UTF_8 = "utf-8" WINDOWS_1250 = "windows-1250" WINDOWS_1251 = "windows-1251" WINDOWS_1252 = "windows-1252" )
const MIME_TYPE_HEADER_LEN = 1024
const UNKNOWN = "unknwon"
Variables ¶
var ( UserName *string UserHomeDir *string )
var DateMask = Day + DateSeparator + Month + DateSeparator + Year
DateMask parses only for date values
var DateMaskFilename = Year + "-" + Month + "-" + Day
DateMaskFilena,e parses for date value for file names
var DateTimeMask = DateMask + Separator + TimeMask
DateTimeMask parses for date and time values
var DateTimeMilliMask = DateMask + Separator + TimeMask + Msec
DateTimeMask parses for date and time values
var (
NoBanner bool
)
var TimeMask = Hour + TimeSeparator + Minute + TimeSeparator + Second
TimeMask parses only for time values
Functions ¶
func AddShutdownHook ¶
func AddShutdownHook(f func() error)
func CompareDate ¶
EqualDateTime checks for equality of parts
func CompareIgnoreCase ¶
CompareIgnoreCase compares strings for equality ignoring case
func CompareTime ¶
EqualTime checks for equality of time
func ContainsWildcard ¶
func ConvertToOSspecificLF ¶
func CreateTempFile ¶
CreateTempFile creates a temporary file
func DefaultConsoleEncoding ¶
func DefaultConsoleEncoding() string
func DefaultEncoding ¶
func DefaultEncoding() string
func DetectMimeType ¶
func EqualWildcards ¶
func FileBackup ¶
FileBackup creats backup of files
func FileNameExt ¶
Returns the filename extension without part "test.txt" -> ".txt"
func FileNamePart ¶
Returns the filename part without extension "test.txt" -> "test"
func IsDebugMode ¶
func IsDebugMode() bool
func IsDirectory ¶
IsDirectory checks if the path leads to a directory
func IsFileReadOnly ¶
IsFileReadOnly checks if a file is read only
func IsSymbolicLink ¶
IsSymbolicLink checks if the path leads to symbolic link
func ParseDateTime ¶
ParseDateTime parses only date, but no time
func RuntimeInfo ¶
func RuntimeInfo(pos int) ri
func SetFileReadOnly ¶
SetFileReadOnly sets file READ-ONLY yes or false
func ShowBanner ¶
func ShowBanner()
func SplitWithQuotation ¶
SplitWithQuotation splits a sequented string by spaces and respects quotation
func SurroundWith ¶
Types ¶
type App ¶
type App struct { // Name of the application Name string // Version of the application Version string // Date of development Date string // Description of the application Description string // Developer of the application Developer string // License of the application License string // Homepage of the application Homepage string //IsService IsService bool //PrepareFunc PrepareFunc func() error //StartFunc StartFunc func() error //StopFunc StopFunc func() error //TickFunc TickFunc func() error //TickTime TickTime time.Duration }
Info information of the application
type ChannelError ¶
type ChannelError struct {
// contains filtered or unexported fields
}
func (*ChannelError) Add ¶
func (c *ChannelError) Add(err error)
func (*ChannelError) Exists ¶
func (c *ChannelError) Exists() bool
func (*ChannelError) Get ¶
func (c *ChannelError) Get() error
func (*ChannelError) GetAll ¶
func (c *ChannelError) GetAll() []error
type ErrFileNotFound ¶
type ErrFileNotFound struct {
FileName string
}
func (*ErrFileNotFound) Error ¶
func (e *ErrFileNotFound) Error() string
type ErrInvalidType ¶
type ErrInvalidType struct {
// contains filtered or unexported fields
}
func (*ErrInvalidType) Error ¶
func (e *ErrInvalidType) Error() string
type Jason ¶
type Jason struct {
// contains filtered or unexported fields
}
func (*Jason) ArrayCount ¶
type OrderedMap ¶
type OrderedMap struct {
// contains filtered or unexported fields
}
func NewOrderedMap ¶
func NewOrderedMap(m ...interface{}) *OrderedMap
func (*OrderedMap) Clear ¶
func (o *OrderedMap) Clear() *OrderedMap
func (*OrderedMap) Delete ¶
func (o *OrderedMap) Delete(key interface{}) *OrderedMap
func (*OrderedMap) Get ¶
func (o *OrderedMap) Get(key interface{}) (interface{}, bool)
func (*OrderedMap) Keys ¶
func (o *OrderedMap) Keys() []interface{}
func (*OrderedMap) Len ¶
func (o *OrderedMap) Len() int
func (*OrderedMap) Set ¶
func (o *OrderedMap) Set(key interface{}, value interface{}) *OrderedMap
func (*OrderedMap) SetMap ¶
func (o *OrderedMap) SetMap(m ...interface{}) *OrderedMap
type Quantum ¶
type Quantum struct {
// contains filtered or unexported fields
}
func NewQuantum ¶
func NewQuantum() *Quantum