models

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Overview

Package models contains the various GraphQL data models

Index

Constants

This section is empty.

Variables

View Source
var AllStatus = []Status{
	StatusOpen,
	StatusClosed,
}

Functions

func NewLazyBug

func NewLazyBug(cache *cache.RepoCache, excerpt *cache.BugExcerpt) *lazyBug

func NewLazyIdentity

func NewLazyIdentity(cache *cache.RepoCache, excerpt *cache.IdentityExcerpt) *lazyIdentity

func NewLoadedBug

func NewLoadedBug(snap *bug.Snapshot) *loadedBug

func NewLoadedIdentity

func NewLoadedIdentity(id identity.Interface) *loadedIdentity

Types

type AddCommentInput

type AddCommentInput struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// "The name of the repository. If not set, the default repository is used.
	RepoRef *string `json:"repoRef"`
	// The bug ID's prefix.
	Prefix string `json:"prefix"`
	// The first message of the new bug.
	Message string `json:"message"`
	// The collection of file's hash required for the first message.
	Files []git.Hash `json:"files"`
}

type AddCommentPayload

type AddCommentPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// The affected bug.
	Bug BugWrapper `json:"bug"`
	// The resulting operation.
	Operation *bug.AddCommentOperation `json:"operation"`
}

type Authored

type Authored interface {
	IsAuthored()
}

An object that has an author.

type BugConnection

type BugConnection struct {
	// A list of edges.
	Edges []*BugEdge   `json:"edges"`
	Nodes []BugWrapper `json:"nodes"`
	// Information to aid in pagination.
	PageInfo *PageInfo `json:"pageInfo"`
	// Identifies the total count of items in the connection.
	TotalCount int `json:"totalCount"`
}

The connection type for Bug.

type BugEdge

type BugEdge struct {
	// A cursor for use in pagination.
	Cursor string `json:"cursor"`
	// The item at the end of the edge.
	Node BugWrapper `json:"node"`
}

An edge in a connection.

func (BugEdge) GetCursor

func (e BugEdge) GetCursor() string

GetCursor return the cursor entry of an edge

type BugWrapper

type BugWrapper interface {
	Id() entity.Id
	LastEdit() time.Time
	Status() bug.Status
	Title() string
	Comments() ([]bug.Comment, error)
	Labels() []bug.Label
	Author() (IdentityWrapper, error)
	Actors() ([]IdentityWrapper, error)
	Participants() ([]IdentityWrapper, error)
	CreatedAt() time.Time
	Timeline() ([]bug.TimelineItem, error)
	Operations() ([]bug.Operation, error)

	IsAuthored()
}

BugWrapper is an interface used by the GraphQL resolvers to handle a bug. Depending on the situation, a Bug can already be fully loaded in memory or not. This interface is used to wrap either a lazyBug or a loadedBug depending on the situation.

type ChangeLabelInput

type ChangeLabelInput struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// "The name of the repository. If not set, the default repository is used.
	RepoRef *string `json:"repoRef"`
	// The bug ID's prefix.
	Prefix string `json:"prefix"`
	// The list of label to add.
	Added []string `json:"added"`
	// The list of label to remove.
	Removed []string `json:"Removed"`
}

type ChangeLabelPayload

type ChangeLabelPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// The affected bug.
	Bug BugWrapper `json:"bug"`
	// The resulting operation.
	Operation *bug.LabelChangeOperation `json:"operation"`
	// The effect each source label had.
	Results []*bug.LabelChangeResult `json:"results"`
}

type CloseBugInput

type CloseBugInput struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// "The name of the repository. If not set, the default repository is used.
	RepoRef *string `json:"repoRef"`
	// The bug ID's prefix.
	Prefix string `json:"prefix"`
}

type CloseBugPayload

type CloseBugPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// The affected bug.
	Bug BugWrapper `json:"bug"`
	// The resulting operation.
	Operation *bug.SetStatusOperation `json:"operation"`
}

type CommentConnection

type CommentConnection struct {
	Edges      []*CommentEdge `json:"edges"`
	Nodes      []*bug.Comment `json:"nodes"`
	PageInfo   *PageInfo      `json:"pageInfo"`
	TotalCount int            `json:"totalCount"`
}

type CommentEdge

type CommentEdge struct {
	Cursor string       `json:"cursor"`
	Node   *bug.Comment `json:"node"`
}

func (CommentEdge) GetCursor

func (e CommentEdge) GetCursor() string

GetCursor return the cursor entry of an edge

type ConnectionInput

type ConnectionInput struct {
	After  *string
	Before *string
	First  *int
	Last   *int
}

type IdentityConnection

type IdentityConnection struct {
	Edges      []*IdentityEdge   `json:"edges"`
	Nodes      []IdentityWrapper `json:"nodes"`
	PageInfo   *PageInfo         `json:"pageInfo"`
	TotalCount int               `json:"totalCount"`
}

type IdentityEdge

type IdentityEdge struct {
	Cursor string          `json:"cursor"`
	Node   IdentityWrapper `json:"node"`
}

func (IdentityEdge) GetCursor

func (e IdentityEdge) GetCursor() string

GetCursor return the cursor entry of an edge

type IdentityWrapper

type IdentityWrapper interface {
	Id() entity.Id
	Name() string
	Email() (string, error)
	Login() (string, error)
	AvatarUrl() (string, error)
	Keys() ([]*identity.Key, error)
	ValidKeysAtTime(time lamport.Time) ([]*identity.Key, error)
	DisplayName() string
	IsProtected() (bool, error)
	LastModificationLamport() (lamport.Time, error)
	LastModification() (timestamp.Timestamp, error)
}

