Documentation ¶
Index ¶
- type MongoRepository
- func (r *MongoRepository) Create(ctx context.Context, actVisitAssoc types.ActVisitAssoc) (string, error)
- func (r *MongoRepository) Delete(ctx context.Context, id string) error
- func (r *MongoRepository) DeleteByVisitID(ctx context.Context, visitID string) error
- func (r *MongoRepository) FindAll(ctx context.Context) ([]types.ActVisitAssoc, error)
- func (r *MongoRepository) FindByActID(ctx context.Context, actID string) ([]types.ActVisitAssoc, error)
- func (r *MongoRepository) FindByID(ctx context.Context, id string) (*types.ActVisitAssoc, error)
- func (r *MongoRepository) FindByVisitID(ctx context.Context, visitID string) ([]types.ActVisitAssoc, error)
- func (r *MongoRepository) IsAssignedActivity(ctx context.Context, activityID string, visitID string) bool
- func (r *MongoRepository) Update(ctx context.Context, actVisitAssoc types.ActVisitAssoc) error
- func (r *MongoRepository) UpdateNameByActID(ctx context.Context, activityName string, activityID string) error
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, actVisitAssoc types.ActVisitAssoc) (string, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) DeleteByVisitID(ctx context.Context, visitId string) error
- func (s *Service) Get(ctx context.Context, id string) (*types.ActVisitAssoc, error)
- func (s *Service) GetAll(ctx context.Context) ([]types.ActVisitAssoc, error)
- func (s *Service) GetByActID(ctx context.Context, actID string) ([]types.ActVisitAssoc, error)
- func (s *Service) GetByVisitID(ctx context.Context, visitID string) ([]types.ActVisitAssoc, error)
- func (s *Service) IsAssignedActivity(ctx context.Context, activityID string, visitID string) bool
- func (s *Service) Update(ctx context.Context, actVisitAssoc types.ActVisitAssoc) error
- func (s *Service) UpdateNameByActID(ctx context.Context, activityName string, activityID string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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, actVisitAssoc types.ActVisitAssoc) (string, error)
Create a activity visit associate
func (*MongoRepository) Delete ¶
func (r *MongoRepository) Delete(ctx context.Context, id string) error
Delete a activity visit associate
func (*MongoRepository) DeleteByVisitID ¶
func (r *MongoRepository) DeleteByVisitID(ctx context.Context, visitID string) error
DeleteByVisitID a activity visit associate
func (*MongoRepository) FindAll ¶
func (r *MongoRepository) FindAll(ctx context.Context) ([]types.ActVisitAssoc, error)
FindAll return all activity visit associates
func (*MongoRepository) FindByActID ¶
func (r *MongoRepository) FindByActID(ctx context.Context, actID string) ([]types.ActVisitAssoc, error)
FindByActID return activity visit associate base on given ids
func (*MongoRepository) FindByID ¶
func (r *MongoRepository) FindByID(ctx context.Context, id string) (*types.ActVisitAssoc, error)
FindByID return activity visit associate base on given id
func (*MongoRepository) FindByVisitID ¶
func (r *MongoRepository) FindByVisitID(ctx context.Context, visitID string) ([]types.ActVisitAssoc, error)
FindByVisitID return activity visit associate base on given ids
func (*MongoRepository) IsAssignedActivity ¶
func (r *MongoRepository) IsAssignedActivity(ctx context.Context, activityID string, visitID string) bool
IsAssignedActivity check assigned activity
func (*MongoRepository) Update ¶
func (r *MongoRepository) Update(ctx context.Context, actVisitAssoc types.ActVisitAssoc) error
Update a activity visit associate
func (*MongoRepository) UpdateNameByActID ¶
func (r *MongoRepository) UpdateNameByActID(ctx context.Context, activityName string, activityID string) error
UpdateNameByActID update activity name by activity id
type Repository ¶
type Repository interface { FindByID(ctx context.Context, id string) (*types.ActVisitAssoc, error) FindAll(ctx context.Context) ([]types.ActVisitAssoc, error) FindByVisitID(ctx context.Context, visitID string) ([]types.ActVisitAssoc, error) FindByActID(ctx context.Context, actID string) ([]types.ActVisitAssoc, error) Create(ctx context.Context, actVisitAssoc types.ActVisitAssoc) (string, error) Update(ctx context.Context, actVisitAssoc types.ActVisitAssoc) error Delete(ctx context.Context, id string) error DeleteByVisitID(ctx context.Context, visitID string) error UpdateNameByActID(ctx context.Context, activityName string, activityID string) error IsAssignedActivity(ctx context.Context, activityID string, visitID string) bool }
Repository is an interface of a activity visit repository
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is an activity visit associate service
func NewService ¶
func NewService(r Repository, l glog.Logger) *Service
NewService return a new activity visit associate service
func (*Service) DeleteByVisitID ¶
DeleteByVisitID a activity visit associate
func (*Service) GetByActID ¶
GetByActID return given activity associate by activity id
func (*Service) GetByVisitID ¶
GetByVisitID return given activity associate by visit id
func (*Service) IsAssignedActivity ¶
IsAssignedActivity check activity visit associcate exist