Documentation
¶
Index ¶
- func ApplyProfileUpdates(user *model.User, req *model.UpdateProfileReq)
- func BuildUserForCreate(req *model.UserSignUpReq, hashedPassword string) *model.User
- func ComparePassword(hashedPassword, rawPassword string) error
- func ExtractClaims(ctx *gin.Context) (pkgutils.UserClaims, error)
- func FormatBytes(bytes uint64, unit string) string
- func GetDiskUsagePercentage(s *model.System) float64
- func GetMemoryUsagePercentage(s *model.System) float64
- func GetUptimeFormatted(s *model.System) string
- func HashPassword(password string) (string, error)
- func RequireNonEmpty(value, field string) error
- func RequirePositiveID(id int, field string) error
- func ToResponse(s *model.System) *model.SystemInfoResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyProfileUpdates ¶ added in v0.0.21
func ApplyProfileUpdates(user *model.User, req *model.UpdateProfileReq)
ApplyProfileUpdates 应用可编辑的用户资料字段
func BuildUserForCreate ¶ added in v0.0.21
func BuildUserForCreate(req *model.UserSignUpReq, hashedPassword string) *model.User
BuildUserForCreate 将注册请求转换为可持久化的用户实体
func ComparePassword ¶ added in v0.0.21
ComparePassword 对比明文密码与密文密码
func ExtractClaims ¶ added in v0.0.21
func ExtractClaims(ctx *gin.Context) (pkgutils.UserClaims, error)
ExtractClaims 从 gin 上下文安全提取登录用户信息
func GetDiskUsagePercentage ¶
GetDiskUsagePercentage 获取磁盘使用率百分比
func GetMemoryUsagePercentage ¶
GetMemoryUsagePercentage 获取内存使用率百分比
func GetUptimeFormatted ¶
GetUptimeFormatted 获取格式化的运行时间
func HashPassword ¶ added in v0.0.21
HashPassword 对密码进行统一校验与加密
func RequireNonEmpty ¶ added in v0.0.21
RequireNonEmpty 校验字符串是否为空
func RequirePositiveID ¶ added in v0.0.21
RequirePositiveID 校验 ID 是否大于零
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.