zfx

package
v0.0.0-...-d163873 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserRoles_User = 1 + iota
	UserRoles_Operation
	UserRoles_Manager
)

const (

//User UserRoles = 1 + iota
User = iota
Operation
Manager

)

Variables

View Source
var AbsTime = _absoluteTime{}
View Source
var ApiClient = _apiClient{}
View Source
var Db = _dataAccessLayer{}
View Source
var HttpClient = _httpClient{}
View Source
var JobNumber = _jobNumber{}
View Source
var Log = _logger{}
View Source
var MemoryCache = _memoryCache{}
View Source
var Rbac = _rbac{}

var Json = _jsonUtils{}

Functions

func AppSettingBool

func AppSettingBool(key string, def bool) bool

func AppSettingInt

func AppSettingInt(key string, def int) int

func AppSettingString

func AppSettingString(key string) string

func GetCurrentDirectory

func GetCurrentDirectory() string

func Get_internal

func Get_internal() string

func Md5Sum

func Md5Sum(file string) string

func Throw

func Throw(format string, a ...interface{}) error

func ToInt

func ToInt(obj interface{}) int

func ToMap

func ToMap(obj interface{}) map[string]interface{}
type Person struct {
	Name   string
	Gender bool
	Age    int
}

p := Person{Name: "zhangxx", Gender: true, Age: 35} fmt.Println(p) maps := ToMap(p) fmt.Println(maps)

func Try

func Try(fun func(), handler CatchHandler)

Types

type AccessInfo

type AccessInfo struct {
	LoginName string
	Role      int
	UserLevel int
}

type BaseController

type BaseController struct {
	beego.Controller
}

////////////////////////////////// 控制器基类

func (*BaseController) Error

func (c *BaseController) Error(err string)

////////////////////////////////// Resp 辅助函数

func (*BaseController) FromJson

func (c *BaseController) FromJson(jsonText string, obj interface{}) error

func (*BaseController) IsValid

func (c *BaseController) IsValid(args interface{}) error

////////////////////////////////// 模型验证

func (*BaseController) JsonData

func (c *BaseController) JsonData(obj interface{})

func (*BaseController) JsonDatas

func (c *BaseController) JsonDatas(objs []map[string]interface{}, total int, pageIndex int, pageSize int)

func (*BaseController) ParseBody

func (c *BaseController) ParseBody(args interface{}) error

////////////////////////////////// 反序列化

func (*BaseController) Return

func (c *BaseController) Return() error

func (*BaseController) ToJson

func (c *BaseController) ToJson(obj interface{}) (string, error)

////////////////////////////////// 序列化

type BaseModel

type BaseModel struct {
	//Id            int    `orm:"column(id);auto"`
	UniqueId string `orm:"column(uniqueId);size(20)"`
	AddDate  string `orm:"column(addDate);size(15)"`
	AddTime  string `orm:"column(addTime);size(15)"`
	AddUtc   int    `orm:"column(addUtc)"`
	//AppType       string `orm:"column(appType);size(20)"`
	IsDeleted     uint64 `orm:"column(isDeleted);size(1)"`
	Remark        string `orm:"column(remark);size(255);null"`
	Opatator      string `orm:"column(opatator);size(255);null"`
	LastUpdateUtc int    `orm:"column(lastUpdateUtc)"`
}

////////////////////////////////// 数据模型基类

type CatchHandler

type CatchHandler func(error)

func Catch

func Catch(fun func(error)) CatchHandler

type Dict

type Dict map[string]interface{}

type Resp

type Resp struct {
	// 记录总数
	Total int `json:"total"`
	// 分页上限
	PageMax int `json:"PageMax"`
	// 分页索引
	PageIndex int `json:"pageIndex"`
	// 分页大小
	PageSize int `json:"pageSize"`
	//// 请求内容
	//Request string `json:"Request"`
	// 返回状态
	Status string `json:"Status"`
	// 返回内容
	ResType string `json:"ResType"`
	// 数据
	Data interface{} `json:"Data"`
	// 错误
	Error string `json:"Error"`
}

////////////////////////////////// API 契约包装

Jump to

Keyboard shortcuts

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