Documentation ¶
Index ¶
- type ActVisitAssocService
- type CusVisitAssocService
- type MongoRepository
- func (r *MongoRepository) Create(ctx context.Context, visit types.Visit) (string, error)
- func (r *MongoRepository) Delete(ctx context.Context, id string) error
- func (r *MongoRepository) FindAll(ctx context.Context) ([]types.Visit, error)
- func (r *MongoRepository) FindByCustomerID(ctx context.Context, customerId string) ([]types.Visit, error)
- func (r *MongoRepository) FindByID(ctx context.Context, id string) (*types.Visit, error)
- func (r *MongoRepository) FindInCommingVisit(ctx context.Context, dayTime int64) ([]types.Visit, error)
- func (r *MongoRepository) FindVisitsByDay(ctx context.Context, startTime, endTime int64) ([]types.Visit, error)
- func (r *MongoRepository) Update(ctx context.Context, visit types.Visit) error
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, visit types.Visit) (string, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) Get(ctx context.Context, id string) (*types.Visit, error)
- func (s *Service) GetAll(ctx context.Context) ([]types.Visit, error)
- func (s *Service) GetByCustomerID(ctx context.Context, customerId string) ([]types.Visit, error)
- func (s *Service) Update(ctx context.Context, visit types.Visit) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActVisitAssocService ¶
type CusVisitAssocService ¶
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) Delete ¶
func (r *MongoRepository) Delete(ctx context.Context, id string) error
Delete a visit
func (*MongoRepository) FindByCustomerID ¶
func (r *MongoRepository) FindByCustomerID(ctx context.Context, customerId string) ([]types.Visit, error)
Find all visits by all customer 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
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) GetByCustomerID ¶
Get all visits from database by customer ID
Click to show internal directories.
Click to hide internal directories.