Documentation
¶
Index ¶
- type ContentType
- type Method
- type MyRequestParams
- type MyRequestResp
- type Params
- func (params *Params) GetCondition() map[string]interface{}
- func (params *Params) GetCount() int64
- func (params *Params) GetError() error
- func (params *Params) GetEtc() map[string]interface{}
- func (params *Params) GetLimit() int
- func (params *Params) GetNewID() uint64
- func (params *Params) GetOffset() int
- func (params *Params) GetOrder() string
- func (params *Params) GetPageNow() int
- func (params *Params) GetPageSize() int
- func (params *Params) GetPreloads() []string
- func (params *Params) GetRawMap() map[string]interface{}
- func (params *Params) GetRow() interface{}
- func (params *Params) GetRows() interface{}
- func (params *Params) GetRowsAffected() int64
- func (params *Params) GetTableName() string
- func (params *Params) GetValue() map[string]interface{}
- func (params *Params) SetCondition(condition map[string]interface{})
- func (params *Params) SetCount(count int64)
- func (params *Params) SetError(err error)
- func (params *Params) SetEtc(data map[string]interface{})
- func (params *Params) SetNewID(newID uint64)
- func (params *Params) SetOrder(order string)
- func (params *Params) SetPageNow(pageNow int)
- func (params *Params) SetPageSize(pageSize int)
- func (params *Params) SetPreloads(preloads []string)
- func (params *Params) SetRawMap(RawMap map[string]interface{})
- func (params *Params) SetRow(rows interface{})
- func (params *Params) SetRows(rows interface{})
- func (params *Params) SetRowsAffected(rowsAffected int64)
- func (params *Params) SetTableName(tableName string)
- func (params *Params) SetValue(value map[string]interface{})
- type ParamsInterface
- type ReadCommonStruct
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentType ¶
type ContentType int8
const ( Query ContentType = 1 BodyJson ContentType = 2 BodyForm ContentType = 3 BodyXML ContentType = 4 XWWWForm ContentType = 5 )
func (ContentType) GetContentTypeStr ¶
func (contentType ContentType) GetContentTypeStr() string
type MyRequestParams ¶
type MyRequestParams struct {
Method Method // 请求方法
URL string // 请求地址
ContentType ContentType
Headers map[string]string // 请求头参数
Params map[string]interface{} // 请求参数
ResStruct interface{} // 要被解析成的结构体
}
MyRequestParams 自己定义的请求体 method networkStruct.Method, contentType networkStruct.ContentType, targetURL string, params map[string]interface{}, headers map[string]string, iStruct interface{}
type MyRequestResp ¶
type MyRequestResp struct {
StatusCode int
Headers http.Header // 返回的请求头
ResStruct interface{} // 解析后的结构体
IsParsedSuccess bool // 是否解析成功
ResStr string // 返回数据字符串化
}
MyRequestResp 自己定义的请求返回 interface{}, *http.Header, int, error
type Params ¶
type Params struct {
// 前端参数
PageNow int `json:"page_now" belong:"etc" default:"1"` // [read]
PageSize int `json:"page_size" belong:"etc" default:"10"` // [read]
Order string `json:"order" belong:"etc" default:"ids asc"` // [read]
// 根据前端参数处理后的数据
Condition map[string]interface{} // [read、update、delete] 条件
Value map[string]interface{} // [update、insert] - 数据
Etc map[string]interface{} // 其他
RawMap map[string]interface{}
// 内部补充参数
Single bool // [read] - 附加条件
Preloads []string // [read] - 附加
TableName string // [update、delete] - 指定表名
// 操作结果
NewID uint64 // [insert] - 新主键
Rows interface{} // [read] - 结构切片
Row interface{} // [read、update、delete、insert] - 结构
Count int64 // [read] - 统计行数
RowsAffected int64 // [update、delete] - 影响行数
Error error // 错误
}
Params 参数结构体
func (*Params) GetCondition ¶
GetCondition 条件
func (*Params) GetPageSize ¶
func (*Params) SetCondition ¶
func (*Params) SetPageNow ¶
func (*Params) SetPageSize ¶
func (*Params) SetPreloads ¶
func (*Params) SetRowsAffected ¶
func (*Params) SetTableName ¶
type ParamsInterface ¶
type ParamsInterface interface {
// order 顺序
GetOrder() string
SetOrder(string)
// page 页码
GetPageSize() int
SetPageSize(int)
GetPageNow() int
SetPageNow(int)
GetLimit() int
GetOffset() int
// [read] - prelaoad 附加
GetPreloads() []string
SetPreloads([]string)
// [read、update、post、delete] - 原始数据
GetRawMap() map[string]interface{}
SetRawMap(map[string]interface{})
// [read、update、delete] - condition 条件
GetCondition() map[string]interface{}
SetCondition(map[string]interface{})
// [read] - rows 查询记录
GetRows() interface{}
SetRows(interface{})
// [read、insert、update、delete] - row
GetRow() interface{}
SetRow(interface{})
// [read] - count 查询数目
GetCount() int64
SetCount(int64)
// error 错误
GetError() error
SetError(error)
// [update、delete] - rows affected 影响行数
GetRowsAffected() int64
SetRowsAffected(int64)
// [update、insert] - value 数据
GetValue() map[string]interface{}
SetValue(map[string]interface{})
// [update、delete] - 表名
GetTableName() string
SetTableName(string)
// [insert] - 新的主键
GetNewID() uint64
SetNewID(newID uint64)
// 其他
GetEtc() map[string]interface{}
SetEtc(data map[string]interface{})
}
ParamsInterface 参数接口
type ReadCommonStruct ¶
type ReadCommonStruct struct {
PageNow int `json:"page_now" belong:"etc" default:"1"`
PageSize int `json:"page_size" belong:"etc" default:"10"`
Order string `json:"order" belong:"etc" default:"id asc"`
}
ReadCommonStruct 读取列表公用的参数
Click to show internal directories.
Click to hide internal directories.