Documentation ¶
Index ¶
- func Bind[T any](r *http.Request) (*T, error)
- func Error(w http.ResponseWriter, code int, message string)
- func ErrorSystem(w http.ResponseWriter)
- func Paginate[T any](r *http.Request, allItems []T) (pagedItems []T, total uint)
- func Success(w http.ResponseWriter, data any)
- type ErrorResponse
- type SuccessResponse
- type UserService
- func (s *UserService) Create(w http.ResponseWriter, r *http.Request)
- func (s *UserService) Delete(w http.ResponseWriter, r *http.Request)
- func (s *UserService) Get(w http.ResponseWriter, r *http.Request)
- func (s *UserService) List(w http.ResponseWriter, r *http.Request)
- func (s *UserService) Update(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse 通用错误响应
type SuccessResponse ¶
SuccessResponse 通用成功响应
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService() *UserService
func (*UserService) Create ¶
func (s *UserService) Create(w http.ResponseWriter, r *http.Request)
func (*UserService) Delete ¶
func (s *UserService) Delete(w http.ResponseWriter, r *http.Request)
func (*UserService) Get ¶
func (s *UserService) Get(w http.ResponseWriter, r *http.Request)
func (*UserService) List ¶
func (s *UserService) List(w http.ResponseWriter, r *http.Request)
func (*UserService) Update ¶
func (s *UserService) Update(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.