user

package
v0.0.0-...-3839eb7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNotFound        = errs.NewI18nError("user.notfound").FallBack("user not found").Code(code.ResourceNotFound)
	ErrUsernameAlreadyUsed = errs.NewI18nError("user.nameUsed").FallBack("username already used")
	ErrEmailAlreadyUsed    = errs.NewI18nError("user.emailUsed").FallBack("email already used")
	ErrUserAlreadyExists   = errs.NewI18nError("user.alreadyExist").FallBack("user already exists")
)
View Source
var (
	RuleUsername = helper.Rules(is.Alphanumeric, vax.RangeLenRune(6, 20))

	RulePassword = helper.Rules(vax.RangeLenRune(10, 30))
)
View Source
var InitialUser = CreateUserOption{
	Username: "dstadmin",
	Email:    "",
	Password: "0123456789",
}

Functions

This section is empty.

Types

type CreateUserOption

type CreateUserOption struct {
	// new username
	Username string `json:"username" example:"jack"`
	// new email
	Email string `json:"email" example:"jack@google.com"`
	// new password
	Password string `json:"password" example:"123456"`
	// new roles
	Roles []string `json:"roles"`
}

func (CreateUserOption) Validate

func (c CreateUserOption) Validate(lang string) error

type Info

type Info struct {
	UUID      string          `json:"uuid" example:"55BBA4ED-18D3-790F-EABF-A5330E527586"`
	Username  string          `json:"username" example:"jack"`
	Email     string          `json:"email" example:"jacklove@lol.com"`
	CreatedAt uint64          `json:"createdAt" example:"947416200"`
	Roles     []role.RoleInfo `json:"roles"`
}

type PageOption

type PageOption struct {
	helper.PageOption
	// specified field
	Order string `json:"order" uri:"order" form:"order" example:"email"`
	// search text, should be of one username or email
	Search string `json:"search" uri:"search" form:"search" example:"jacklove"`
}

func (PageOption) Validate

func (p PageOption) Validate(lang string) error

type SaveUserDetailOption

type SaveUserDetailOption struct {
	UUID string `json:"uuid" example:"55BBA4ED-18D3-790F-EABF-A5330E527586"`
	// new username
	Username string `json:"username" example:"jack"`
	// new email
	Email string `json:"email" example:"jack@google.com"`
	// new password
	Password string `json:"password" example:"123456"`
	// new roles
	Roles []string `json:"roles"`
}

func (SaveUserDetailOption) Validate

func (u SaveUserDetailOption) Validate(lang string) error

type UpdateInfoOption

type UpdateInfoOption struct {
	UUID string `json:"-" swaggerignore:"true" example:"55BBA4ED-18D3-790F-EABF-A5330E527586"`
	// new username
	Username string `json:"username" example:"jack"`
	// new email
	Email string `json:"email" example:"jack@google.com"`
	// new password
	Password string `json:"password" example:"123456"`
}

func (UpdateInfoOption) Validate

func (u UpdateInfoOption) Validate(lang string) error

Jump to

Keyboard shortcuts

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