entity

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: 4 Imported by: 0

Documentation

Overview

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.

Index

Constants

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

Variables

This section is empty.

Functions

func IsErrMultipleMatch

func IsErrMultipleMatch(err error) bool

Types

type Alphabetical

type Alphabetical []Id

func (Alphabetical) Len

func (a Alphabetical) Len() int

func (Alphabetical) Less

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

func (Alphabetical) Swap

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

type ErrMultipleMatch

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

func NewErrMultipleMatch

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

func (ErrMultipleMatch) Error

func (e ErrMultipleMatch) Error() string

type Id

type Id string

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

func (Id) HasPrefix

func (i Id) HasPrefix(prefix string) bool

func (Id) Human

func (i Id) Human() string

Human return the identifier, shortened for human consumption

func (Id) MarshalGQL

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

MarshalGQL implement the Marshaler interface for gqlgen

func (Id) String

func (i Id) String() string

String return the identifier as a string

func (*Id) UnmarshalGQL

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

UnmarshalGQL implement the Unmarshaler interface for gqlgen

func (Id) Validate

func (i Id) Validate() error

IsValid tell if the Id is valid

type Interface

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

type MergeResult

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

func NewMergeError(err error, id Id) MergeResult

func NewMergeInvalidStatus

func NewMergeInvalidStatus(id Id, reason string) MergeResult

func NewMergeStatus

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

func (MergeResult) String

func (mr MergeResult) String() string

type MergeStatus

type MergeStatus int

MergeStatus represent the result of a merge operation of an entity

const (
	MergeStatusNew MergeStatus
	MergeStatusInvalid
	MergeStatusUpdated
	MergeStatusNothing
	MergeStatusError
)

Jump to

Keyboard shortcuts

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