16 lines
317 B
Go
16 lines
317 B
Go
|
|
package model
|
||
|
|
|
||
|
|
type Response struct {
|
||
|
|
Code int `json:"code"`
|
||
|
|
Message string `json:"message"`
|
||
|
|
Data any `json:"data,omitempty"`
|
||
|
|
}
|
||
|
|
|
||
|
|
func OK(data any) Response {
|
||
|
|
return Response{Code: 0, Message: "ok", Data: data}
|
||
|
|
}
|
||
|
|
|
||
|
|
func Fail(code int, msg string) Response {
|
||
|
|
return Response{Code: code, Message: msg}
|
||
|
|
}
|