greatday.repo module
Contains the Repo class.
- class FileRepo(path)[source]
Bases:
potoroo._repo.Repo[str,greatday.todo.GreatTodo]Repo that stores Todos on disk.
- Parameters
path (
Union[str,Path]) –
- add(todo, /, *, key=None)[source]
Write a new Todo to disk.
Returns a unique identifier that has been associated with this Todo.
- Parameters
todo (
GreatTodo) –key (
Optional[str]) –
- Return type
Union[Ok[str,ErisError],Err[str,ErisError]]
- class SQLRepo(url, *, engine_factory=<functools._lru_cache_wrapper object>, verbose=0)[source]
Bases:
potoroo._repo.TaggedRepo[str,greatday.todo.GreatTodo,greatday.tag.GreatTag]Repo that stores Todos in sqlite database.
- Parameters
url (
str) –engine_factory (
CreateEngineType) –verbose (
int) –
- add(todo, /, *, key=None)[source]
Adds a new Todo to the DB.
Returns a unique identifier that has been associated with this Todo.
- Parameters
todo (
GreatTodo) –key (
Optional[str]) –
- Return type
Union[Ok[str,ErisError],Err[str,ErisError]]
- get(key)[source]
Retrieve a Todo from the DB.
- Parameters
key (str) –
- Return type
ErisResult[GreatTodo | None]
- class SQLTag(session, tag)[source]
Bases:
objectWrapper around Tag objects that helps build SQL statements.
- Parameters
session (
Session) –tag (
Tag) –
- date_range_parser(stmt)[source]
Parser for create/done dates (e.g. ‘^2000-01-01’ or ‘$5d:0d’).
- Parameters
stmt (
SelectOfScalar) –- Return type
SelectOfScalar
- desc_parser(stmt)[source]
Parser for todo description (e.g. ‘“foo”’ or ‘!”bar”’)
- Parameters
stmt (
SelectOfScalar) –- Return type
SelectOfScalar
- done_parser(stmt)[source]
Parser for done status (i.e. ‘x’ or ‘o’).
- Parameters
stmt (
SelectOfScalar) –- Return type
SelectOfScalar
- metatag_parser(stmt)[source]
Parser for metatags (e.g. ‘due<=0d’).
- Parameters
stmt (
SelectOfScalar) –- Return type
SelectOfScalar
- prefix_tag_parser(stmt)[source]
Parser for prefix tags (e.g. ‘@home’ or ‘+greatday’).
- Parameters
stmt (
SelectOfScalar) –- Return type
SelectOfScalar
- priority_range_parser(stmt)[source]
Parser for priority range (e.g. ‘(a-c)’).
- Parameters
stmt (
SelectOfScalar) –- Return type
SelectOfScalar
- session
- tag