Documentation
¶
Overview ¶
Package db contains task related CRUD functionality.
Index ¶
- type Store
- func (s Store) Create(ctx context.Context, task Task) error
- func (s Store) Delete(ctx context.Context, taskID string) error
- func (s Store) QueryByID(ctx context.Context, taskID string) (Task, error)
- func (s Store) QueryProjectTasks(ctx context.Context, projectID string, pageNumber, rowsPerPage int) ([]Task, error)
- func (s Store) QueryUnique(ctx context.Context, name, column, id string) string
- func (s Store) QueryWorkspaceTasks(ctx context.Context, workspaceID string, pageNumber, rowsPerPage int) ([]Task, error)
- func (s Store) Tran(tx sqlx.ExtContext) Store
- func (s Store) Update(ctx context.Context, task Task) error
- func (s Store) WithinTran(ctx context.Context, fn func(sqlx.ExtContext) error) error
- type Task
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages the set of APIs for user access.
func NewStore ¶
func NewStore(log *zap.SugaredLogger, db *sqlx.DB) Store
NewStore constructs a data for api access.
func (Store) QueryProjectTasks ¶
func (s Store) QueryProjectTasks(ctx context.Context, projectID string, pageNumber, rowsPerPage int) ([]Task, error)
QueryProjectTasks retrieves a list of existing projects from the database.
func (Store) QueryUnique ¶
QueryUnique gets the specified project from the database.
func (Store) QueryWorkspaceTasks ¶
func (s Store) QueryWorkspaceTasks(ctx context.Context, workspaceID string, pageNumber, rowsPerPage int) ([]Task, error)
QueryWorkspaceTasks retrieves a list of existing task from the database.
func (Store) Tran ¶
func (s Store) Tran(tx sqlx.ExtContext) Store
Tran return new Store with transaction in it.
func (Store) WithinTran ¶
WithinTran runs passed function and do commit/rollback at the end.
type Task ¶
type Task struct {
ID string `db:"task_id"`
Name string `db:"name"`
Pid string `db:"pid"`
Wid string `db:"wid"`
Uid string `db:"uid"`
EstimatedSeconds time.Duration `db:"estimated_seconds"`
Active bool `db:"active"`
DateCreated time.Time `db:"date_created"`
DateUpdated time.Time `db:"date_updated"`
TrackedSeconds time.Duration `db:"tracked_seconds"`
}
Task represent the structure we need for moving data between the app and the database.
Click to show internal directories.
Click to hide internal directories.