Documentation ¶
Index ¶
- type PostLog
- type Result
- func Error(s int, m string) Result[any]
- func ErrorT[T any](s int, m string) Result[T]
- func Success[T any](data T) Result[T]
- func SuccessPage[T any](data T, page *ResultPage) Result[T]
- func SuccessWithMsg[T any](msg string, data T) Result[T]
- func SuccessWithPage[T any](data T, count, index, size, total int) Result[T]
- func ToAny[T any](result Result[any]) Result[T]
- type ResultPage
- type Timestamp
- func (t Timestamp) GetBSON() (any, error)
- func (t Timestamp) MarshalJSON() ([]byte, error)
- func (t *Timestamp) Scan(v any) error
- func (t *Timestamp) SetBSON(raw bson.Raw) error
- func (t Timestamp) Time() time.Time
- func (t *Timestamp) UnmarshalJSON(data []byte) (err error)
- func (t Timestamp) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PostLog ¶
type PostLog struct { //ID bson.ObjectId `bson:"_id"` Time string `json:"time" bson:"time"` RequestId string `json:"requestId" bson:"requestId"` ResponseTime string `json:"responseTime" bson:"responseTime"` TTL int `json:"ttl" bson:"ttl"` AppName string `json:"appName" bson:"appName"` Apiname string `json:"apiName" bson:"apiName"` Method string `json:"method" bson:"method"` ContentType string `json:"contentType" bson:"contentType"` Uri string `json:"uri" bson:"uri"` ClientIP string `json:"clientIP" bson:"clientIP"` RequestHeader map[string]string `json:"requestHeader" bson:"requestHeader"` RequestParam any `json:"requestParam" bson:"requestParam"` RequestBody any `json:"requestBody" bson:"requestBody"` ResponseStr string `json:"responseStr" bson:"responseStr"` ResponseMap any `json:"responseMap" bson:"responseMap"` }
type Result ¶
type Result[T any] struct { Status int `json:"status" bson:"status"` Msg string `json:"msg" bson:"msg"` Data T `json:"data,omitempty" bson:"data,omitempty"` Page *ResultPage `json:"page,omitempty" bson:"page,omitempty"` }
* 通用返回结果类
func SuccessPage ¶ added in v1.19.18
func SuccessPage[T any](data T, page *ResultPage) Result[T]
func SuccessWithMsg ¶
func SuccessWithPage ¶
type ResultPage ¶
type Timestamp ¶ added in v1.0.7
func NewTimestamp ¶ added in v1.0.7
func (Timestamp) MarshalJSON ¶ added in v1.0.7
MarshalJSON implements json.Marshaler.
func (*Timestamp) UnmarshalJSON ¶ added in v1.0.7
Click to show internal directories.
Click to hide internal directories.