item

package
v0.0.0-...-974506c Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2020 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID     string `jsonapi:"primary,comments"`
	Body   string `jsonapi:"attr,body"`
	ItemID int    `jsonapi:"attr,item_id"`
}

Comment represents a comment

type CommentDatastore

type CommentDatastore struct {
	// contains filtered or unexported fields
}

CommentDatastore implements the Repository interface

func NewCommentDatastore

func NewCommentDatastore(db *sql.DB) *CommentDatastore

NewCommentDatastore constructs a new Repository

func (*CommentDatastore) Create

func (ds *CommentDatastore) Create(usr *user.User, cmt *Comment) error

Create creates new comments

func (*CommentDatastore) List

func (ds *CommentDatastore) List(itmID int) ([]*Comment, error)

List searches for comments under an item

func (*CommentDatastore) Valid

func (ds *CommentDatastore) Valid(cmt *Comment) error

Valid checks the validity of the comment

type CommentRepository

type CommentRepository interface {
	Create(usr *user.User, cmt *Comment) error
	Valid(itm *Comment) error
	List(itm int) ([]*Comment, error)
}

CommentRepository to manage items

type Datastore

type Datastore struct {
	// contains filtered or unexported fields
}

Datastore implements the Repository interface

func NewDatastore

func NewDatastore(db *sql.DB, bi *search.BleveIndex) *Datastore

NewDatastore constructs a new Repository

func (*Datastore) Create

func (ds *Datastore) Create(usr *user.User, itm *Item) error

Create an item in the database

func (*Datastore) List

func (ds *Datastore) List(queryText string, offset, limit int) ([]*Item, error)

List searches for items which maches text in items and comments

func (*Datastore) Show

func (ds *Datastore) Show(itm *Item) error

Show an item

func (*Datastore) Valid

func (ds *Datastore) Valid(itm *Item) error

Valid checks the validity of the item

type Item

type Item struct {
	ID               int     `jsonapi:"primary,items"`
	Title            string  `jsonapi:"attr,title"`
	Description      string  `jsonapi:"attr,description"`
	Number           string  `jsonapi:"attr,num"`
	ProjectID        string  `jsonapi:"attr,project_id"`
	OpenState        bool    `jsonapi:"attr,open_state"`
	LockConversation bool    `jsonapi:"attr,lock_conversation"`
	CreatedBy        string  `jsonapi:"attr,created_by"`
	UpdatedBy        *string `jsonapi:"attr,updated_by"`
	Assignees        pq.StringArray
	Subscribers      pq.StringArray
	Labels           pq.StringArray
	CreatedAt        time.Time
	UpdatedAt        *time.Time
	Comments         []*Comment `jsonapi:"relation,comments"`
}

Item represents an item

func (itm Item) JSONAPIRelationshipLinks(relation string) *jsonapi.Links

JSONAPIRelationshipLinks invoked for each relationship defined on the Item struct when marshaled

type Repository

type Repository interface {
	Create(usr *user.User, itm *Item) error
	Valid(itm *Item) error
	Show(itm *Item) error
	List(query string, offset, limit int) ([]*Item, error)
}

Repository to manage items

Jump to

Keyboard shortcuts

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