git-bug: Index | Files

package entity

import ""

Package entity contains the base common code to define an entity stored in a chain of git objects, supporting actions like Push, Pull and Merge.


Package Files

doc.go err.go id.go interface.go merge.go


const IdLengthSHA1 = 40
const IdLengthSHA256 = 64
const UnsetId = Id("unset")

func IsErrMultipleMatch Uses

func IsErrMultipleMatch(err error) bool

type Alphabetical Uses

type Alphabetical []Id

func (Alphabetical) Len Uses

func (a Alphabetical) Len() int

func (Alphabetical) Less Uses

func (a Alphabetical) Less(i, j int) bool

func (Alphabetical) Swap Uses

func (a Alphabetical) Swap(i, j int)

type ErrMultipleMatch Uses

type ErrMultipleMatch struct {
    Matching []Id
    // contains filtered or unexported fields

func NewErrMultipleMatch Uses

func NewErrMultipleMatch(entityType string, matching []Id) *ErrMultipleMatch

func (ErrMultipleMatch) Error Uses

func (e ErrMultipleMatch) Error() string

type Id Uses

type Id string

Id is an identifier for an entity or part of an entity

func (Id) HasPrefix Uses

func (i Id) HasPrefix(prefix string) bool

func (Id) Human Uses

func (i Id) Human() string

Human return the identifier, shortened for human consumption

func (Id) MarshalGQL Uses

func (i Id) MarshalGQL(w io.Writer)

MarshalGQL implement the Marshaler interface for gqlgen

func (Id) String Uses

func (i Id) String() string

String return the identifier as a string

func (*Id) UnmarshalGQL Uses

func (i *Id) UnmarshalGQL(v interface{}) error

UnmarshalGQL implement the Unmarshaler interface for gqlgen

func (Id) Validate Uses

func (i Id) Validate() error

IsValid tell if the Id is valid

type Interface Uses

type Interface interface {
    // Id return the Entity identifier
    Id() Id

type MergeResult Uses

type MergeResult struct {
    // Err is set when a terminal error occur in the process
    Err error

    Id     Id
    Status MergeStatus

    // Only set for invalid status
    Reason string

    // Not set for invalid status
    Entity Interface

func NewMergeError Uses

func NewMergeError(err error, id Id) MergeResult

func NewMergeInvalidStatus Uses

func NewMergeInvalidStatus(id Id, reason string) MergeResult

func NewMergeStatus Uses

func NewMergeStatus(status MergeStatus, id Id, entity Interface) MergeResult

func (MergeResult) String Uses

func (mr MergeResult) String() string

type MergeStatus Uses

type MergeStatus int

MergeStatus represent the result of a merge operation of an entity

const (
    MergeStatusNew MergeStatus

Package entity imports 4 packages (graph) and is imported by 17 packages. Updated 2019-12-12. Refresh now. Tools for package owners.