service

package
v0.0.0-...-0308a11 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IUserService

type IUserService interface {
	GetByID(bson.ObjectId) (*model.User, error)
	DeleteByID(bson.ObjectId) error
	Create(*model.User) error
	FindByIdAndReplace(bson.ObjectId, *model.User) error
	Paginate(options PaginationOptions) ([]*model.User, *odm.PaginationInfo, error)
}

This interface exists only for testing to be mocked for the unit tests

type PaginationOptions

type PaginationOptions struct {
	Query          bson.M
	Page           int
	RecordsPerPage int
}

PaginationOptions defines the parameters to perform pagination on a collection of documents

type User

type User struct {
	Repository repo.IUser
}

func NewUserService

func NewUserService() *User

func (*User) Create

func (s *User) Create(user *model.User) error

func (*User) DeleteByID

func (s *User) DeleteByID(ID bson.ObjectId) error

func (*User) FindByIdAndReplace

func (s *User) FindByIdAndReplace(ID bson.ObjectId, user *model.User) error

func (*User) GetByID

func (s *User) GetByID(ID bson.ObjectId) (*model.User, error)

func (*User) Paginate

func (s *User) Paginate(options PaginationOptions) ([]*model.User, *odm.PaginationInfo, error)

Jump to

Keyboard shortcuts

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