activity

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 ActVisitAssocService

type ActVisitAssocService interface {
	UpdateNameByActID(ctx context.Context, activityName string, activityID string) error
	IsAssignedActivity(ctx context.Context, activityID string, visitID string) bool
}

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, act types.Activity) (string, error)

Create a activity

func (*MongoRepository) Delete

func (r *MongoRepository) Delete(ctx context.Context, id string) error

Delete a activity

func (*MongoRepository) FindAll

func (r *MongoRepository) FindAll(ctx context.Context) ([]types.Activity, error)

FindAll return all activites

func (*MongoRepository) FindByID

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

FindByID return activity base on given id

func (*MongoRepository) Update

func (r *MongoRepository) Update(ctx context.Context, act types.Activity) error

Update a activity

type Repository

type Repository interface {
	FindByID(ctx context.Context, id string) (*types.Activity, error)
	FindAll(ctx context.Context) ([]types.Activity, error)
	Create(ctx context.Context, act types.Activity) (string, error)
	Update(ctx context.Context, act types.Activity) error
	Delete(ctx context.Context, id string) error
}

Repository is an interface of a activity repository

type Service

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

Service is an activity service

func NewService

func NewService(r Repository, assocService ActVisitAssocService, l glog.Logger) *Service

NewService return a new activity service

func (*Service) Create

func (s *Service) Create(ctx context.Context, act types.Activity) (string, error)

Create a activity

func (*Service) Delete

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

Delete a activity

func (*Service) Get

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

Get return given activity by activity id

func (*Service) GetAll

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

Get All return all activities from database

func (*Service) Update

func (s *Service) Update(ctx context.Context, act types.Activity) error

Update a activity

Jump to

Keyboard shortcuts

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