Documentation
¶
Index ¶
- type CommentRepository
- func (cr *CommentRepository) Create(user taskforge.User, comment taskforge.Comment) (taskforge.Comment, error)
- func (cr *CommentRepository) Delete(user taskforge.User, id uuid.UUID) error
- func (cr *CommentRepository) Get(user taskforge.User, id uuid.UUID) (taskforge.Comment, error)
- func (cr *CommentRepository) List(user taskforge.User, object uuid.UUID) ([]taskforge.Comment, error)
- func (cr *CommentRepository) Update(user taskforge.User, updated taskforge.Comment) (taskforge.Comment, error)
- type Compiler
- type ContextRepository
- func (cr *ContextRepository) Create(user taskforge.User, context taskforge.Context) (taskforge.Context, error)
- func (cr *ContextRepository) Default() (taskforge.Context, error)
- func (cr *ContextRepository) Delete(user taskforge.User, id uuid.UUID) error
- func (cr *ContextRepository) Get(user taskforge.User, id uuid.UUID) (taskforge.Context, error)
- func (cr *ContextRepository) GetByName(user taskforge.User, name string) (taskforge.Context, error)
- func (cr *ContextRepository) List(user taskforge.User) ([]taskforge.Context, error)
- func (cr *ContextRepository) Update(user taskforge.User, updated taskforge.Context) (taskforge.Context, error)
- type Repository
- func (pr Repository) Comments() taskforge.CommentService
- func (pr Repository) Contexts() taskforge.ContextService
- func (pr *Repository) Migrate() error
- func (pr Repository) Sources() taskforge.SourceService
- func (pr Repository) Tasks() taskforge.TaskService
- func (pr Repository) Users() taskforge.UserService
- type SourceRepository
- func (sr *SourceRepository) Create(user taskforge.User, source taskforge.Source) (taskforge.Source, error)
- func (sr *SourceRepository) Default() (taskforge.Source, error)
- func (sr *SourceRepository) Delete(user taskforge.User, id uuid.UUID) error
- func (sr *SourceRepository) Get(user taskforge.User, id uuid.UUID) (taskforge.Source, error)
- func (sr *SourceRepository) List(user taskforge.User) ([]taskforge.Source, error)
- func (sr *SourceRepository) Update(user taskforge.User, updated taskforge.Source) (taskforge.Source, error)
- type TaskRepository
- func (t *TaskRepository) Complete(user taskforge.User, id uuid.UUID) error
- func (t *TaskRepository) Create(user taskforge.User, task taskforge.Task) (taskforge.Task, error)
- func (t *TaskRepository) Current(user taskforge.User) (taskforge.Task, error)
- func (t *TaskRepository) Delete(user taskforge.User, id uuid.UUID) error
- func (t *TaskRepository) Get(user taskforge.User, id uuid.UUID) (taskforge.Task, error)
- func (t *TaskRepository) List(user taskforge.User) ([]taskforge.Task, error)
- func (t *TaskRepository) Search(user taskforge.User, query string) ([]taskforge.Task, error)
- func (t *TaskRepository) Update(user taskforge.User, updated taskforge.Task) (taskforge.Task, error)
- type UserRepository
- func (ur UserRepository) Create(user taskforge.User) (taskforge.User, error)
- func (ur UserRepository) Delete(user taskforge.User, id uuid.UUID) error
- func (ur UserRepository) Get(user taskforge.User, id uuid.UUID) (taskforge.User, error)
- func (ur UserRepository) List(user taskforge.User) ([]taskforge.User, error)
- func (ur UserRepository) Login(email, password string) (taskforge.User, error)
- func (ur UserRepository) Update(user taskforge.User, updated taskforge.User) (taskforge.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CommentRepository ¶
CommentRepository implements taskforge.CommentService for a Postgres database
func (*CommentRepository) Create ¶
func (cr *CommentRepository) Create(user taskforge.User, comment taskforge.Comment) (taskforge.Comment, error)
Create validates and creates the given comment, the comment.Author is ignored and the caller user is always set as the Author.
func (*CommentRepository) Delete ¶
Delete deletes the comment corresponding to id if the calling user is the author of it.
func (*CommentRepository) Get ¶
Get retrieves a comment from the database by id if the calling user is the Author of the comment.
type Compiler ¶
type Compiler struct {
Query string
Values []interface{}
}
Compiler compiles TQL ASTs into a Postgres WHERE clause with corresponding value array
type ContextRepository ¶
ContextRepository implements taskforge.ContextService for a Postgres database
func (*ContextRepository) Create ¶
func (cr *ContextRepository) Create(user taskforge.User, context taskforge.Context) (taskforge.Context, error)
Create will validate and populate default fields on context then persist it to the Postgres database. Note: the calling user is always set as the Owner of context and the passed value of Owner for context is ignored.
func (*ContextRepository) Default ¶
func (cr *ContextRepository) Default() (taskforge.Context, error)
Default returns the default context for all users, it is named 'default'
func (*ContextRepository) Delete ¶
Delete deletes the Context with the given id if it's owned by the calling user
func (*ContextRepository) Get ¶
Get retrieves a Context with the given id if it's owned by the calling user
func (*ContextRepository) GetByName ¶
GetByName retrieves a Context with the given name if it's owned by the calling user
type Repository ¶
type Repository struct {
DB *sqlx.DB
Migrator migrations.SQLMigrator
// contains filtered or unexported fields
}
Repository managages database connections and migrations for Postgres, it implements methods returning the appropriate model services of the same name for the models in Taskforge.
func New ¶
func New(connection string) (Repository, error)
New creates a Repository and databse connection using the given connection string
func (Repository) Comments ¶
func (pr Repository) Comments() taskforge.CommentService
Comments returns a taskforge.CommentService that operates on this database
func (Repository) Contexts ¶
func (pr Repository) Contexts() taskforge.ContextService
Contexts returns a taskforge.ContextService that operates on this database
func (*Repository) Migrate ¶
func (pr *Repository) Migrate() error
Migrate runs all of the SQL migrations on this postgres database
func (Repository) Sources ¶
func (pr Repository) Sources() taskforge.SourceService
Sources returns a taskforge.SourceService that operates on this database
func (Repository) Tasks ¶
func (pr Repository) Tasks() taskforge.TaskService
Tasks returns a taskforge.TaskService that operates on this database
func (Repository) Users ¶
func (pr Repository) Users() taskforge.UserService
Users returns a taskforge.UserService that operates on this database
type SourceRepository ¶
SourceRepository implements taskforge.SourceService for a Postgres database
func (*SourceRepository) Create ¶
func (sr *SourceRepository) Create(user taskforge.User, source taskforge.Source) (taskforge.Source, error)
Create saves given source to the Postgres database
func (*SourceRepository) Default ¶
func (sr *SourceRepository) Default() (taskforge.Source, error)
Default returns the Default source corresponding to Taskforge
type TaskRepository ¶
type TaskRepository struct {
DB *sqlx.DB
Sources taskforge.SourceService
Contexts taskforge.ContextService
}
TaskRepository implements taskforge.TaskService for a Postgres database
func (*TaskRepository) Complete ¶
Complete completes the task with the given id if it's owned by user
func (*TaskRepository) Create ¶
Create will validate and populate default fields on task then persist it to the Postgres database. Note: the calling user is always set as the Owner of task and the passed value of Owner for task is ignored.
type UserRepository ¶
UserRepository implements taskforge.UserService for a Postgres database
func (UserRepository) Create ¶
Create validates, and populates default data in user then persists it to the Postgres database.
func (UserRepository) Delete ¶
Delete deletes the user corresponding to id only if the ID matches the calling user