Documentation ¶
Index ¶
- Constants
- Variables
- func CrateDir(dirs ...string) (err error)
- func EmitAllEvent(arg interface{})
- func EmitEvent(name string, arg interface{})
- func Exists(path string) bool
- func Ext(path string) string
- func GetNowUnix() int64
- func GetSwitchFromOptions(Options map[string]bool, key string) (result bool)
- func GetTodayUnix() int64
- func Int32ToString(i int32) string
- func Int64ToString(i int64) string
- func IntToString(i int) string
- func InterfaceArrayToStringArray(data []interface{}) (i []string)
- func IsContain(target string, List []string) bool
- func JsonStringToMap(str string) (tempMap map[string]int32)
- func JsonStringToStruct(s string, args interface{}) error
- func LocalIP() (net.IP, error)
- func MD5(str string) string
- func MapIntToJsonString(param map[string]int32) string
- func MapToJsonString(param map[string]interface{}) string
- func OffAllEvent(name string) error
- func OffEvent(name string, f func(interface{})) error
- func OnEvent(name string, fs ...func(interface{})) error
- func ParseCmdArguments(s string) (arguments []string)
- func PlatformIDToName(num int) string
- func PlatformNameToClass(name string) string
- func PlatformNameToID(name string) int
- func Scrypt(password string) string
- func SetSwitchFromOptions(options map[string]bool, key string, value bool)
- func Stamp2Str(stamp int64) string
- func Stamp2Time(stamp int64) time.Time
- func Str2Stamp(formatTimeStr string) int64
- func Str2Time(formatTimeStr string) time.Time
- func StringToInt(i string) int
- func StringToInt32(i string) int32
- func StringToInt64(i string) int64
- func StructToJsonBytes(param interface{}) []byte
- func StructToJsonString(param interface{}) string
- func Time2Stamp(t time.Time) int64
- func Time2Str(t time.Time) string
- func UUID() (string, error)
- func WaitEvent(sig ...os.Signal) os.Signal
- type Cpu
- type Disk
- type Map
- func (m *Map) Del(key interface{})
- func (m *Map) Get(key interface{}) interface{}
- func (m *Map) Len() int
- func (m *Map) LockRange(f func(interface{}, interface{}))
- func (m *Map) RLockRange(f func(interface{}, interface{}))
- func (m *Map) Set(key interface{}, value interface{})
- func (m *Map) TestAndSet(key interface{}, value interface{}) interface{}
- func (m *Map) UnsafeDel(key interface{})
- func (m *Map) UnsafeGet(key interface{}) interface{}
- func (m *Map) UnsafeLen() int
- func (m *Map) UnsafeRange(f func(interface{}, interface{}))
- func (m *Map) UnsafeSet(key interface{}, value interface{})
- type Os
- type Rrm
- type Server
- type Timer
Constants ¶
View Source
const ( EXIT = "exit" WAIT = "wait" )
View Source
const ( //Platform ID IOSPlatformID = 1 AndroidPlatformID = 2 WindowsPlatformID = 3 OSXPlatformID = 4 WebPlatformID = 5 MiniWebPlatformID = 6 LinuxPlatformID = 7 //Platform string match to Platform ID IOSPlatformStr = "IOS" AndroidPlatformStr = "Android" WindowsPlatformStr = "Windows" OSXPlatformStr = "OSX" WebPlatformStr = "Web" MiniWebPlatformStr = "MiniWeb" LinuxPlatformStr = "Linux" //terminal types TerminalPC = "PC" TerminalMobile = "Mobile" )
设备匹配
View Source
const ( B = 1 KB = 1024 * B MB = 1024 * KB GB = 1024 * MB )
View Source
const ( TimeFormatSecond = "2006-01-02 15:04:05" TimeFormatMinute = "2006-01-02 15:04" TimeFormatDateV1 = "2006-01-02" TimeFormatDateV2 = "2006_01_02" TimeFormatDateV3 = "20060102150405" TimeFormatDateV4 = "2006/01/02 - 15:04:05.000" )
Variables ¶
View Source
var (
Events = make(map[string][]func(interface{}), 2)
)
View Source
var Platform2class = map[string]string{ IOSPlatformStr: TerminalMobile, AndroidPlatformStr: TerminalMobile, MiniWebPlatformStr: WebPlatformStr, WebPlatformStr: WebPlatformStr, WindowsPlatformStr: TerminalPC, OSXPlatformStr: TerminalPC, LinuxPlatformStr: TerminalPC, }
Functions ¶
func EmitAllEvent ¶
func EmitAllEvent(arg interface{})
func Ext ¶
Ext returns the file name extension used by path. The extension is the suffix beginning at the final dot in the final slash-separated element of path; it is empty if there is no dot.
func GetSwitchFromOptions ¶ added in v1.2.0
func GetTodayUnix ¶
func GetTodayUnix() int64
func Int32ToString ¶ added in v1.2.0
func Int64ToString ¶ added in v1.2.0
func IntToString ¶ added in v1.2.0
func InterfaceArrayToStringArray ¶ added in v1.2.0
func InterfaceArrayToStringArray(data []interface{}) (i []string)
func JsonStringToMap ¶ added in v1.2.0
func JsonStringToStruct ¶ added in v1.2.0
The parameter[args] must be a pointer
func MapIntToJsonString ¶ added in v1.2.0
func MapToJsonString ¶ added in v1.2.0
func OffAllEvent ¶
func ParseCmdArguments ¶
func PlatformIDToName ¶ added in v1.2.0
func PlatformNameToClass ¶ added in v1.2.0
func PlatformNameToID ¶ added in v1.2.0
func SetSwitchFromOptions ¶ added in v1.2.0
func StringToInt ¶ added in v1.2.0
func StringToInt32 ¶ added in v1.2.0
func StringToInt64 ¶ added in v1.2.0
func StructToJsonBytes ¶ added in v1.2.0
func StructToJsonBytes(param interface{}) []byte
func StructToJsonString ¶ added in v1.2.0
func StructToJsonString(param interface{}) string
Types ¶
type Disk ¶
type Map ¶ added in v1.2.0
func (*Map) RLockRange ¶ added in v1.2.0
func (m *Map) RLockRange(f func(interface{}, interface{}))
func (*Map) TestAndSet ¶ added in v1.2.0
func (m *Map) TestAndSet(key interface{}, value interface{}) interface{}
func (*Map) UnsafeRange ¶ added in v1.2.0
func (m *Map) UnsafeRange(f func(interface{}, interface{}))
type Os ¶
type Rrm ¶
type Server ¶
type Server struct { Os Os `json:"os"` Cpu Cpu `json:"cpu"` Rrm Rrm `json:"ram"` Disk Disk `json:"disk"` }
func GetServerInfo ¶
type Timer ¶ added in v1.2.0
type Timer interface { AddTaskByFunc(taskName string, spec string, task func()) (cron.EntryID, error) AddTaskByJob(taskName string, spec string, job interface{ Run() }) (cron.EntryID, error) FindCron(taskName string) (*cron.Cron, bool) StartTask(taskName string) StopTask(taskName string) Remove(taskName string, id int) Clear(taskName string) Close() }
func NewTimerTask ¶ added in v1.2.0
func NewTimerTask() Timer
Click to show internal directories.
Click to hide internal directories.