relationship

package
v0.0.0-...-a30bc99 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package relationship provides tools for dealing with relationships between various entities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowedIn

func AllowedIn(r Relationship, set []Relationship) (bool, error)

AllowedIn checks to see if a given relationship is compatible with the given set of relationships

func InSlice

func InSlice(r Relationship, relationships []Relationship) bool

InSlice checks to see if a relationship is present in a set of relationships

func IsCompatible

func IsCompatible(r1 Relationship, r2 Relationship) (bool, error)

IsCompatible checks to see if the two relationships are compatible

Types

type Relationship

type Relationship struct {
	Origin     string `json:"origin"`
	Target     string `json:"target"`
	Descriptor string `json:"descriptor"`
	Type       string `json:"type"`
}

Relationship is a unidirectional relationship between entities

func GetInverse

func GetInverse(r Relationship) (Relationship, error)

GetInverse gets an inverse relationship for a given relationship

func (Relationship) Describe

func (r Relationship) Describe() string

Describe returns a string version of the relationship

type Type

type Type struct {
	Name        string   `json:"name"`
	Descriptors []string `json:"descriptors"`
	InverseName string   `json:"inverse_name"`
	Disallows   []string `json:"disallows"`
}

Type is a type of relationship

func AllTypes

func AllTypes() []Type

AllTypes returns all relationship types

func GetTypeByName

func GetTypeByName(name string) (Type, error)

GetTypeByName returns the specified type, if it exists

func GetTypeFromSet

func GetTypeFromSet(name string, set []Type) (Type, error)

GetTypeFromSet gets the named relationship type from the given set

Jump to

Keyboard shortcuts

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