daos

package
Version: v0.0.0-...-6f676a1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationError

type AuthenticationError struct {
	Reason AuthenticationErrorStatus
}

func (*AuthenticationError) Error

func (a *AuthenticationError) Error() string

type AuthenticationErrorStatus

type AuthenticationErrorStatus string
const (
	USER_NOT_FOUND  AuthenticationErrorStatus = "User not found."
	PASSWORD_FAILED AuthenticationErrorStatus = "Password doesn't match."
)

type DefaultUserDAO

type DefaultUserDAO struct {
	Session *mgo.Session
}

func NewDefaultUserDAO

func NewDefaultUserDAO(session *mgo.Session, encryptionKey string) *DefaultUserDAO

func (*DefaultUserDAO) Authenticate

func (uM *DefaultUserDAO) Authenticate(email string, password string) (retErr *AuthenticationError)

func (*DefaultUserDAO) Create

func (uM *DefaultUserDAO) Create(nUser *webmsgspec.NewUserDTO) (u *models.UserModel, err error)

func (*DefaultUserDAO) Delete

func (uM *DefaultUserDAO) Delete(id bson.ObjectId) error

func (*DefaultUserDAO) Ensures

func (u *DefaultUserDAO) Ensures()

func (*DefaultUserDAO) Find

func (uM *DefaultUserDAO) Find(id bson.ObjectId) (u *models.UserModel, err error)

func (*DefaultUserDAO) FindByEmail

func (uM *DefaultUserDAO) FindByEmail(email string) (u *models.UserModel, err error)

func (*DefaultUserDAO) FindMany

func (uM *DefaultUserDAO) FindMany(query map[string]interface{}, sortBy []string, offset int, limit int) ([]*models.UserModel, error)

func (*DefaultUserDAO) Replace

func (uM *DefaultUserDAO) Replace(updUser *webmsgspec.UpdateUserDTO) (u *models.UserModel, err error)

type UserDAO

type UserDAO interface {
	Find(bson.ObjectId) (*models.UserModel, error)
	FindMany(query map[string]interface{}, sortBy []string, offset int, limit int) ([]*models.UserModel, error)
	Create(*webmsgspec.NewUserDTO) (*models.UserModel, error)
	Replace(*webmsgspec.UpdateUserDTO) (*models.UserModel, error)
	Authenticate(email string, password string) *AuthenticationError
	Delete(bson.ObjectId) error
}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL