Documentation ¶
Overview ¶
Copyright 2015 gophper.
Licensed under the Apache License, Version 2.0 (the "License"): you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func CreatePid()
- func DelFile(files []os.FileInfo, count int, fileDir string)
- func FileGetContent(file string) (string, error)
- func FileMTime(file string) (int64, error)
- func FilePutContent(file string, content string) (int, error)
- func FileSize(file string) (int64, error)
- func GetInt64Str(d int64) string
- func GetIntStr(d int) string
- func GetIpMask(start, end string) string
- func GetStrFloat64(s string) float64
- func GetStrInt(d string) int
- func GetStrInt64(d string) int64
- func GetStrUint(d string) uint
- func GetStrUint32(d string) uint32
- func GetStrUint64(d string) uint64
- func GetTimeAgo(t int64) (s string)
- func GetUint64Str(d uint64) string
- func GetUintStr(d uint) string
- func Help()
- func Ip2long(ipstr string) (ip uint32)
- func IsExist(path string) bool
- func IsFile(file string) bool
- func IsPrivateIP(ip string) bool
- func Long2ip(ip uint32) string
- func Md5(key string) string
- func Mkdir(src string) error
- func NewXorm(opt *OrmOption) (orm *xorm.Engine, err error)
- func Remove(file string) error
- func RemoveAll(path string) error
- func Rename(file string, to string) error
- func SignalHandle(funcs map[string]interface{})
- func Version() string
- type BaseLog
- func (l *BaseLog) Critical(v ...interface{})
- func (l *BaseLog) Criticalf(format string, v ...interface{})
- func (l *BaseLog) Debug(v ...interface{})
- func (l *BaseLog) Debugf(format string, v ...interface{})
- func (l *BaseLog) Error(v ...interface{})
- func (l *BaseLog) Errorf(format string, v ...interface{})
- func (l *BaseLog) Info(v ...interface{})
- func (l *BaseLog) Infof(format string, v ...interface{})
- func (l *BaseLog) Panic(v ...interface{})
- func (l *BaseLog) Panicf(format string, v ...interface{})
- func (l *BaseLog) Printf(format string, v ...interface{})
- func (l *BaseLog) Println(v ...interface{})
- func (l *BaseLog) Trace(v ...interface{})
- func (l *BaseLog) Tracef(format string, v ...interface{})
- func (l *BaseLog) Warn(v ...interface{})
- func (l *BaseLog) Warnf(format string, v ...interface{})
- type Cache
- type FileRepos
- type GoConfig
- func (c *GoConfig) Array(key string) ([]interface{}, error)
- func (c *GoConfig) Bool(key string, def bool) (bool, error)
- func (c *GoConfig) Float64(key string, def float64) (float64, error)
- func (c *GoConfig) Int(key string, def int) (int, error)
- func (c *GoConfig) Int64(key string, def int64) (int64, error)
- func (c *GoConfig) Map(key string) (map[string]interface{}, error)
- func (c *GoConfig) ReloadConfig() error
- func (c *GoConfig) String(key string, def string) (string, error)
- type IpNetmask
- type LogOptions
- type MailMessage
- type Mailer
- type ModelOption
- type Models
- type Object
- type OrmOption
- type Redis
- func (self *Redis) GetRedisKey(keys ...interface{}) (key string)
- func (self *Redis) RedisDelete(keys ...interface{}) (bool, error)
- func (self *Redis) RedisDeleteAll(keys ...interface{}) (s bool, err error)
- func (self *Redis) RedisExists(keys ...interface{}) (bool, error)
- func (self *Redis) RedisGet(keys ...interface{}) (value []byte, err error)
- func (self *Redis) RedisGetJson(v interface{}, keys ...interface{}) (err error)
- func (self *Redis) RedisIncr(keys ...interface{}) (int64, error)
- func (self *Redis) RedisSet(expire int64, value interface{}, keys ...interface{}) (err error)
- func (self *Redis) RedisSetJson(expire int64, mp interface{}, keys ...interface{}) (err error)
- type RedisOption
- type Repository
- type Smtp
Constants ¶
const ( LevelCritical = iota LevelError LevelWarning LevelInfo LevelDebug LevelTrace )
Log levels to control the logging output.
Variables ¶
var ( CacheTable = NewCache() ErrTimeOut error = errors.New("The cache has been timeout.") ErrKeyNotFound error = errors.New("The key was not found.") ErrTypeAssertion error = errors.New("Type assertion error.") )
var ( // 日志 Log *BaseLog //配置文件 Config *GoConfig SigHandler = make(map[string]interface{}) )
Functions ¶
func FilePutContent ¶
put string to file
func GetInt64Str ¶
func GetStrFloat64 ¶
func GetStrInt64 ¶
func GetStrUint ¶
func GetTimeAgo ¶
func GetUint64Str ¶
func GetUintStr ¶
func RemoveAll ¶
RemoveAll删除path指定的文件,或目录及它包含的任何下级对象。它会尝试删除所有东西,除非遇到错误并返回。 如果path指定的对象不存在,RemoveAll会返回nil而不返回错误。
func SignalHandle ¶
func SignalHandle(funcs map[string]interface{})
Types ¶
type FileRepos ¶
type FileRepos []Repository
type IpNetmask ¶
type LogOptions ¶
type MailMessage ¶
type MailMessage struct { From mail.Address // if From.Address is empty, Config.DefaultFrom will be used To []mail.Address Cc []mail.Address Bcc []mail.Address Subject string Content string S *Smtp }
func (*MailMessage) Send ¶
func (self *MailMessage) Send() error
func (*MailMessage) String ¶
func (self *MailMessage) String() string
http://tools.ietf.org/html/rfc822 http://tools.ietf.org/html/rfc2821
type ModelOption ¶
type ModelOption struct { Orm OrmOption Redis RedisOption }
type Models ¶
type Models struct { Orm *xorm.Engine OrmCache bool OrmCacheTime int64 Redis *Redis RedisEnable bool RedisPrefix string Driver string }
var Dbh *Models
func NewDefaultModels ¶
func NewModels ¶
func NewModels(opt *ModelOption) (*Models, error)
type Redis ¶
func NewRedis ¶
func NewRedis(opt *RedisOption) (*Redis, error)
func (*Redis) GetRedisKey ¶
func (*Redis) RedisDelete ¶
func (*Redis) RedisDeleteAll ¶
func (*Redis) RedisExists ¶
func (*Redis) RedisGetJson ¶
func (*Redis) RedisSetJson ¶
type RedisOption ¶
type Repository ¶
type Smtp ¶
type Smtp struct { SmtpUserName string SmtpHost, SmtpUser, SmtpPassword string SmtpPort int SmtpAuth, SmtpTLS, SmtpDaemon bool // contains filtered or unexported fields }
SMTP setup
func (*Smtp) MailSender ¶
func (*Smtp) NewMailMessage ¶
func (s *Smtp) NewMailMessage(m *Mailer) *MailMessage