qixiaoning
2025-08-21 e38654fe9eff4562da4f18f8f018aed7879d493c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package serializer
 
 
type Response struct {
    Status int         `json:"status"`
    Data   interface{} `json:"data"`
    Msg    string      `json:"msg"`
    Error  string      `json:"error"`
}
 
 
type DataList struct {
    Items interface{} `json:"items"`
    Total uint        `json:"total"`
}
 
func BuildListResponse(items interface{}, total uint) Response {
    return Response{
        Status: 200,
        Msg:    "ok",
        Data: DataList{
            Items: items,
            Total: total,
        },
    }
}