utils

package
v0.0.0-...-fbedc61 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2019 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Engine *xorm.Engine

Engine xorm

Functions

func AppendFile

func AppendFile(filepath string, content []byte) error

AppendFile func(filepath string, content []byte) error

func CheckAjaxPermission

func CheckAjaxPermission(ajaxfunc string, user string) bool

CheckAjaxPermission func(ajaxfunc string, user string) bool

func CheckURLPermission

func CheckURLPermission(url string, user string) bool

CheckURLPermission func(ajaxfunc string, user string) bool

func Convert2JSON

func Convert2JSON(data interface{}) []byte

Convert2JSON 任意数据类型转JSON

func DecodeGBK2UTF8

func DecodeGBK2UTF8(in []byte) ([]byte, error)

DecodeGBK2UTF8 GBK转UTF8

func FuncCall

func FuncCall(mName string, params ...interface{}) ([]reflect.Value, error)

FuncCall func(mName string, param ...interface{})

func GetAjaxRetJSON

func GetAjaxRetJSON(retcode string, errmsg error) []byte

GetAjaxRetJSON func(retcode string, errmsg error) []byte Get return code and errors Convert to AjaxReturn struct and Marshal to JSON

func GetAjaxRetWithDataJSON

func GetAjaxRetWithDataJSON(retcode string, errmsg error, data interface{}) []byte

GetAjaxRetWithDataJSON func(retcode string, errmsg error, data []byte) []byte Get return message and data Convert to AjaxReturnWithData struct and Marshal to JSON

func GetConfig

func GetConfig(section string, option string) string

GetConfig func(section string, option string) string Return String

func GetConfigInt

func GetConfigInt(section string, option string) int

GetConfigInt func(section string, option string) int Return String

func GetJSONResultFromRequestBody

func GetJSONResultFromRequestBody(reqBody []byte, path string) gjson.Result

GetJSONResultFromRequestBody func(reqBody []byte, path string) gjson.Result

func GetMd5String

func GetMd5String(s string) string

GetMd5String 生成32位MD5字符串

func GetRetMsg

func GetRetMsg(retcode string) string

GetRetMsg func(retcode string) string Get Return Message By Return Code

func GetUniqueID

func GetUniqueID() string

GetUniqueID 生成UID唯一标识

func InitConfig

func InitConfig(path string) error

InitConfig func(path string) error Initialize The Config Global Variable

func InitDB

func InitDB(dbtype string, dbstr string) error

InitDB func() error

func InitFunctionMap

func InitFunctionMap(objs ...interface{})

InitFunctionMap func() 初始化函数映射表

func InitLogger

func InitLogger(path string) error

InitLogger initial a logger by seelog Default config file SeelogCfg = "./config/seelog.xml"

func NewFtpClient

func NewFtpClient(host string, username string, password string) (*ftp.ServerConn, error)

NewFtpClient func(host string, username string, password string) (*ftp.ServerConn, error)

func RandString

func RandString(len int) string

RandString 生成随机字符串

func RandomNumber

func RandomNumber(len int) string

RandomNumber 生成随机数字字符串 不使用time函数

func RandomString

func RandomString(len int) string

RandomString 生成随机字符串 不使用time函数

func ReadJSONData2Array

func ReadJSONData2Array(reqBody []byte, path string) []gjson.Result

ReadJSONData2Array func(reqBody []byte, path string) []gjson.Result

func ReadLines

func ReadLines(filename string) ([]string, error)

ReadLines reads contents from file and splits them by new line. A convenience wrapper to ReadLinesOffsetN(filename, 0, -1).

func ReadLinesOffsetN

func ReadLinesOffsetN(filename string, offset uint, n int) ([]string, error)

ReadLinesOffsetN reads contents from file and splits them by new line. The offset tells at which line number to start. The count determines the number of lines to read (starting from offset):

n >= 0: at most n lines
n < 0: whole file

func ReadRequestBody2JSON

func ReadRequestBody2JSON(reqBody io.ReadCloser) []byte

ReadRequestBody2JSON func(reqBody io.ReadCloser) []byte

func ReflectCall

func ReflectCall(m map[string]interface{}, name string, params ...interface{}) ([]reflect.Value, error)

ReflectCall func(m map[string]interface{}, name string, params ...interface{}) ([]reflect.Value, error)

func SendHXMsg

func SendHXMsg(uuid string, title string, tos string, data string) error

func WriteFile

func WriteFile(filename string, content string) error

WriteFile func(filename string, content string)

func WriteRunLog2File

func WriteRunLog2File(uuid string, content []byte, beginTimeStr string, endTimeStr string) (string, error)

Types

type AjaxReturn

type AjaxReturn struct {
	RetCode string `json:"retcode"`
	RetMsg  string `json:"retmsg"`
}

AjaxReturn struct

func GetAjaxRetObj

func GetAjaxRetObj(retcode string, errmsg error) AjaxReturn

GetAjaxRetObj func(retcode string, errmsg error) AjaxReturn Get return code and errors Convert to AjaxReturn struct object

type AjaxReturnWithData

type AjaxReturnWithData struct {
	AjaxReturn
	RetData interface{} `json:"retdata"`
}

AjaxReturnWithData struct

func GetAjaxRetWithDataObj

func GetAjaxRetWithDataObj(retcode string, errmsg error, data interface{}) AjaxReturnWithData

GetAjaxRetWithDataObj func(retcode string, errmsg error, data []byte) AjaxReturnWithData Get return message and data Convert to AjaxReturnWithData struct object

type FunctionMap

type FunctionMap map[string]reflect.Value

FunctionMap 定义函数映射类型

var FuncMap FunctionMap

FuncMap 声明函数映射

Jump to

Keyboard shortcuts

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