user

package module
v0.0.0-...-0192bcb Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetUsernameByID

func GetUsernameByID(id string) (string, error)

func IsAnyUserRegistered

func IsAnyUserRegistered() (bool, error)

func IsUsernameTaken

func IsUsernameTaken(username string) (bool, error)

func SaveAllUsers

func SaveAllUsers(users []*User) error

Types

type IUser

type IUser interface {
	GetID() string
	GetUsername() string
	GetEncodedPassword() string
	CheckPassword(password string) bool
	Save() error
}

func CheckLogin

func CheckLogin(username string, password string) (IUser, error)

func CreateUser

func CreateUser(username string, password string) (IUser, error)

type User

type User struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	// Encoded Password
	Password string `json:"password"`
}

func GetAllUsers

func GetAllUsers() ([]*User, error)

func (*User) CheckPassword

func (u *User) CheckPassword(password string) bool

func (*User) GetEncodedPassword

func (u *User) GetEncodedPassword() string

func (*User) GetID

func (u *User) GetID() string

func (*User) GetUsername

func (u *User) GetUsername() string

func (*User) Save

func (u *User) Save() error

Jump to

Keyboard shortcuts

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