Documentation ¶
Index ¶
- Variables
- type TaskRepository
- func (s *TaskRepository) CloseClients()
- func (s *TaskRepository) CreateTask(task *util.Task) error
- func (s *TaskRepository) DropIndices() error
- func (s *TaskRepository) EnsureIndices() error
- func (s *TaskRepository) GetTask(id string) (*util.Task, error)
- func (s *TaskRepository) Indices() []infra.Index
- func (s *TaskRepository) List(v map[string]interface{}, startTime, endTime *time.Time, skip, limit int) ([]*util.Task, error)
- func (s *TaskRepository) ListByStatusBefore(status util.Status, t time.Time, skip, limit int) ([]*util.Task, error)
- func (s *TaskRepository) ListCountDateRangeInterval(startTime, endTime time.Time, interval int) ([]util.TaskDateRangeCount, error)
- func (s *TaskRepository) UpdateRetryCount(id string, count int)
- func (s *TaskRepository) UpdateTaskStatus(ctx context.Context, id string, status util.Status, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTaskNotFound = errors.New("mongo: task not found") ErrMongoNoConnection = errors.New("mongo: no connection") ErrRedisNoConnection = errors.New("redis: no connection") ErrErrorRequired = errors.New("error message required") ErrDurationRequired = errors.New("task duration required") )
List of repo related errors
Functions ¶
This section is empty.
Types ¶
type TaskRepository ¶
type TaskRepository struct { RedisConn *infra.RedisClient MongoConn *infra.MongoClient // contains filtered or unexported fields }
TaskRepository contain necessary fields
func NewTaskRepo ¶
func NewTaskRepo(redisCon *infra.RedisClient, mgoCon *infra.MongoClient) *TaskRepository
NewTaskRepo return a new TaskRepository instance
func (*TaskRepository) CloseClients ¶
func (s *TaskRepository) CloseClients()
CloseClients close connection
func (*TaskRepository) CreateTask ¶
func (s *TaskRepository) CreateTask(task *util.Task) error
CreateTask create a task object both in redis and mongo
func (*TaskRepository) DropIndices ¶
func (s *TaskRepository) DropIndices() error
DropIndices drop all the listed indices
func (*TaskRepository) EnsureIndices ¶
func (s *TaskRepository) EnsureIndices() error
EnsureIndices ensure listed indices
func (*TaskRepository) GetTask ¶
func (s *TaskRepository) GetTask(id string) (*util.Task, error)
GetTask return a id from redis
func (*TaskRepository) Indices ¶
func (s *TaskRepository) Indices() []infra.Index
Indices are indices
func (*TaskRepository) List ¶
func (s *TaskRepository) List(v map[string]interface{}, startTime, endTime *time.Time, skip, limit int) ([]*util.Task, error)
List send a task list
func (*TaskRepository) ListByStatusBefore ¶
func (s *TaskRepository) ListByStatusBefore(status util.Status, t time.Time, skip, limit int) ([]*util.Task, error)
ListByStatusBefore fetch a task list before time t
func (*TaskRepository) ListCountDateRangeInterval ¶
func (s *TaskRepository) ListCountDateRangeInterval(startTime, endTime time.Time, interval int) ([]util.TaskDateRangeCount, error)
ListCountDateRangeInterval send a bucket list
func (*TaskRepository) UpdateRetryCount ¶
func (s *TaskRepository) UpdateRetryCount(id string, count int)
UpdateRetryCount update task retry count field
func (*TaskRepository) UpdateTaskStatus ¶
func (s *TaskRepository) UpdateTaskStatus(ctx context.Context, id string, status util.Status, args ...interface{})
UpdateTaskStatus update the task status
Click to show internal directories.
Click to hide internal directories.