Documentation ¶
Index ¶
- Constants
- Variables
- func CurrentUser(svc AccountExtService) (*models.Account, error)
- func FindContextByName(auth runtime.ClientAuthInfoWriter, name string) (*models.Context, error)
- func SortSubTasks(tasks []*models.Task, mode subtasksview.Mode) ([]*models.Task, error)
- type AccountExtService
- type AccountService
- type ContextPersistenceService
- type ContextService
- type FolderPersistenceService
- type FolderService
- type GoalPersistenceService
- type GoalService
- type SavedSearchService
- type SettingService
- type Synchronizable
- type TaskExtendedService
- type TaskPersistenceExtService
- type TaskRichCachedService
- type TaskRichService
- type TaskService
Constants ¶
const BucketAccount = "account"
const GoalsBucket = "goals"
const MaxNumPerRequest = int64(1000)
const SettingBucket = "settings"
Variables ¶
var ContextBucket = "contexts"
var DefaultFieldsInResponse = "folder,star,context,tag,goal,repeat,startdate,starttime,duedate,duetime,priority,length"
var FolderBucket = "folders"
var TaskBucket = "tasks"
Functions ¶
func CurrentUser ¶
func CurrentUser(svc AccountExtService) (*models.Account, error)
CurrentUser return live user TODO move to cli
func FindContextByName ¶
TODO using wire
func SortSubTasks ¶
Types ¶
type AccountExtService ¶
type AccountExtService interface { Me() (*models.Account, error) CachedMe() (*models.Account, bool, error) // GetLastFetchInfo return last fetch info in db // lastFetchInfo maybe nil if never sync FindLastFetchInfo() (*models.Account, error) ModifyLastFetchInfo(account *models.Account) error }
func NewAccountExtService ¶
func NewAccountExtService( cli *client0.Toodledo, auth runtime.ClientAuthInfoWriter, db dal.Backend, accountSvc AccountService, ) AccountExtService
type AccountService ¶
func NewAccountService ¶
func NewAccountService(cli *client0.Toodledo, auth runtime.ClientAuthInfoWriter) AccountService
type ContextPersistenceService ¶
type ContextPersistenceService interface { Synchronizable ContextService }
ContextPersistenceService is a cached service it synced interval by fetcher.
func NewContextCachedService ¶
func NewContextCachedService(contextsvc ContextService, accountSvc AccountExtService, db dal.Backend) ContextPersistenceService
func ProvideContextCachedService ¶
func ProvideContextCachedService(svc ContextService, accountSvc AccountExtService, db dal.Backend) ContextPersistenceService
type ContextService ¶
type ContextService interface { Find(name string) (*models.Context, error) FindByID(id int64) (*models.Context, error) ListAll() ([]*models.Context, error) Rename(name string, newName string) (*models.Context, error) Delete(name string) error Create(name string) (*models.Context, error) }
func NewContextService ¶
func NewContextService(cli *client0.Toodledo, auth runtime.ClientAuthInfoWriter) ContextService
type FolderPersistenceService ¶
type FolderPersistenceService interface { Synchronizable FolderService }
FolderPersistenceService is a cached service it synced interval by fetcher.
func NewFolderCachedService ¶
func NewFolderCachedService(folderSvc FolderService, accountSvc AccountExtService, db dal.Backend) FolderPersistenceService
func ProvideFolderCachedService ¶
func ProvideFolderCachedService( svc FolderService, accountSvc AccountExtService, db dal.Backend, ) FolderPersistenceService
type FolderService ¶
type FolderService interface { Find(name string) (*models.Folder, error) FindByID(id int64) (*models.Folder, error) ListAll() ([]*models.Folder, error) Rename(name string, newName string) (*models.Folder, error) Archive(id int, isArchived bool) (*models.Folder, error) Delete(name string) error Create(name string) (*models.Folder, error) }
func NewFolderService ¶
func NewFolderService(cli *client0.Toodledo, auth runtime.ClientAuthInfoWriter) FolderService
type GoalPersistenceService ¶
type GoalPersistenceService interface { Synchronizable GoalService }
GoalPersistenceService is a cached service it synced interval by fetcher.
func NewGoalCachedService ¶
func NewGoalCachedService(goalSvc GoalService, accountSvc AccountExtService, db dal.Backend) GoalPersistenceService
type GoalService ¶
type GoalService interface { Find(name string) (*models.Goal, error) FindByID(id int64) (*models.Goal, error) Archive(id int, isArchived bool) (*models.Goal, error) Delete(name string) error Rename(name string, newName string) (*models.Goal, error) Create(name string) (*models.Goal, error) // ListAll returns all goals except archived ListAll() ([]*models.Goal, error) ListAllWithArchived() ([]*models.Goal, error) }
func NewGoalService ¶
func NewGoalService(cli *client0.Toodledo, auth runtime.ClientAuthInfoWriter) GoalService
type SavedSearchService ¶
type SavedSearchService interface {
ListAll() ([]*models.SavedSearch, error)
}
func NewSavedSearchService ¶
func NewSavedSearchService(cli *client0.Toodledo, auth runtime.ClientAuthInfoWriter) SavedSearchService
type SettingService ¶
type SettingService interface { Find(name string) (string, error) Put(name, body string) error Delete(name string) error }
func NewSettingService ¶
func NewSettingService(log logrus.FieldLogger, db dal.Backend) SettingService
type Synchronizable ¶
type Synchronizable interface { Clean() error Sync() error // PartialSync sync data after lastEditTime PartialSync(lastEditTime *int32) error }
Synchronizable represents stores data in local, and impl the sync methods.
type TaskExtendedService ¶
type TaskExtendedService interface { TaskService // ListAllByQuery is list tasks by query, in-completed default, and with today complted tasks ListAllByQuery(query *queries.TaskListQuery) ([]*models.Task, error) }
TaskExtendedService is a service for tasks, it provided more query parameters.
func ProvideTaskLocalExtServiceIft ¶
func ProvideTaskLocalExtServiceIft( taskSvc TaskService, accountSvc AccountExtService, db dal.Backend, ) TaskExtendedService
type TaskPersistenceExtService ¶
type TaskPersistenceExtService interface { TaskService TaskExtendedService Synchronizable }
func NewTaskLocalExtService ¶
func NewTaskLocalExtService( taskSvc TaskService, accountSvc AccountExtService, db dal.Backend, ) TaskPersistenceExtService
func ProvideTaskLocalExtService ¶
func ProvideTaskLocalExtService(taskSvc TaskService, accountSvc AccountExtService, db dal.Backend) TaskPersistenceExtService
type TaskRichCachedService ¶
type TaskRichCachedService = TaskRichService
func NewTaskRichPersistenceService ¶
func NewTaskRichPersistenceService( taskSvc TaskPersistenceExtService, folderSvc FolderPersistenceService, contextSvc ContextPersistenceService, goalSvc GoalPersistenceService, logger logrus.FieldLogger, ) TaskRichCachedService
NewTaskRichPersistenceService returns a new TaskRichCachedService. svc inside will cache the attribute when rich the task.
type TaskRichService ¶
type TaskRichService interface { Find(id int64) (*models.RichTask, error) Rich(tasks *models.Task) (*models.RichTask, error) RichThem(tasks []*models.Task) ([]*models.RichTask, error) }
func NewTaskRichService ¶
func NewTaskRichService( taskSvc TaskService, folderSvc FolderService, contextSvc ContextService, goalSvc GoalPersistenceService, logger logrus.FieldLogger, ) TaskRichService
NewTaskRichService returns a new TaskRichService. it will not cache the attribute when rich the task, and query the attribute from remote Please use the NewTaskRichPersistenceService first.
type TaskService ¶
type TaskService interface { FindByID(id int64) (*models.Task, error) List(start, limit int64) ([]*models.Task, *models.PaginatedInfo, error) ListAll() ([]*models.Task, int, error) // TODO // ListAllAfter(after *time.Time) ([]*models.Task, error) // Create is simple create with only title, it was deprecated Create(title string) (*models.Task, error) CreateByQuery(query *queries.TaskCreateQuery) (*models.Task, error) Delete(id int64) error // DeleteBatch is batch delete tasks, return success ids, failed items and error DeleteBatch(ids []int64) ([]int64, []*models.TaskDeleteItem, error) Edit(id int64, t *models.TaskEdit) (*models.Task, error) EditByQuery(query *queries.TaskEditQuery) (*models.Task, error) Complete(id int64) (*models.Task, error) UnComplete(id int64) (*models.Task, error) ListDeleted(lastEditTime *int32) ([]*models.TaskDeleted, error) ListWithChanged(lastEditTime *int32, start, limit int64) ([]*models.Task, *models.PaginatedInfo, error) Start(id int64) error Stop(id int64) error }
func NewTaskService ¶
func NewTaskService(cli *client0.Toodledo, auth runtime.ClientAuthInfoWriter, logger logrus.FieldLogger) TaskService