users

package
v0.0.0-...-1d10f4c Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticate

func Authenticate(c *fasthttp.RequestCtx)

Authenticate ...

func CreateUserHandler

func CreateUserHandler(c *fasthttp.RequestCtx)

CreateUserHandler ...

func EmailExists

func EmailExists(email string) bool

EmailExists checks if user with specified email exists

func EncodePassword

func EncodePassword(p string) string

EncodePassword ...

func HelloHandler

func HelloHandler(c *utils.Client)

HelloHandler ...

func ShowUsersHandler

func ShowUsersHandler(c *fasthttp.RequestCtx)

ShowUsersHandler ...

Types

type User

type User struct {
	ID             int
	FirstName      string
	LastName       string
	Email          string
	Password       string
	PasswordDigest string
	Token          string
	CreatedAt      int
}

User ...

func CreateUser

func CreateUser(u *User) (*User, error)

CreateUser ...

func DecodeJWT

func DecodeJWT(encodedToken string) (u *User, err error)

DecodeJWT ...

func FindUser

func FindUser(ID int) (*User, error)

FindUser finds user by ID

func FindUserByEmail

func FindUserByEmail(email string) (*User, error)

FindUserByEmail finds user by ID

func (*User) GenerateJWT

func (u *User) GenerateJWT() (err error)

GenerateJWT returns JWT token

func (*User) Reload

func (u *User) Reload() *User

Reload returns pointer to recent user data

func (*User) Validate

func (u *User) Validate() map[string][]string

Validate is a method that validates a user's fields

type UserJSON

type UserJSON struct {
	ID        string `json:"id"`
	Email     string `json:"email"`
	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Password  string `json:"password,omitempty"`
	Token     string `json:"token,omitempty"`
	CreatedAt int    `json:"created_at"`
}

UserJSON ...

func NewUserJSON

func NewUserJSON() *UserJSON

NewUserJSON ...

func UserToJSON

func UserToJSON(u *User) *UserJSON

UserToJSON ...

Jump to

Keyboard shortcuts

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