新增 API 文档

This commit is contained in:
2025-05-10 12:48:43 +08:00
parent c987d0cb98
commit a06655ad29
4 changed files with 416 additions and 58 deletions

View File

@@ -6,14 +6,7 @@ import (
"time"
)
// region req
type PageReqInter interface {
GetPage() int
GetSize() int
GetOffset() int
GetLimit() int
}
// region page
type PageReq struct {
RawPage int `json:"page"`
@@ -45,15 +38,6 @@ func (p *PageReq) GetLimit() int {
return p.GetSize()
}
// endregion
// region resp
type ErrResp struct {
Message string `json:"message"`
Error bool `json:"error"`
}
type PageResp struct {
Total int `json:"total"`
Page int `json:"page"`
@@ -144,37 +128,3 @@ func (ldt *LocalDateTime) UnmarshalJSON(b []byte) error {
}
// endregion
// region err
type ServiceErr struct {
code int
name string
msg string
}
func (e ServiceErr) Code() int {
return e.code
}
func (e ServiceErr) Name() string {
return e.name
}
func (e ServiceErr) Error() string {
return e.msg
}
func NewErr(name, msg string, code ...int) *ServiceErr {
_code := 400
if len(code) > 0 {
_code = code[0]
}
return &ServiceErr{
name: name,
msg: msg,
code: _code,
}
}
// endregion