cusvisitassoc

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: 10 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, cusVisitAssoc types.CusVisitAssoc) (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.CusVisitAssoc, error)

FindAll return all activity visit associates

func (*MongoRepository) FindByID

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

FindByID return activity visit associate base on given id

func (*MongoRepository) FindByVisitID

func (r *MongoRepository) FindByVisitID(ctx context.Context, visitID string) ([]types.CusVisitAssoc, error)

FindByVisitID return activity visit associate base on given ids

func (*MongoRepository) IsAssignedCustomer

func (r *MongoRepository) IsAssignedCustomer(ctx context.Context, customerID string, visitID string) bool

IsAssignedCustomer check assigned customer

func (*MongoRepository) Update

func (r *MongoRepository) Update(ctx context.Context, cusVisitAssoc types.CusVisitAssoc) error

Update a activity visit associate

func (*MongoRepository) UpdateNameByCusID

func (r *MongoRepository) UpdateNameByCusID(ctx context.Context, customerName string, customerID string) error

UpdateNameByCusID update customer name by customer id

type Repository

type Repository interface {
	FindByID(ctx context.Context, id string) (*types.CusVisitAssoc, error)
	FindAll(ctx context.Context) ([]types.CusVisitAssoc, error)
	FindByVisitID(ctx context.Context, visitID string) ([]types.CusVisitAssoc, error)
	Create(ctx context.Context, cusVisitAssoc types.CusVisitAssoc) (string, error)
	Update(ctx context.Context, cusVisitAssoc types.CusVisitAssoc) error
	Delete(ctx context.Context, id string) error
	DeleteByVisitID(ctx context.Context, visitID string) error
	UpdateNameByCusID(ctx context.Context, customerName string, customerID string) error
	IsAssignedCustomer(ctx context.Context, customerID string, visitID string) bool
}

Repository is an interface of a customer visit repository

type Service

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

Service is an customer visit associate service

func NewService

func NewService(r Repository, assocRepo giftassociate.Repository, l glog.Logger) *Service

NewService return a new customer visit associate service

func (*Service) Create

func (s *Service) Create(ctx context.Context, cusVisitAssoc types.CusVisitAssoc) (string, error)

Create a customer visit associates

func (*Service) Delete

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

Delete a customer visit associate

func (*Service) DeleteByVisitID

func (s *Service) DeleteByVisitID(ctx context.Context, visitID string) error

DeleteByVisitID a customer visit associate

func (*Service) Get

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

Get return given gift associate by id

func (*Service) GetAll

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

GetAll return all customer visit associates from database

func (*Service) GetByVisitID

func (s *Service) GetByVisitID(ctx context.Context, visitID string) ([]types.CusVisitAssoc, error)

GetByVisitID return given gift associate by visit id

func (*Service) IsAssignedCustomer

func (s *Service) IsAssignedCustomer(ctx context.Context, customerID string, visitID string) bool

IsAssignedCustomer check customer visit associcate exist

func (*Service) Update

func (s *Service) Update(ctx context.Context, cusVisitAssoc types.CusVisitAssoc) error

Update a customer visit associate

func (*Service) UpdateNameByCusID

func (s *Service) UpdateNameByCusID(ctx context.Context, customerName string, customerID string) error

UpdateNameByCusID update customer name by customer id

Jump to

Keyboard shortcuts

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