IdentityWrapper is an interface used by the GraphQL resolvers to handle an identity. Depending on the situation, an Identity can already be fully loaded in memory or not. This interface is used to wrap either a lazyIdentity or a loadedIdentity depending on the situation.

type LabelChangeStatus

type LabelChangeStatus string
const (
	LabelChangeStatusAdded         LabelChangeStatus = "ADDED"
	LabelChangeStatusRemoved       LabelChangeStatus = "REMOVED"
	LabelChangeStatusDuplicateInOp LabelChangeStatus = "DUPLICATE_IN_OP"
	LabelChangeStatusAlreadyExist  LabelChangeStatus = "ALREADY_EXIST"
	LabelChangeStatusDoesntExist   LabelChangeStatus = "DOESNT_EXIST"
)

func (LabelChangeStatus) IsValid

func (e LabelChangeStatus) IsValid() bool

func (LabelChangeStatus) MarshalGQL

func (e LabelChangeStatus) MarshalGQL(w io.Writer)

func (LabelChangeStatus) String

func (e LabelChangeStatus) String() string

func (*LabelChangeStatus) UnmarshalGQL

func (e *LabelChangeStatus) UnmarshalGQL(v interface{}) error

type LabelConnection

type LabelConnection struct {
	Edges      []*LabelEdge `json:"edges"`
	Nodes      []bug.Label  `json:"nodes"`
	PageInfo   *PageInfo    `json:"pageInfo"`
	TotalCount int          `json:"totalCount"`
}

type LabelEdge

type LabelEdge struct {
	Cursor string    `json:"cursor"`
	Node   bug.Label `json:"node"`
}

func (LabelEdge) GetCursor

func (e LabelEdge) GetCursor() string

GetCursor return the cursor entry of an edge

type NewBugInput

type NewBugInput struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// "The name of the repository. If not set, the default repository is used.
	RepoRef *string `json:"repoRef"`
	// The title of the new bug.
	Title string `json:"title"`
	// The first message of the new bug.
	Message string `json:"message"`
	// The collection of file's hash required for the first message.
	Files []git.Hash `json:"files"`
}

type NewBugPayload

type NewBugPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// The created bug.
	Bug BugWrapper `json:"bug"`
	// The resulting operation.
	Operation *bug.CreateOperation `json:"operation"`
}

type OpenBugInput

type OpenBugInput struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// "The name of the repository. If not set, the default repository is used.
	RepoRef *string `json:"repoRef"`
	// The bug ID's prefix.
	Prefix string `json:"prefix"`
}

type OpenBugPayload

type OpenBugPayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// The affected bug.
	Bug BugWrapper `json:"bug"`
	// The resulting operation.
	Operation *bug.SetStatusOperation `json:"operation"`
}

type OperationConnection

type OperationConnection struct {
	Edges      []*OperationEdge `json:"edges"`
	Nodes      []bug.Operation  `json:"nodes"`
	PageInfo   *PageInfo        `json:"pageInfo"`
	TotalCount int              `json:"totalCount"`
}

The connection type for an Operation

type OperationEdge

type OperationEdge struct {
	Cursor string        `json:"cursor"`
	Node   bug.Operation `json:"node"`
}

Represent an Operation

func (OperationEdge) GetCursor

func (e OperationEdge) GetCursor() string

GetCursor return the cursor entry of an edge

type PageInfo

type PageInfo struct {
	// When paginating forwards, are there more items?
	HasNextPage bool `json:"hasNextPage"`
	// When paginating backwards, are there more items?
	HasPreviousPage bool `json:"hasPreviousPage"`
	// When paginating backwards, the cursor to continue.
	StartCursor string `json:"startCursor"`
	// When paginating forwards, the cursor to continue.
	EndCursor string `json:"endCursor"`
}

Information about pagination in a connection.

type Repository

type Repository struct {
	Cache *cache.MultiRepoCache
	Repo  *cache.RepoCache
}

type RepositoryMutation

type RepositoryMutation struct {
	Cache *cache.MultiRepoCache
	Repo  *cache.RepoCache
}

type SetTitleInput

type SetTitleInput struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// "The name of the repository. If not set, the default repository is used.
	RepoRef *string `json:"repoRef"`
	// The bug ID's prefix.
	Prefix string `json:"prefix"`
	// The new title.
	Title string `json:"title"`
}

type SetTitlePayload

type SetTitlePayload struct {
	// A unique identifier for the client performing the mutation.
	ClientMutationID *string `json:"clientMutationId"`
	// The affected bug.
	Bug BugWrapper `json:"bug"`
	// The resulting operation
	Operation *bug.SetTitleOperation `json:"operation"`
}

type Status

type Status string
const (
	StatusOpen   Status = "OPEN"
	StatusClosed Status = "CLOSED"
)

func (Status) IsValid

func (e Status) IsValid() bool

func (Status) MarshalGQL

func (e Status) MarshalGQL(w io.Writer)

func (Status) String

func (e Status) String() string

func (*Status) UnmarshalGQL

func (e *Status) UnmarshalGQL(v interface{}) error

type TimelineItemConnection

type TimelineItemConnection struct {
	Edges      []*TimelineItemEdge `json:"edges"`
	Nodes      []bug.TimelineItem  `json:"nodes"`
	PageInfo   *PageInfo           `json:"pageInfo"`
	TotalCount int                 `json:"totalCount"`
}

The connection type for TimelineItem

type TimelineItemEdge

type TimelineItemEdge struct {
	Cursor string           `json:"cursor"`
	Node   bug.TimelineItem `json:"node"`
}

Represent a TimelineItem

func (TimelineItemEdge) GetCursor

func (e TimelineItemEdge) GetCursor() string

GetCursor return the cursor entry of an edge

Jump to

Keyboard shortcuts

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