user

package
v0.0.0-...-fd0e660 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Basic = iota + 1
	General
	Admin
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Role

type Role int

type UseCase

type UseCase interface {
	Login(Email string, Pass string) (*User, error)
	Signup(Email string, Pass string, Role int) error
}

type User

type User struct {
	Id    int    `json:"id"`
	Email string `json:"email"`
	Role  int    `json:"role"`
	Pass  string `json:"-"` //ignore this field on encode :)
}

type UserService

type UserService struct {
	DB *sql.DB
}

func NewUserService

func NewUserService(db *sql.DB) *UserService

func (*UserService) Login

func (s *UserService) Login(Email string, Pass string) (*User, error)

func (*UserService) Signup

func (s *UserService) Signup(Email string, Pass string, Role int) error

Jump to

Keyboard shortcuts

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