task

package
v0.0.0-...-a17a3e0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2017 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TaskBucket = store.Bucket("tasks")

TaskBucket is the Bucket for Tasks.

Functions

func DeleteResources

func DeleteResources(rs []text.ID) store.Mutation

func GetAll

func GetAll(user string, filters ...Filter) func(*bolt.Tx) ([]*Task, error)

GetAll returns a function which unmarshals all tasks for which the user has ownership. If Filters are passed, only tasks for which filter.Member(task) == true will be returned. Note that the order of the returned slice is determined by the IDs of the Tasks, which are random UUIDs.

Types

type ByOldest

type ByOldest []*Task

ByOldest is a sort.Interface implementation for a slice of *Task to be sorted by due date: from oldest to newest, followed by tasks without a due date.

func (ByOldest) Len

func (t ByOldest) Len() int

func (ByOldest) Less

func (t ByOldest) Less(i, j int) bool

func (ByOldest) Swap

func (t ByOldest) Swap(i, j int)

type ByOwner

type ByOwner users.ByOwner

func (ByOwner) Member

func (b ByOwner) Member(of *Task) bool

type ByReader

type ByReader string

ByReader is a Filter for Tasks that have the given read user.

func (ByReader) Member

func (b ByReader) Member(of *Task) bool

Member implements Filter on ByReader.

type ByWriter

type ByWriter string

ByWriter is a Filter for Tasks that have the given read user.

func (ByWriter) Member

func (b ByWriter) Member(of *Task) bool

Member implements Filter on ByWriter.

type Completion

type Completion int
const (
	Incomplete Completion = iota
	Complete
)

func (Completion) Member

func (c Completion) Member(of *Task) bool

type Deleted

type Deleted string

Deleted is a Resourcer which can notify that the convo has been deleted.

func (Deleted) Resource

func (Deleted) Resource() store.Resource

Resource implements Resourcer.Resource on Deleted.

type DueWithin

type DueWithin struct {
	From time.Time
	Til  time.Time
}

func (DueWithin) Member

func (dw DueWithin) Member(of *Task) bool

type Filter

type Filter interface {
	Member(*Task) bool
}

type ID

type ID store.ID

ID is a store.LoadStorer for Tasks.

func (ID) Delete

func (i ID) Delete(tx *bolt.Tx) error

Delete deletes the task with the given ID.

func (ID) Load

func (i ID) Load(into interface{}) func(*bolt.Tx) error

Load implements store.Loader on TaskID. It also loads all text.

func (ID) MarshalJSON

func (i ID) MarshalJSON() ([]byte, error)

func (ID) Store

func (i ID) Store(what interface{}) func(*bolt.Tx) error

Store implements store.Storer on ID.

func (*ID) UnmarshalJSON

func (i *ID) UnmarshalJSON(from []byte) error

type MultiAnd

type MultiAnd []Filter

MultiAnd applies multiple Filters which all must be true.

func (MultiAnd) Member

func (m MultiAnd) Member(s *Task) bool

Member implements Filter on MultiAnd.

type MultiOr

type MultiOr []Filter

MultiOr applies multiple Filters, any of which may be true.

func (MultiOr) Member

func (m MultiOr) Member(s *Task) bool

Member implements Filter on MultiOr.

type Not

type Not struct{ Filter }

func (Not) Member

func (n Not) Member(of *Task) bool

type NotYetDue

type NotYetDue time.Time

func (NotYetDue) Member

func (n NotYetDue) Member(of *Task) bool

type Overdue

type Overdue time.Time

func (Overdue) Member

func (o Overdue) Member(of *Task) bool

type Removed

type Removed ID

Removed is a Resourcer which can be used to notify that the user has been removed from the Task without showing them the Task itself.

func (Removed) Resource

func (Removed) Resource() store.Resource

Resource implements Resourcer on Removed.

type Task

type Task struct {
	users.Group

	ID   ID     `json:"id"`
	Name string `json:"name"`

	Bounty int64 `json:"bounty,omitempty"`

	Completed   bool       `json:"completed"`
	CompletedBy string     `json:"completedBy,omitempty"`
	CompletedAt *time.Time `json:"completedAt,omitempty"`

	Due *time.Time `json:"due,omitempty"`

	// Resources are foreign keys into the Text bucket.  They should
	// never be exposed to the user.
	Resources []text.ID `json:"resources,omitempty"`

	// Notes are actual string resources passed with the Task.
	// They are not stored in the task's Bucket.
	Notes []string `json:"notes,omitempty"`
}

Task is a job or task which can be handled by someone.

func (*Task) Resource

func (*Task) Resource() store.Resource

func (*Task) StoreResources

func (t *Task) StoreResources(
	hasher store.ID,
	what []string,
	old []text.ID,
) func(*bolt.Tx) error

StoreResources uses the given ID to check for new and deleted Text. Then the deleted Texts are removed from the database, while new ones are stored.

Jump to

Keyboard shortcuts

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