Documentation ¶
Index ¶
- Constants
- Variables
- func CreateMongodbSessionList() []*mgo.Session
- func GetCurrentPath() string
- func InitConfig(filename string) (err error)
- func InitMailConnect() *gomail.Dialer
- func SelfPath() string
- func Testing()
- type ComConfig
- type Config
- type DbDialect
- func (m *DbDialect) Count(bean ...interface{}) (int64, error)
- func (m *DbDialect) Find(bean ...interface{}) error
- func (m *DbDialect) FindBySql(sql string, items []interface{}) error
- func (m *DbDialect) GetById(id int, item interface{}) (bool, error)
- func (m *DbDialect) Insert(bean ...interface{}) (int64, error)
- func (m *DbDialect) Limit(limit int) *xorm.Session
- func (m *DbDialect) OrderBy(order string) *xorm.Session
- func (m *DbDialect) Select(str string) *xorm.Session
- func (m *DbDialect) UpdateById(id int, item interface{}) (int64, error)
- func (m *DbDialect) Where(query interface{}, args ...interface{}) *xorm.Session
- type DbEngine
- type Logger
- type Mail
- type Mongodb
- type MongodbConfig
- type MysqlConfig
- type RedisConfig
- type RedisDialect
- type SPool
- type Session
- type Tooler
- func (t *Tooler) ConvInt2Str(str int) string
- func (t *Tooler) ConvStr2Int(str string) int
- func (t *Tooler) CreateDir(dir string)
- func (t *Tooler) Exist(filename string) bool
- func (t *Tooler) FileExists(path string) bool
- func (t *Tooler) GetCurrentPath() string
- func (t *Tooler) GetExecDir() string
- func (t *Tooler) GetRootPath() string
- func (t *Tooler) GrepFile(patten string, filename string) (lines []string, err error)
- func (t *Tooler) JsonDecode(data string, v interface{}) error
- func (t *Tooler) JsonEncode(v interface{}) (string, error)
- func (t *Tooler) MathDecimal(value float64) float64
- func (t *Tooler) PrintType(s interface{})
- func (t *Tooler) PrintVal(s interface{})
- func (t *Tooler) ReadFile(fileName string) (data []byte)
- func (t *Tooler) RequestGet(url string) string
- func (t *Tooler) RequestPostForm(url string, json_input interface{}) (string, *http.Response, []error)
- func (t *Tooler) RequestPostJson(url string, json_input interface{}) (string, *http.Response, []error)
- func (t *Tooler) SelfDir() string
- func (t *Tooler) WriteFile(filename string, data string) bool
- type WPool
- type WorkerInterface
Constants ¶
View Source
const ( GENV_CONST_DEV = "dev" GENV_CONST_PROD = "prod" )
View Source
const Host = "smtp.exmail.qq.com"
View Source
const Pass = "Chen7110363"
View Source
const Port = 465
View Source
const User = "chenweijie@mafengwo.com"
连接信息
Variables ¶
View Source
var ( GMysql *DbEngine GModel *DbDialect GRedis redis.Conn GMongodb Mongodb GMail Mail Env string Debug bool )
View Source
var (
MailEngine *gomail.Dialer
)
Functions ¶
func CreateMongodbSessionList ¶ added in v1.0.1
func CreateMongodbSessionList() []*mgo.Session
创建mongodb连接池
func GetCurrentPath ¶
func GetCurrentPath() string
Types ¶
type Config ¶
type Config struct { Common ComConfig Mysql MysqlConfig Redis RedisConfig Mongodb MongodbConfig }
程序配置
var ( // 单例 GConfig *Config )
type DbDialect ¶
type DbDialect struct{}
var MysqlDialect *DbDialect
提供封装的方式,保证调用风格统一
func (*DbDialect) UpdateById ¶
type DbEngine ¶
var ( //通用模式,可以调用xorm底层方法 MysqlEngine *DbEngine )
func CreateMysqlDialect ¶
func CreateMysqlDialect() *DbEngine
type MongodbConfig ¶ added in v1.0.1
type MysqlConfig ¶
type RedisConfig ¶
type RedisDialect ¶
type RedisDialect struct{}
func (*RedisDialect) Get ¶
func (m *RedisDialect) Get(key string) (reply interface{}, err error)
func (*RedisDialect) RegisterDbConn ¶
func (m *RedisDialect) RegisterDbConn()
type SPool ¶
type SPool struct { TotalNum int Counter int CounterFail int TimeStart int64 TimeOut int MaxGoroutines int // contains filtered or unexported fields }
/共享协程池
type Tooler ¶
type Tooler struct{}
var Tool *Tooler
func (*Tooler) ConvInt2Str ¶
func (*Tooler) ConvStr2Int ¶
func (*Tooler) FileExists ¶
FileExists reports whether the named file or directory exists. 判断所给路径文件/文件夹是否存在
func (*Tooler) GetCurrentPath ¶
func (*Tooler) GetExecDir ¶
func (*Tooler) GrepFile ¶
GrepFile like command grep -E for example: GrepFile(`^hello`, "hello.txt") \n is striped while read
func (*Tooler) JsonDecode ¶
func (*Tooler) RequestPostForm ¶
func (*Tooler) RequestPostJson ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
test/context
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes.
|
Package context defines the Context type, which carries deadlines, cancelation signals, and other request-scoped values across API boundaries and between processes. |
internal
|
|
Click to show internal directories.
Click to hide internal directories.