user

package
v0.0.0-...-a4b3353 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("User not found")

	ErrInvalidID = errors.New("ID is not in its proper format")

	ErrAuthenticationFailure = errors.New("Authentication Failed")

	ErrForbidden = errors.New("Attempted action is not allowd")
)

Functions

This section is empty.

Types

type JwtUserToken

type JwtUserToken struct {
	WebUser
	jwt.Claims
}

type JwtUserTokenResponse

type JwtUserTokenResponse struct {
	Token string `json:"token"`
}

type LoginUser

type LoginUser struct {
	UserName string `json:"username"`
	Password string `json:"password"`
}

type NewUser

type NewUser struct {
	Name     string `json:"name" validate:"required"`
	Email    string `json:"email" validate:"required"`
	Password string `json:"password" validate:"required"`
}

type RefreshToken

type RefreshToken struct {
	RefreshToken string `json:"refresh_token"`
}

type User

type User struct {
	ID           string    `db:"user_id" json:"id"`
	Name         string    `db:"name" json:"name"`
	Email        string    `db:"email" json:"email"`
	PasswordHash []byte    `db:"password_hash" json:"-"`
	DateCreated  time.Time `db:"date_created" json:"date_created"`
	DateUpdated  time.Time `db:"date_updated" json:"date_updated"`
}

func Create

func Create(n NewUser, now time.Time) (*User, error)

type WebUser

type WebUser struct {
	ID       string `json:"id"`
	Email    string `json:"email"`
	Username string `json:"username"`
	IsAdmin  string `json:"admin"`
}

Jump to

Keyboard shortcuts

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