helper

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestIDFromContext

func GetRequestIDFromContext(ctx context.Context) string

func InArray

func InArray[T comparable](arr []T, val T) bool

func Int

func Int(in int) *int

func RemoveDuplicates

func RemoveDuplicates[T comparable](slice []T) []T

RemoveDuplicates 是一个泛型去重函数,接受类型为 T 的切片,其中 T 需满足 comparable 约束。 返回去重后的切片,保持原顺序。

func String

func String(in string) *string

func UnmarshalData

func UnmarshalData[T any](data json.RawMessage) (*T, error)

func ValidateRoleApis

func ValidateRoleApis(reqApis []int64, total int64, apis []*model.Api) error

func ValidateRoleIds

func ValidateRoleIds(reqRoleIds []int64, roles []*model.Role, total int64) error

Types

type HttpResponse

type HttpResponse struct {
	Code int             `json:"code"`
	Msg  string          `json:"msg"`
	Data json.RawMessage `json:"data"`
}

请求 http 服务返回的通用数据结构

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL