services

package
v0.0.0-...-5ccaff2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MillisecondInterval

func MillisecondInterval(interval time.Duration) int64

func SetDBConfig

func SetDBConfig() string

func Setup

func Setup(pathToFile string, db *DataBase)

func StateCodeToWeekDay

func StateCodeToWeekDay(stateCode int) time.Weekday

func StrToWeekday

func StrToWeekday(strWeekday string) (time.Weekday, error)

func ToDuration

func ToDuration(millisecondInterval int64) time.Duration

func WeekdayToStr

func WeekdayToStr(weekday time.Weekday) string

Types

type DataBase

type DataBase struct {
	*sql.DB
}

func NewDB

func NewDB(dbSourceName string) (*DataBase, error)

func (*DataBase) AddFastTask

func (db *DataBase) AddFastTask(fastTask models.FastTask) error

func (*DataBase) AddScheduleTask

func (db *DataBase) AddScheduleTask(scheduleTask models.ScheduleTask) error

func (*DataBase) AddUser

func (db *DataBase) AddUser(user models.User) error

func (*DataBase) ClearAll

func (db *DataBase) ClearAll(assigneeId int) error

func (*DataBase) DeleteFastTask

func (db *DataBase) DeleteFastTask(ftId int) error

func (*DataBase) DeleteScheduleTask

func (db *DataBase) DeleteScheduleTask(schId int) error

func (*DataBase) DeleteScheduleWeek

func (db *DataBase) DeleteScheduleWeek(assigneeId int, weekday time.Weekday) error

func (*DataBase) GetAllFastTasks

func (db *DataBase) GetAllFastTasks() ([]models.FastTask, error)

func (*DataBase) GetFastTasks

func (db *DataBase) GetFastTasks(assigneeId int) ([]models.FastTask, error)

func (*DataBase) GetSchedule

func (db *DataBase) GetSchedule(assigneeId int, weekday time.Weekday) ([]models.ScheduleTask, error)

func (*DataBase) GetUser

func (db *DataBase) GetUser(userId int) (models.User, error)

func (*DataBase) GetUsers

func (db *DataBase) GetUsers() ([]models.User, error)

func (*DataBase) UpdateFastTasks

func (db *DataBase) UpdateFastTasks(fastTasks []models.FastTask) error

func (*DataBase) UpdateScheduleTask

func (db *DataBase) UpdateScheduleTask(scheduleTask models.ScheduleTask) error

func (*DataBase) UpdateState

func (db *DataBase) UpdateState(user models.User) error

type Datastore

type Datastore interface {
	// User.
	AddUser(user models.User) error
	GetUsers() ([]models.User, error)
	GetUser(userId int) (models.User, error)
	UpdateState(user models.User) error

	// FastTask.
	AddFastTask(fastTask models.FastTask) error
	GetAllFastTasks() ([]models.FastTask, error)
	GetFastTasks(assigneeId int) ([]models.FastTask, error)
	UpdateFastTasks(fastTasks []models.FastTask) error
	DeleteFastTask(ftId int) error

	// Schedule.
	AddScheduleTask(scheduleTask models.ScheduleTask) error
	GetSchedule(assigneeId int, weekday time.Weekday) ([]models.ScheduleTask, error)
	UpdateScheduleTask(scheduleTask models.ScheduleTask) error
	DeleteScheduleTask(schId int) error
	DeleteScheduleWeek(assigneeId int, weekday time.Weekday) error
	ClearAll(assigneeId int) error
}

Jump to

Keyboard shortcuts

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