Documentation ¶
Index ¶
- Constants
- Variables
- func AddEnv(env []string, key string, values []string) []string
- func AmAdmin() bool
- func CheckedScanfln(hint string, checkFunc CheckFunc) string
- func CloseErrorStack()
- func CloseProcess(processname string)
- func Compress(files []*os.File, dest string) error
- func ConvertError(err error) error
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func DeCompress(zipFile, dest string) error
- func DownloadFile(url string, dest string) error
- func GenX509KeyPair() (tls.Certificate, error)
- func GetArrayElemWithDefault(array interface{}, index int, defaultValue interface{}) interface{}
- func GetPathSep() byte
- func GetRPC(method string, id int, RPCparams ...*RPCparam) []byte
- func GetRPCError(code int32, message string, id int) []byte
- func GetRPCLLError(err error, id int) []byte
- func GetRPCResult(result interface{}, id int) []byte
- func GetRPCfromJson(method string, id int, params interface{}) []byte
- func GetRandomID() string
- func GetScanBoolFlag(printstring string, defaultbool bool) bool
- func HttpJsonRespond(w http.ResponseWriter, json *simplejson.Json, httpcode int, errcode int32, ...)
- func HttpJsonStrRespond(w http.ResponseWriter, rootstr string, httpcode int, err error)
- func HttpLLErrorRespond(w http.ResponseWriter, httpcode int, err error)
- func If(condition bool, trueVal, falseVal interface{}) interface{}
- func IntToInt32(num int) (res int32)
- func IsErrorEqual(lerr error, rerr error) bool
- func IsWindows() bool
- func ListenAndServeTLSKeyPair(srv *http.Server, addr string, cert tls.Certificate) error
- func OpenErrorStack()
- func PrintDownloadPercent(done chan int64, path string, total int64)
- func ReadLine() string
- func RunMeElevated(args ...string) error
- func Scanfln() (string, error)
- func Tar(src string, writers ...io.Writer) error
- func Untar(dst string, r io.Reader) error
- func Unzip(src string, dest string) ([]string, error)
- func UploadDir(client *sftp.Client, srcDir, desDir string) (err error)
- func UploadFile(client *sftp.Client, srcFilePath, desDir string) error
- type ApiDetail
- type CheckFunc
- type Crontab
- func (c *Crontab) AddFunc(id string, spec string, f func()) error
- func (c *Crontab) AddJob(id string, spec string, cmd cron.Job) error
- func (c *Crontab) DelByID(id string)
- func (c *Crontab) GetNext(jid string) time.Time
- func (c *Crontab) IDs() []string
- func (c *Crontab) IsExists(jid string) bool
- func (c *Crontab) IsValid(jid string) bool
- func (c *Crontab) Schedule(id string, schedule cron.Schedule, job cron.Job) error
- func (c *Crontab) ScheduleFunc(id string, schedule cron.Schedule, f func()) error
- func (c *Crontab) Start()
- func (c *Crontab) Stop()
- type LLError
- type RPCparam
- type ReadHelper
- type SFTPConnecter
- type SSHConnecter
- type SafeList
Constants ¶
const ( UID = 501 GUID = 100 )
const BriefTimeFormat = "2006-01-02"
const ServerTimeFormat = "2006-01-02T15:04:05.999Z"
Variables ¶
var CronMinuteParser = cron.NewParser(
cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow,
)
var EnvironmentType = []string{
"Development",
"Certification",
"Production",
"Unknown",
}
var Platform = []string{
"ps4",
"pc",
"xbox",
}
Functions ¶
func CheckedScanfln ¶
func CloseErrorStack ¶ added in v0.1.3
func CloseErrorStack()
func CloseProcess ¶
func CloseProcess(processname string)
func ConvertError ¶ added in v0.1.3
func CopyDir ¶
CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination directory must *not* exist. Symlinks are ignored and skipped.
func CopyFile ¶
CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source and the copied data is synced/flushed to stable storage.
func DeCompress ¶
func DownloadFile ¶
func GenX509KeyPair ¶
func GenX509KeyPair() (tls.Certificate, error)
GenX509KeyPair generates the TLS keypair for the server
func GetArrayElemWithDefault ¶
func GetArrayElemWithDefault(array interface{}, index int, defaultValue interface{}) interface{}
func GetPathSep ¶
func GetPathSep() byte
func GetRPCLLError ¶
func GetRPCResult ¶
func GetRPCfromJson ¶
func GetRandomID ¶
func GetRandomID() string
func GetScanBoolFlag ¶
func HttpJsonRespond ¶
func HttpJsonRespond(w http.ResponseWriter, json *simplejson.Json, httpcode int, errcode int32, errmsg string)
func HttpJsonStrRespond ¶ added in v0.1.3
func HttpJsonStrRespond(w http.ResponseWriter, rootstr string, httpcode int, err error)
func HttpLLErrorRespond ¶
func HttpLLErrorRespond(w http.ResponseWriter, httpcode int, err error)
func IntToInt32 ¶
func IsErrorEqual ¶ added in v0.1.3
func ListenAndServeTLSKeyPair ¶
ListenAndServeTLSKeyPair start a server using in-memory TLS KeyPair
func OpenErrorStack ¶ added in v0.1.3
func OpenErrorStack()
func PrintDownloadPercent ¶
func RunMeElevated ¶ added in v0.1.6
Types ¶
type Crontab ¶ added in v0.1.5
type Crontab struct {
// contains filtered or unexported fields
}
Crontab crontab manager
func NewCrontab ¶ added in v0.1.5
NewCrontab new crontab
func (*Crontab) AddJob ¶ added in v0.1.5
AddByID add one crontab task id is unique spec is the crontab expression
func (*Crontab) IsExists ¶ added in v0.1.5
IsExists check the crontab task whether existed with job id
func (*Crontab) ScheduleFunc ¶ added in v0.1.5
type LLError ¶
type LLError struct {
// contains filtered or unexported fields
}
errorString is a trivial implementation of error.
type ReadHelper ¶
type ReadHelper struct {
// contains filtered or unexported fields
}
func NewReadHelper ¶
func NewReadHelper() *ReadHelper
type SFTPConnecter ¶
type SFTPConnecter struct { Client *sftp.Client SSHconnecter *SSHConnecter }
func NewSFTPConnecter ¶
func NewSFTPConnecter(user, password, host string, port int) *SFTPConnecter
func NewSFTPConnecterWithSSH ¶
func NewSFTPConnecterWithSSH(SSHconnecter *SSHConnecter) *SFTPConnecter
func (*SFTPConnecter) Connect ¶
func (self *SFTPConnecter) Connect() error
type SSHConnecter ¶
func NewSSHConnecter ¶
func NewSSHConnecter(user, password, host string, port int) *SSHConnecter
func (*SSHConnecter) Connect ¶
func (self *SSHConnecter) Connect() error
type SafeList ¶
type SafeList struct {
// contains filtered or unexported fields
}