user

package
v0.0.0-...-d4a8412 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(db *sqlx.DB, router chi.Router)

Types

type User

type User struct {
	ID       string `json:"id,omitempty"`
	Email    string `json:"email,omitempty" validate:"required,email"`
	Password string `json:"password,omitempty"`
	Name     string `json:"name,omitempty" validate:"required,min=3"`
	IsAdmin  bool   `json:"is_admin,omitempty" db:"is_admin"`
}

func (*User) Validate

func (u *User) Validate() error

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

func (*UserRepository) CreateUser

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

CreateUser insert the giver user into database with salted password and return the the inserted user with ID

func (*UserRepository) Delete

func (u *UserRepository) Delete(id string) error

func (*UserRepository) Get

func (u *UserRepository) Get(id string) (User, error)

func (*UserRepository) Update

func (u *UserRepository) Update(user User) error

Jump to

Keyboard shortcuts

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