users

package
v0.0.0-...-7238798 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UserNotFound       = errors.New("user is not found")
	ErrUserEdit        = errors.New("edit user has failed")
	ErrUserDelete      = errors.New("delete user has failed")
	ErrUserCreate      = errors.New("create user has failed")
	ErrUserExists      = errors.New("user already exists")
	ErrUserGet         = errors.New("get user has failed")
	ErrInvalidPassword = errors.New("invalid password")
)

Functions

This section is empty.

Types

type User

type User struct {
	ID        UserID `db:"id"`
	Username  string `db:"username"`
	Password  string `db:"password"`
	FirstName string `db:"first_name"`
	LastName  string `db:"last_name"`
	Email     string `db:"email"`
	Phone     string `db:"phone"`
}

User - model of user

type UserID

type UserID int64

UserID - surrogate key of the user table

func UserIDFromString

func UserIDFromString(s string) (UserID, error)

UserIDFromString convert string to UserID type

type UserService

type UserService interface {
	Get(UserID) (User, error)
	CheckCredential(string, string) (UserID, error)
	Create(User) (UserID, error)
	Edit(User) error
	Update(User) error
	Delete(UserID) error
}

UserService - service for work with users entities

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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