Documentation ¶
Index ¶
- Constants
- Variables
- func AddListener(name string, ch chan interface{})
- 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 CopyImage(src image.Image) draw.Image
- 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 EmitListener(name string, event string)
- func EncodeJpeg(source image.Image, w io.Writer) error
- func EqualWildcards(s, mask string) (bool, error)
- func Error(err error)
- func Eval(b bool, trueFunc interface{}, falseFunc interface{}) interface{}
- func Exit(code int)
- func Fatal(err error)
- func FileBackup(filename string, count int) error
- func FileCopy(src string, dst string) error
- func FileDelete(filename 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, error)
- func IsFileReadOnly(path string) (result bool, err error)
- func IsImageMimeType(s string) bool
- func IsLinuxOS() bool
- func IsMacOS() bool
- func IsSymbolicLink(path string) bool
- func IsWindowsOS() bool
- func LoadImage(path string) (img image.Image, err error)
- func New(application *App, mandatoryFlags []string)
- func ParseDateTime(mask string, v string) (time.Time, error)
- func ReadHeader(path string) ([]byte, error)
- func RemoveListener(name string, ch chan interface{})
- func Rnd(max int) int
- func Rotate(source image.Image, rotation Rotation) image.Image
- func Run()
- func RuntimeInfo(pos int) ri
- func SaveJpeg(source image.Image, filename string) error
- func ScanLinesWithLF(data []byte, atEOF bool) (advance int, token []byte, err error)
- 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 StillAlive(pid int) bool
- func SurroundWith(str []string, prefixSuffix string) []string
- func TempDir() (string, error)
- func Test()
- 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 WarnError(err error)
- func Watchdog(cmd *exec.Cmd, timeout time.Duration) error
- func Zip(filename string, files []string) error
- type App
- type ChannelError
- type ErrFileNotFound
- type ErrInvalidType
- type ErrWatchdog
- type EventHandler
- type EventType
- 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 MIMETYPE_EXTENSION
- 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 Orientation
- type Quantum
- type ReentrantLock
- type Rotation
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_PROLOG = 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 (
AFTER_FLAG_PARSE = "AFTER_FLAG_PARSE"
)
const (
MIMETYPE_HEADER_LEN = 1024
)
const UNKNOWN = "unknwon"
Variables ¶
var ( UserName *string UserHomeDir *string )
var ( MIMETYPE_APPLICATION_DICOM = MIMETYPE_EXTENSION{"application/dicom", "dcm"} MIMETYPE_APPLICATION_EPUB_ZIP = MIMETYPE_EXTENSION{"application/epub+zip", "epub"} MIMETYPE_APPLICATION_GEO_JSON = MIMETYPE_EXTENSION{"application/geo+json", "geojson"} MIMETYPE_APPLICATION_GML_XML = MIMETYPE_EXTENSION{"application/gml+xml", "gml"} MIMETYPE_APPLICATION_GPX_XML = MIMETYPE_EXTENSION{"application/gpx+xml", "gpx"} MIMETYPE_APPLICATION_GZIP = MIMETYPE_EXTENSION{"application/gzip", "gz"} MIMETYPE_APPLICATION_JAR = MIMETYPE_EXTENSION{"application/jar", "jar"} MIMETYPE_APPLICATION_JAVASCRIPT = MIMETYPE_EXTENSION{"application/javascript", "js"} MIMETYPE_APPLICATION_JSON = MIMETYPE_EXTENSION{"application/json", "json"} MIMETYPE_APPLICATION_MSWORD = MIMETYPE_EXTENSION{"application/msword", "doc"} MIMETYPE_APPLICATION_OCTET_STREAM = MIMETYPE_EXTENSION{"application/octet-stream", ""} MIMETYPE_APPLICATION_OGG = MIMETYPE_EXTENSION{"application/ogg", "ogg"} MIMETYPE_APPLICATION_PDF = MIMETYPE_EXTENSION{"application/pdf", "pdf"} MIMETYPE_APPLICATION_POSTSCRIPT = MIMETYPE_EXTENSION{"application/postscript", "ps"} MIMETYPE_APPLICATION_VND_GARMIN_TCX_XML = MIMETYPE_EXTENSION{"application/vnd.garmin.tcx+xml", "tcx"} MIMETYPE_APPLICATION_VND_GOOGLE_EARTH_KML_XML = MIMETYPE_EXTENSION{"application/vnd.google-earth.kml+xml", "kml"} MIMETYPE_APPLICATION_VND_MS_EXCEL = MIMETYPE_EXTENSION{"application/vnd.ms-excel", "xls"} MIMETYPE_APPLICATION_VND_MS_POWERPOINT = MIMETYPE_EXTENSION{"application/vnd.ms-powerpoint", "ppt"} MIMETYPE_APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_PRESENTATIONML_PRESENTATION = MIMETYPE_EXTENSION{"application/vnd.openxmlformats-officedocument.presentationml.presentation", "pptx"} MIMETYPE_APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_SPREADSHEETML_SHEET = MIMETYPE_EXTENSION{"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "xlsx"} MIMETYPE_APPLICATION_VND_OPENXMLFORMATS_OFFICEDOCUMENT_WORDPROCESSINGML_DOCUMENT = MIMETYPE_EXTENSION{"application/vnd.openxmlformats-officedocument.wordprocessingml.document", "docx"} MIMETYPE_APPLICATION_WASM = MIMETYPE_EXTENSION{"application/wasm", "wasm"} MIMETYPE_APPLICATION_X_7Z_COMPRESSED = MIMETYPE_EXTENSION{"application/x-7z-compressed", "7z"} MIMETYPE_APPLICATION_X_CHROME_EXTENSION = MIMETYPE_EXTENSION{"application/x-chrome-extension", "crx"} MIMETYPE_APPLICATION_X_JAVA_APPLET = MIMETYPE_EXTENSION{"application/x-java-applet; charset=binary", "class"} MIMETYPE_APPLICATION_X_PHOTOSHOP = MIMETYPE_EXTENSION{"application/x-photoshop", "psd"} MIMETYPE_APPLICATION_X_PYTHON = MIMETYPE_EXTENSION{"application/x-python", "py"} MIMETYPE_APPLICATION_X_SHOCKWAVE_FLASH = MIMETYPE_EXTENSION{"application/x-shockwave-flash", "swf"} MIMETYPE_APPLICATION_X_TAR = MIMETYPE_EXTENSION{"application/x-tar", "tar"} MIMETYPE_APPLICATION_ZIP = MIMETYPE_EXTENSION{"application/zip", "zip"} MIMETYPE_AUDIO_AIFF = MIMETYPE_EXTENSION{"audio/aiff", "aiff"} MIMETYPE_AUDIO_AMR = MIMETYPE_EXTENSION{"audio/amr", "amr"} MIMETYPE_AUDIO_APE = MIMETYPE_EXTENSION{"audio/ape", "ape"} MIMETYPE_AUDIO_BASIC = MIMETYPE_EXTENSION{"audio/basic", "au"} MIMETYPE_AUDIO_FLAC = MIMETYPE_EXTENSION{"audio/flac", "flac"} MIMETYPE_AUDIO_MIDI = MIMETYPE_EXTENSION{"audio/midi", "midi"} MIMETYPE_AUDIO_MP4 = MIMETYPE_EXTENSION{"audio/mp4", "mp4"} MIMETYPE_AUDIO_MPEG = MIMETYPE_EXTENSION{"audio/mpeg", "mp3"} MIMETYPE_AUDIO_MUSEPACK = MIMETYPE_EXTENSION{"audio/musepack", "mpc"} MIMETYPE_AUDIO_WAV = MIMETYPE_EXTENSION{"audio/wav", "wav"} MIMETYPE_AUDIO_X_M4A = MIMETYPE_EXTENSION{"audio/x-m4a", "m4a"} MIMETYPE_FONT_WOFF = MIMETYPE_EXTENSION{"font/woff", "woff"} MIMETYPE_FONT_WOFF2 = MIMETYPE_EXTENSION{"font/woff2", "woff2"} MIMETYPE_IMAGE_BMP = MIMETYPE_EXTENSION{"image/bmp", "bmp"} MIMETYPE_IMAGE_GIF = MIMETYPE_EXTENSION{"image/gif", "gif"} MIMETYPE_IMAGE_JPEG = MIMETYPE_EXTENSION{"image/jpeg", "jpg"} MIMETYPE_IMAGE_PNG = MIMETYPE_EXTENSION{"image/png", "png"} MIMETYPE_IMAGE_SVG_XML = MIMETYPE_EXTENSION{"image/svg+xml", "svg"} MIMETYPE_IMAGE_TIFF = MIMETYPE_EXTENSION{"image/tiff", "tiff"} MIMETYPE_IMAGE_WEBP = MIMETYPE_EXTENSION{"image/webp", "webp"} MIMETYPE_IMAGE_X_ICON = MIMETYPE_EXTENSION{"image/x-icon", "ico"} MIMETYPE_MODEL_VND_COLLADA_XML = MIMETYPE_EXTENSION{"model/vnd.collada+xml", "dae"} MIMETYPE_MODEL_X3D_XML = MIMETYPE_EXTENSION{"model/x3d+xml", "x3d"} MIMETYPE_TEXT_HTML = MIMETYPE_EXTENSION{"text/html; charset=utf-8", "html"} MIMETYPE_TEXT_PLAIN = MIMETYPE_EXTENSION{"text/plain", "txt"} MIMETYPE_TEXT_RTF = MIMETYPE_EXTENSION{"text/rtf", "rtf"} MIMETYPE_TEXT_XML = MIMETYPE_EXTENSION{"text/xml; charset=utf-8", "xml"} MIMETYPE_TEXT_X_LUA = MIMETYPE_EXTENSION{"text/x-lua", "lua"} MIMETYPE_TEXT_X_PERL = MIMETYPE_EXTENSION{"text/x-perl", "pl"} MIMETYPE_TEXT_X_PHP = MIMETYPE_EXTENSION{"text/x-php; charset=utf-8", "php"} MIMETYPE_TEXT_X_TCL = MIMETYPE_EXTENSION{"text/x-tcl", "tcl"} MIMETYPE_VIDEO_3GPP = MIMETYPE_EXTENSION{"video/3gpp", "3gp"} MIMETYPE_VIDEO_3GPP2 = MIMETYPE_EXTENSION{"video/3gpp2", "3g2"} MIMETYPE_VIDEO_MP4 = MIMETYPE_EXTENSION{"video/mp4", "mp4"} MIMETYPE_VIDEO_MPEG = MIMETYPE_EXTENSION{"video/mpeg", "mpeg"} MIMETYPE_VIDEO_QUICKTIME = MIMETYPE_EXTENSION{"video/quicktime", "mov"} MIMETYPE_VIDEO_WEBM = MIMETYPE_EXTENSION{"video/webm", "webm"} MIMETYPE_VIDEO_X_FLV = MIMETYPE_EXTENSION{"video/x-flv", "flv"} MIMETYPE_VIDEO_X_MATROSKA = MIMETYPE_EXTENSION{"video/x-matroska", "mkv"} MIMETYPE_VIDEO_X_MSVIDEO = MIMETYPE_EXTENSION{"video/x-msvideo", "avi"} )
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 AddListener ¶ added in v1.1.3
func AddListener(name string, ch chan interface{})
AddSitter adds an event listener to the Dog struct instance
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 EmitListener ¶ added in v1.1.3
Emit emits an event on the Dog struct instance
func EqualWildcards ¶
func FileBackup ¶
FileBackup creats backup of files
func FileDelete ¶ added in v1.1.0
FileExists does ... guess what :-)
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 IsImageMimeType ¶ added in v1.1.0
func IsSymbolicLink ¶
IsSymbolicLink checks if the path leads to symbolic link
func ParseDateTime ¶
ParseDateTime parses only date, but no time
func ReadHeader ¶ added in v1.1.0
func RemoveListener ¶ added in v1.1.3
func RemoveListener(name string, ch chan interface{})
RemoveSitter removes an event listener from the Dog struct instance
func RuntimeInfo ¶
func RuntimeInfo(pos int) ri
func ScanLinesWithLF ¶ added in v1.1.0
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 StillAlive ¶ added in v1.1.3
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 ErrWatchdog ¶ added in v1.1.3
func (*ErrWatchdog) Error ¶ added in v1.1.3
func (e *ErrWatchdog) Error() string
type EventHandler ¶ added in v1.1.0
type EventHandler struct {
Listeners map[EventType][]chan interface{}
}
func NewEventHandler ¶ added in v1.1.0
func NewEventHandler() *EventHandler
func (*EventHandler) AddListener ¶ added in v1.1.0
func (eh *EventHandler) AddListener(name EventType, ch chan interface{})
func (*EventHandler) Emit ¶ added in v1.1.0
func (eh *EventHandler) Emit(name EventType, response string)
func (*EventHandler) RemoveListener ¶ added in v1.1.0
func (eh *EventHandler) RemoveListener(name EventType, ch chan interface{})
func (*EventHandler) RemoveListenesr ¶ added in v1.1.0
func (eh *EventHandler) RemoveListenesr(name EventType)
type Jason ¶
type Jason struct {
// contains filtered or unexported fields
}
func (*Jason) ArrayCount ¶
type MIMETYPE_EXTENSION ¶ added in v1.1.0
type MIMETYPE_EXTENSION struct {
MimeType, Ext string
}
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 Orientation ¶ added in v1.1.0
type Orientation int
const ( ORIENTATION_0 Orientation = iota ORIENTATION_90 ORIENTATION_180 ORIENTATION_270 )
type Quantum ¶
type Quantum struct {
// contains filtered or unexported fields
}
func NewQuantum ¶
func NewQuantum() *Quantum
func (*Quantum) RemoveRange ¶
type ReentrantLock ¶ added in v1.1.3
func (*ReentrantLock) Lock ¶ added in v1.1.3
func (rl *ReentrantLock) Lock()
func (*ReentrantLock) Unlock ¶ added in v1.1.3
func (rl *ReentrantLock) Unlock()