entityrelationship

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntityKindStringFromProto

func EntityKindStringFromProto(e *npb.Entity) string

func ReadFragmentFiles

func ReadFragmentFiles(fragmentFilenames []string) (*npb.Fragment, error)

Types

type Collection

type Collection struct {
	Entities map[string]*npb.Entity
	OutEdges map[string]*RelationshipSet
	InEdges  map[string]*RelationshipSet
}

func NewCollection

func NewCollection() *Collection

func (*Collection) EntityExists

func (erColl *Collection) EntityExists(key string) bool

func (*Collection) InsertEntity

func (erColl *Collection) InsertEntity(entity *npb.Entity) error

func (*Collection) InsertRelationship

func (erColl *Collection) InsertRelationship(r Relationship) error

func (*Collection) InsertRelationshipProto

func (erColl *Collection) InsertRelationshipProto(relationship *npb.Relationship) error

func (*Collection) NumEntities

func (erColl *Collection) NumEntities() int

func (*Collection) NumRelationships

func (erColl *Collection) NumRelationships() int

type CollectionBuilder

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

func NewCollectionBuilder

func NewCollectionBuilder(v Validator) *CollectionBuilder

func NewNonValidatingCollectionBuilder

func NewNonValidatingCollectionBuilder() *CollectionBuilder

func (*CollectionBuilder) Build

func (builder *CollectionBuilder) Build() (*Collection, error)

func (*CollectionBuilder) InsertFragments

func (builder *CollectionBuilder) InsertFragments(fragments ...*npb.Fragment) error

type Relationship

type Relationship struct {
	A    string
	Z    string
	Kind npb.RK
}

func RelationshipFromProto

func RelationshipFromProto(r *npb.Relationship) Relationship

func (*Relationship) String

func (r *Relationship) String() string

type RelationshipSet

type RelationshipSet struct {
	Relations map[Relationship]struct{}
}

func NewRelationshipSet

func NewRelationshipSet() *RelationshipSet

func (*RelationshipSet) Insert

func (rset *RelationshipSet) Insert(r Relationship) error

type Validator

type Validator interface {
	// Validate each entity as it's loaded within the collection context
	// assembled up to that point.
	ValidateEntity(*Collection, *npb.Entity) error

	// Validate each relationship as it's loaded within the collection
	// context assembled up to that point.
	ValidateRelationship(*Collection, Relationship) error

	// Validate the complete collection.
	ValidateCollection(*Collection) error
}

Jump to

Keyboard shortcuts

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