services

package
v0.0.0-...-c0a108e Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidEmail       = &Error{Code: -1000, Message: "invalid email"}
	ErrInvalidPassword    = &Error{Code: -1001, Message: "invalid password"}
	ErrEmailNotExists     = &Error{Code: -1002, Message: "email doesn't exist"}
	ErrEmailAlreadyExists = &Error{Code: -1003, Message: "email already exists"}
	ErrPasswordMismatch   = &Error{Code: -1004, Message: "password and confirm password must match"}
	ErrInvalidCredentials = &Error{Code: -1005, Message: "invalid credentials"}

	// general api errors
	ErrInvalidArgument     = &Error{Code: -9000, Message: "invalid argument"}
	ErrInternalServerError = &Error{Code: -9001, Message: "internal server error"}
	ErrInvalidLimit        = &Error{Code: -9002, Message: "invalid limit"}
	ErrInvalidPage         = &Error{Code: -9003, Message: "invalid page"}
	ErrSystemError         = &Error{Code: -9004, Message: "system error"}
	ErrPermissionDenied    = &Error{Code: -9005, Message: "permission denied"}
)

Functions

This section is empty.

Types

type Error

type Error struct {
	Code    int
	Message string
}

func ErrorWithMessage

func ErrorWithMessage(e *Error, message string) *Error

func (Error) Error

func (e Error) Error() string

type User

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

User : struct

func NewUserService

func NewUserService(ud *daos.User, conf *config.Config) *User

NewUserService : user dao, config

func (*User) Authenticate

func (u *User) Authenticate(email, password string) (*models.User, error)

Authenticate : email, password

func (*User) FindByID

func (u *User) FindByID(id uint) (*models.User, error)

FindByID : user id

func (*User) Register

func (u *User) Register(firstName, lastName,
	email, password, confirmPassword string) (*models.User, error)

Register : firstName, lastName, email, password, confirmPassword

func (*User) SaveSubscribeEmail

func (u *User) SaveSubscribeEmail(email string, name string, company string) (*models.UserSubscribe, error)

SaveSubscribeEmail : email, name, company

Jump to

Keyboard shortcuts

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