Documentation
¶
Index ¶
- func Errorf(format string, args ...any) error
- func NewRoute(cfg contracts.Config, validator contracts.Validation, ...) (contracts.Route, error)
- type Response
- func (r *Response) Build(status int, code int, message string, data any) error
- func (r *Response) Created(data any, message ...string) error
- func (r *Response) Download(file string, name string, disk ...string) error
- func (r *Response) Fail(status int, message string, code ...int) error
- func (r *Response) File(file string, disk ...string) error
- func (r *Response) Forbidden(message ...string) error
- func (r *Response) Json(status int, data any, message ...string) error
- func (r *Response) NotFound(message ...string) error
- func (r *Response) Paginate(list any, total int64, page int, size int, message ...string) error
- func (r *Response) String(s string) error
- func (r *Response) Success(data any, message ...string) error
- func (r *Response) Unauthorized(message ...string) error
- func (r *Response) Validation(err error, message ...string) error
- type ServiceProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Response ¶
type Response struct {
Code int `json:"code"`
Message string `json:"message"`
Data any `json:"data,omitempty"`
// contains filtered or unexported fields
}
Response 是 GoFast 标准 JSON 响应结构。 它实现了 contracts.Response,可通过 ctx.Response() 获取并直接发送。
func (*Response) Unauthorized ¶
Unauthorized 快速返回未授权响应(HTTP 401)。
type ServiceProvider ¶
type ServiceProvider struct{}
ServiceProvider HTTP 路由服务提供者。
func (*ServiceProvider) Boot ¶
func (sp *ServiceProvider) Boot(app foundation.Application) error
func (*ServiceProvider) Register ¶
func (sp *ServiceProvider) Register(app foundation.Application)
Click to show internal directories.
Click to hide internal directories.