giftassociate

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: 8 Imported by: 0

Documentation

Index

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) Create

func (s *Service) Create(ctx context.Context, giftAssociate types.GiftAssociate) (string, error)

Create a gift associates

func (*Service) Delete

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

Delete a gift associate

func (*Service) DeleteByCusVisitAssocID

func (s *Service) DeleteByCusVisitAssocID(ctx context.Context, assignID string) error

DeleteByCusVisitAssocID gift associates by asign ID

func (*Service) Get

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

Get return given gift associate by id

func (*Service) GetAll

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

GetAll return all gift associates from database

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

func (s *Service) IsAssignedGift(ctx context.Context, giftID string, cusvisitassocID string) bool

IsAssignedGift check gift associcate exist

func (*Service) Update

func (s *Service) Update(ctx context.Context, giftAssociate types.GiftAssociate) error

Update a gift associate

func (*Service) UpdateNameByGiftID

func (s *Service) UpdateNameByGiftID(ctx context.Context, giftName string, giftID string) error

UpdateNameByGiftID update gift name by gift id

Jump to

Keyboard shortcuts

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