user_plugin

package
v0.0.0-...-ea214e1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminIndexAction

func AdminIndexAction(c *gin.Context)

func CheckAdmin

func CheckAdmin(authToken string) bool

func CreateAction

func CreateAction(c *gin.Context)

func IndexAction

func IndexAction(c *gin.Context)

func LoginAction

func LoginAction(c *gin.Context)

func LoginAdminAction

func LoginAdminAction(c *gin.Context)

func Routes

func Routes(r *gin.RouterGroup)

func ToggleFollowAction

func ToggleFollowAction(c *gin.Context)

Types

type CreateParams

type CreateParams struct {
	Nickname string `json:"nickname"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginAdminParams

type LoginAdminParams struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type LoginParams

type LoginParams struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type ToggleFollowParams

type ToggleFollowParams struct {
	UserId int64 `form:"id"`
}

type User

type User struct {
	Id int64

	Nickname          string
	Username          string
	Phone             string
	Email             string
	Avatar            string
	Role              UserRole
	ApiToken          string
	EncryptedPassword string

	CreatedAt time.Time
	UpdatedAt time.Time
}

func CreateUser

func CreateUser(nickname, username string, role UserRole, password string) (*User, error)

func CurrentAdmin

func CurrentAdmin(authToken string) *User

func CurrentUser

func CurrentUser(authToken string) *User

func LoginAdmin

func LoginAdmin(username string, password string) (*User, error)

func LoginUser

func LoginUser(username string, password string) (*User, error)

func (*User) RelId

func (u *User) RelId() int64

func (*User) RelType

func (u *User) RelType() string

func (User) TableName

func (u User) TableName() string

type UserResp

type UserResp struct {
	Id        int64
	Nickname  string
	Username  string
	ApiToken  string
	Role      UserRole
	CreatedAt utils.Timestamp
	UpdatedAt utils.Timestamp
}

func (UserResp) Fields

func (ur UserResp) Fields() []string

type UserRole

type UserRole int
const (
	BasicRole UserRole = iota
	AdminRole
)

Jump to

Keyboard shortcuts

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