Documentation ¶
Index ¶
- Constants
- Variables
- func AppSettingBool(key string, def bool) bool
- func AppSettingInt(key string, def int) int
- func AppSettingString(key string) string
- func GetCurrentDirectory() string
- func Get_internal() string
- func Md5Sum(file string) string
- func Throw(format string, a ...interface{}) error
- func ToInt(obj interface{}) int
- func ToMap(obj interface{}) map[string]interface{}
- func Try(fun func(), handler CatchHandler)
- type AccessInfo
- type BaseController
- func (c *BaseController) Error(err string)
- func (c *BaseController) FromJson(jsonText string, obj interface{}) error
- func (c *BaseController) IsValid(args interface{}) error
- func (c *BaseController) JsonData(obj interface{})
- func (c *BaseController) JsonDatas(objs []map[string]interface{}, total int, pageIndex int, pageSize int)
- func (c *BaseController) ParseBody(args interface{}) error
- func (c *BaseController) Return() error
- func (c *BaseController) ToJson(obj interface{}) (string, error)
- type BaseModel
- type CatchHandler
- type Dict
- type Resp
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 AppSettingInt ¶
func AppSettingString ¶
func GetCurrentDirectory ¶
func GetCurrentDirectory() string
func Get_internal ¶
func Get_internal() string
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 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 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 契约包装
Click to show internal directories.
Click to hide internal directories.