Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = NewHttpError(http.StatusNotFound) ErrBadRequest = NewHttpError(http.StatusBadRequest) ErrInternalServerError = NewHttpError(http.StatusInternalServerError) )
Functions ¶
Types ¶
type Error ¶
type Error struct { Code int `json:"code"` Key string `json:"error,omitempty"` Success bool `json:"success"` Message string `json:"message"` Internal error `json:"-"` }
Error 异常结构
func NewHttpError ¶
type Optional ¶ added in v0.3.4
type Optional[T any] struct { // contains filtered or unexported fields }
Optional 定义一个 Optional 类型。
func NewOptional ¶ added in v0.3.4
NewOptional 创建一个新的 Optional 对象。
func (Optional[T]) IfPresent ¶ added in v0.3.4
func (o Optional[T]) IfPresent(consumer func(T))
IfPresent 如果 Optional 对象不为空,则执行给定的消费者。
Click to show internal directories.
Click to hide internal directories.