visit

package
v0.0.0-...-0eec0e3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActVisitAssocService

type ActVisitAssocService interface {
	DeleteByVisitID(ctx context.Context, visitID string) error
}

type CusVisitAssocService

type CusVisitAssocService interface {
	DeleteByVisitID(ctx context.Context, visitID string) error
}

type MongoRepository

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

MongoRepository is MongoDB implementation of repository

func NewMongoRepository

func NewMongoRepository(s *mgo.Session) *MongoRepository

NewMongoRepository return new MongoDB repository

func (*MongoRepository) Create

func (r *MongoRepository) Create(ctx context.Context, visit types.Visit) (string, error)

Create a visit

func (*MongoRepository) Delete

func (r *MongoRepository) Delete(ctx context.Context, id string) error

Delete a visit

func (*MongoRepository) FindAll

func (r *MongoRepository) FindAll(ctx context.Context) ([]types.Visit, error)

FindAll return all visits

func (*MongoRepository) FindByCustomerID

func (r *MongoRepository) FindByCustomerID(ctx context.Context, customerId string) ([]types.Visit, error)

Find all visits by all customer ID

func (*MongoRepository) FindByID

func (r *MongoRepository) FindByID(ctx context.Context, id string) (*types.Visit, error)

FindByID return customer base on given id

func (*MongoRepository) FindInCommingVisit

func (r *MongoRepository) FindInCommingVisit(ctx context.Context, dayTime int64) ([]types.Visit, error)

Find all imcomming visits by day

func (*MongoRepository) FindVisitsByDay

func (r *MongoRepository) FindVisitsByDay(ctx context.Context, startTime, endTime int64) ([]types.Visit, error)

Find visits from start time to end time

func (*MongoRepository) Update

func (r *MongoRepository) Update(ctx context.Context, visit types.Visit) error

Update a visit

type Repository

type Repository interface {
	FindByID(ctx context.Context, id string) (*types.Visit, error)
	FindAll(ctx context.Context) ([]types.Visit, error)
	FindByCustomerID(ctx context.Context, customerId string) ([]types.Visit, error)
	Create(ctx context.Context, visit types.Visit) (string, error)
	Update(ctx context.Context, visit types.Visit) error
	Delete(ctx context.Context, id string) error
	FindInCommingVisit(ctx context.Context, dayTime int64) ([]types.Visit, error)
	FindVisitsByDay(ctx context.Context, startTime, endTime int64) ([]types.Visit, error)
}

Repository is an interface of a visit repository

type Service

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

Service is an visit service

func NewService

func NewService(r Repository, assocCusService CusVisitAssocService, assocActService ActVisitAssocService, l glog.Logger) *Service

NewService return a new visit service

func (*Service) Create

func (s *Service) Create(ctx context.Context, visit types.Visit) (string, error)

Create a visit

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

Delete a visit

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (*types.Visit, error)

Get return given visit by his/her id

func (*Service) GetAll

func (s *Service) GetAll(ctx context.Context) ([]types.Visit, error)

Get All return all visits from database

func (*Service) GetByCustomerID

func (s *Service) GetByCustomerID(ctx context.Context, customerId string) ([]types.Visit, error)

Get all visits from database by customer ID

func (*Service) Update

func (s *Service) Update(ctx context.Context, visit types.Visit) error

Update a visit

Jump to

Keyboard shortcuts

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