common

package
v0.0.0-...-f87cf26 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2019 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

*

*

Index

Constants

This section is empty.

Variables

View Source
var DB *sqlx.DB

Functions

func Config

func Config() *configCtrl

regexp return a regexpCtrl对象

func Regexp

func Regexp() *regexpCtrl

regexp return a regexpCtrl对象

func Sess

func Sess() *scs.Manager

func Sql

func Sql() *sqlx.DB

Types

type BaseCtrl

type BaseCtrl struct {
}

func Base

func Base() *BaseCtrl

regexp return a regexpCtrl对象

func (*BaseCtrl) Cache

func (c *BaseCtrl) Cache() *CacheCtrl

Log return a LogCtrl对象

func (*BaseCtrl) Config

func (c *BaseCtrl) Config() *configCtrl

regexp return a regexpCtrl对象

func (*BaseCtrl) DateToTimestamp

func (c *BaseCtrl) DateToTimestamp(date, format string) int64

date转化时间戳

func (*BaseCtrl) FormatUrl

func (c *BaseCtrl) FormatUrl(s string) string

格式化路由

func (*BaseCtrl) Log

func (c *BaseCtrl) Log() *LogCtrl

Log return a LogCtrl对象

func (*BaseCtrl) Md5

func (c *BaseCtrl) Md5(s string) string

func (*BaseCtrl) MultiLanguage

func (c *BaseCtrl) MultiLanguage(str string, value string, field ...string) string

多语言

func (*BaseCtrl) MultiLanguageAddSql

func (c *BaseCtrl) MultiLanguageAddSql(str string, value string, field ...string) string

多语言增加sql

func (*BaseCtrl) Pagination

func (c *BaseCtrl) Pagination(page, row string) int

分页

func (*BaseCtrl) Regexp

func (c *BaseCtrl) Regexp() *regexpCtrl

regexp return a regexpCtrl对象

func (*BaseCtrl) ResponseData

func (c *BaseCtrl) ResponseData(data interface{}, w io.Writer, r *http.Request)

响应数据

func (*BaseCtrl) ResponseJson

func (c *BaseCtrl) ResponseJson(status interface{}, info interface{}, w io.Writer, r *http.Request)

响应json

func (*BaseCtrl) RowsJson

func (c *BaseCtrl) RowsJson(rows interface{}) string

return rows json

func (*BaseCtrl) Sess

func (c *BaseCtrl) Sess() *scs.Manager

func (*BaseCtrl) SetCookie

func (c *BaseCtrl) SetCookie(key string, value string, age int, w http.ResponseWriter)

获取cookie

func (*BaseCtrl) Sha1

func (c *BaseCtrl) Sha1(s string) string

func (*BaseCtrl) Sha1PlusMd5

func (c *BaseCtrl) Sha1PlusMd5(s string) string

Sha1 Plus Md5

func (*BaseCtrl) Sql

func (c *BaseCtrl) Sql() *sqlx.DB

func (*BaseCtrl) TaobaoIP

func (c *BaseCtrl) TaobaoIP(ip string) *IPInfo

func (*BaseCtrl) Template

func (c *BaseCtrl) Template(w io.Writer, r *http.Request, data interface{}, filenames ...string)

func (*BaseCtrl) TimeString

func (c *BaseCtrl) TimeString(r *http.Request, contextName string) string

type CacheCtrl

type CacheCtrl struct {
}

func Cache

func Cache() *CacheCtrl

func (*CacheCtrl) Del

func (c *CacheCtrl) Del(key string)

func (*CacheCtrl) Get

func (c *CacheCtrl) Get(key string) (interface{}, bool)

func (*CacheCtrl) Items

func (c *CacheCtrl) Items() map[string]gocache.Item

func (*CacheCtrl) ScanDel

func (c *CacheCtrl) ScanDel(key string)

func (*CacheCtrl) ScanKey

func (c *CacheCtrl) ScanKey(key string)

func (*CacheCtrl) ScanValue

func (c *CacheCtrl) ScanValue(key string)

func (*CacheCtrl) SetAlwaysTime

func (c *CacheCtrl) SetAlwaysTime(key string, val interface{})

func (*CacheCtrl) SetConfineTime

func (c *CacheCtrl) SetConfineTime(key string, val interface{})

type IP

type IP struct {
	Country string `json:"country"`
	Area    string `json:"area"`
	Region  string `json:"region"`
	City    string `json:"city"`
	Isp     string `json:"isp"`
}

type IPInfo

type IPInfo struct {
	Code int `json:"code"`
	Data IP  `json:"data`
}

type LogCtrl

type LogCtrl struct {
}

LogCtrl is local log object.

func Log

func Log() *LogCtrl

Log return a LogCtrl对象

func (*LogCtrl) CheckErr

func (c *LogCtrl) CheckErr(msg string, err error)

CheckErr check error info

func (*LogCtrl) CheckErrSkip

func (c *LogCtrl) CheckErrSkip(msg string, skip int, err error)

CheckErrSkip check error info,Skip before to function

func (*LogCtrl) Debug

func (c *LogCtrl) Debug() *zerolog.Event

Debug info

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL