Documentation ¶
Index ¶
- Constants
- Variables
- type Category
- type CategoryError
- type CategoryGetter
- type CategoryNode
- type Database
- type ErrorConverter
- type Issue
- type IssueError
- type IssueFilter
- type IssueFilterOpts
- type IssueGetHistoryOpts
- type IssueGetter
- type IssueOrder
- type IssueOrderBy
- type IssueUpdate
- type Session
- type User
- type UserError
- type UserGetter
Constants ¶
View Source
const RootCategory = "00000000-0000-0000-0000-000000000000"
The UUID of the root of the category tree.
View Source
const (
UnassignedUUID = "00000000-0000-0000-0000-000000000000"
)
The UUID of the root of the 'unassigned' user.
Variables ¶
View Source
var ( CategoryErrorParentNotFound = status.Error(codes.NotFound, "parent not found") CategoryErrorDuplicateName = status.Error(codes.AlreadyExists, "duplicate category name") CategoryErrorNotFound = status.Error(codes.NotFound, "category not found") CategoryErrorCannotDeleteRoot = status.Error(codes.InvalidArgument, "cannot delete root category") CategoryErrorNotEmpty = status.Error(codes.FailedPrecondition, "category has dependent data") )
View Source
var ( UserErrorNoSuchUsername = status.Error(codes.NotFound, "no such username") UserErrorNoSuchUser = status.Error(codes.NotFound, "no such user") UserErrorDuplicateUsername = status.Error(codes.AlreadyExists, "duplicate username") )
View Source
var (
IssueErrorNotFound = status.Error(codes.NotFound, "issue not found")
)
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category struct { UUID string `db:"id"` ParentUUID string `db:"parent_id"` Name string `db:"name"` Description string `db:"description"` }
An issue category.
type CategoryError ¶
type CategoryError error
type CategoryGetter ¶
type CategoryGetter interface { // Get retrieves a database category by UUID. Get(uuid string) (*Category, error) // GetTree returns a (sub)tree of categories starting at a given category // UUID. // At most `levels` category tree levels. Level 0 means only the requested // node, level 1 the node and its children, level 2 the node, it's children // and it's grandchildren, etc. GetTree(rootUUID string, levels uint) (*CategoryNode, error) // New creates a new database category from an in-memroy category. UUID // must be unset. ParentUUID should either point to an existing category // (if the category is a chuild category) or be blank (if the category // should be to-level). New(new *Category) (*Category, error) // Update saves a given category. All fields can be updated apart from the // current UUID. Update(cat *Category) error // Delete removes a category. It must not contain any child categories or // issues. Delete(uuid string) error }
type CategoryNode ¶
type CategoryNode struct { *Category Children []*CategoryNode }
A category that's part of a retrieved category tree.
type Database ¶
type ErrorConverter ¶
type ErrorConverter struct {
// contains filtered or unexported fields
}
func NewErrorConverter ¶
func NewErrorConverter() *ErrorConverter
func (*ErrorConverter) Convert ¶
func (c *ErrorConverter) Convert(err error) error
func (*ErrorConverter) WithForeignKeyViolation ¶
func (c *ErrorConverter) WithForeignKeyViolation(err error) *ErrorConverter
func (*ErrorConverter) WithSyntaxError ¶
func (c *ErrorConverter) WithSyntaxError(err error) *ErrorConverter
func (*ErrorConverter) WithUniqueConstraintViolation ¶
func (c *ErrorConverter) WithUniqueConstraintViolation(err error) *ErrorConverter
type Issue ¶
type Issue struct { // Constant columns ID int64 `db:"id"` AuthorID string `db:"author_id"` Created int64 `db:"created"` // Bumped when a new update is added LastUpdated int64 `db:"last_updated"` // Denormalized data Title string `db:"title"` AssigneeID string `db:"assignee_id"` Type int64 `db:"type"` Priority int64 `db:"priority"` Status int64 `db:"status"` }
func (*Issue) ProtoWithUsers ¶
ProtoWithUsers returns a proto representation of the Issue database object like .Proto, but with full user data. If an error is returned, the .Proto result is returned (without full user data) alongside the error.
type IssueError ¶
type IssueError error
type IssueFilter ¶
type IssueFilterOpts ¶
type IssueGetHistoryOpts ¶
type IssueGetter ¶
type IssueGetter interface { Get(id int64) (*Issue, error) Filter(filter IssueFilter, order IssueOrderBy, opts *IssueFilterOpts) ([]*Issue, error) GetHistory(id int64, opts *IssueGetHistoryOpts) ([]*IssueUpdate, error) New(new *Issue) (*Issue, error) Update(update *IssueUpdate) error }
type IssueOrder ¶
type IssueOrder int
const ( IssueOrderCreated IssueOrder = iota IssueOrderUpdated )
type IssueOrderBy ¶
type IssueOrderBy struct { Ascending bool By IssueOrder }
type IssueUpdate ¶
type IssueUpdate struct { IssueID int64 `db:"issue_id"` UpdateID int64 `db:"id"` Created int64 `db:"created"` AuthorID string `db:"author_id"` Comment sql.NullString `db:"comment"` Title sql.NullString `db:"title"` AssigneeID sql.NullString `db:"assignee_id"` Type sql.NullInt64 `db:"type"` Priority sql.NullInt64 `db:"priority"` Status sql.NullInt64 `db:"status"` }
func (*IssueUpdate) Proto ¶
func (u *IssueUpdate) Proto() *cpb.Update
func (*IssueUpdate) ProtoWithUsers ¶
func (u *IssueUpdate) ProtoWithUsers(s Session) (*cpb.Update, error)
type Session ¶
type Session interface { Category() CategoryGetter Issue() IssueGetter User() UserGetter Commit() error Rollback() error }
type User ¶
type User struct { ID string `db:"id"` Username string `db:"username"` Preferences []byte `db:"preferences"` Email sql.NullString `db:"email"` DisplayName sql.NullString `db:"display_name"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.