Documentation ¶
Index ¶
- type MongoRepository
- func (r *MongoRepository) Create(ctx context.Context, giftAssociate types.GiftAssociate) (string, error)
- func (r *MongoRepository) Delete(ctx context.Context, id string) error
- func (r *MongoRepository) DeleteByCusVisitAssocID(ctx context.Context, assignID string) error
- func (r *MongoRepository) FindAll(ctx context.Context) ([]types.GiftAssociate, error)
- func (r *MongoRepository) FindByCusVisitAssocID(ctx context.Context, assignID string) ([]types.GiftAssociate, error)
- func (r *MongoRepository) FindByID(ctx context.Context, id string) (*types.GiftAssociate, error)
- func (r *MongoRepository) IsAssignedGift(ctx context.Context, giftID string, cusvisitassocID string) bool
- func (r *MongoRepository) Update(ctx context.Context, giftAssociate types.GiftAssociate) error
- func (r *MongoRepository) UpdateNameByGiftID(ctx context.Context, giftName string, giftID string) error
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, giftAssociate types.GiftAssociate) (string, error)
- func (s *Service) Delete(ctx context.Context, id string) error
- func (s *Service) DeleteByCusVisitAssocID(ctx context.Context, assignID string) error
- func (s *Service) Get(ctx context.Context, id string) (*types.GiftAssociate, error)
- func (s *Service) GetAll(ctx context.Context) ([]types.GiftAssociate, error)
- func (s *Service) GetByCusVisitAssocID(ctx context.Context, assginID string) ([]types.GiftAssociate, error)
- func (s *Service) IsAssignedGift(ctx context.Context, giftID string, cusvisitassocID string) bool
- func (s *Service) Update(ctx context.Context, giftAssociate types.GiftAssociate) error
- func (s *Service) UpdateNameByGiftID(ctx context.Context, giftName string, giftID 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, giftAssociate types.GiftAssociate) (string, error)
Create a gift associate
func (*MongoRepository) Delete ¶
func (r *MongoRepository) Delete(ctx context.Context, id string) error
Delete a gift associate
func (*MongoRepository) DeleteByCusVisitAssocID ¶
func (r *MongoRepository) DeleteByCusVisitAssocID(ctx context.Context, assignID string) error
DeleteByCusVisitAssocID a gift associate
func (*MongoRepository) FindAll ¶
func (r *MongoRepository) FindAll(ctx context.Context) ([]types.GiftAssociate, error)
FindAll return all gift associates
func (*MongoRepository) FindByCusVisitAssocID ¶
func (r *MongoRepository) FindByCusVisitAssocID(ctx context.Context, assignID string) ([]types.GiftAssociate, error)
FindByCusVisitAssocID return gift associate base on given ids
func (*MongoRepository) FindByID ¶
func (r *MongoRepository) FindByID(ctx context.Context, id string) (*types.GiftAssociate, error)
FindByID return gift associate base on given id
func (*MongoRepository) IsAssignedGift ¶
func (r *MongoRepository) IsAssignedGift(ctx context.Context, giftID string, cusvisitassocID string) bool
IsAssignedGift check assigned gift
func (*MongoRepository) Update ¶
func (r *MongoRepository) Update(ctx context.Context, giftAssociate types.GiftAssociate) error
Update a gift associate
func (*MongoRepository) UpdateNameByGiftID ¶
func (r *MongoRepository) UpdateNameByGiftID(ctx context.Context, giftName string, giftID string) error
UpdateNameByGiftID update gift name by gift id
type Repository ¶
type Repository interface { FindByID(ctx context.Context, id string) (*types.GiftAssociate, error) FindAll(ctx context.Context) ([]types.GiftAssociate, error) FindByCusVisitAssocID(ctx context.Context, assignID string) ([]types.GiftAssociate, error) Create(ctx context.Context, giftAssociate types.GiftAssociate) (string, error) Update(ctx context.Context, giftAssociate types.GiftAssociate) error Delete(ctx context.Context, id string) error DeleteByCusVisitAssocID(ctx context.Context, assignID string) error UpdateNameByGiftID(ctx context.Context, giftName string, giftID string) error IsAssignedGift(ctx context.Context, giftID string, cusvisitassocID string) bool }
Repository is an interface of a gift repository
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is an gift associate service
func NewService ¶
func NewService(r Repository, l glog.Logger) *Service
NewService return a new gift associate service
func (*Service) DeleteByCusVisitAssocID ¶
DeleteByCusVisitAssocID gift associates by asign ID
func (*Service) GetByCusVisitAssocID ¶
func (s *Service) GetByCusVisitAssocID(ctx context.Context, assginID string) ([]types.GiftAssociate, error)
GetByCusVisitAssocID return given gift associate by visit id
func (*Service) IsAssignedGift ¶
IsAssignedGift check gift associcate exist