Documentation
¶
Index ¶
- func GetRequestIDFromContext(ctx context.Context) string
- func InArray[T comparable](arr []T, val T) bool
- func Int(in int) *int
- func RemoveDuplicates[T comparable](slice []T) []T
- func String(in string) *string
- func UnmarshalData[T any](data json.RawMessage) (*T, error)
- func ValidateRoleApis(reqApis []int64, total int64, apis []*model.Api) error
- func ValidateRoleIds(reqRoleIds []int64, roles []*model.Role, total int64) error
- type HttpResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRequestIDFromContext ¶
func InArray ¶
func InArray[T comparable](arr []T, val T) bool
func RemoveDuplicates ¶
func RemoveDuplicates[T comparable](slice []T) []T
RemoveDuplicates 是一个泛型去重函数,接受类型为 T 的切片,其中 T 需满足 comparable 约束。 返回去重后的切片,保持原顺序。
func UnmarshalData ¶
func UnmarshalData[T any](data json.RawMessage) (*T, error)
func ValidateRoleApis ¶
Types ¶
type HttpResponse ¶
type HttpResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data json.RawMessage `json:"data"`
}
请求 http 服务返回的通用数据结构
Click to show internal directories.
Click to hide internal directories.