# README
relationship
import "github.com/coralproject/shelf/internal/wire/relationship"
Overview
Index
- Constants
- Variables
- func Delete(context interface{}, db *db.DB, predicate string) error
- func GetAll(context interface{}, db *db.DB) ([]Relationship, error)
- func Upsert(context interface{}, db *db.DB, rel *Relationship) error
- type Relationship
Package files
Constants
const Collection = "relationships"
Collection is the Mongo collection containing relationship metadata.
Variables
var ErrNotFound = errors.New("Relationship Not found")
ErrNotFound is an error variable thrown when no results are returned from a Mongo query.
func Delete
func Delete(context interface{}, db *db.DB, predicate string) error
Delete removes a relationship from from Mongo.
func GetAll
func GetAll(context interface{}, db *db.DB) ([]Relationship, error)
GetAll retrieves the current relationships from Mongo.
func Upsert
func Upsert(context interface{}, db *db.DB, rel *Relationship) error
Upsert upserts a relationship to the collection of currently utilized relationships.
type Relationship
type Relationship struct {
SubjectTypes []string `bson:"subject_types" json:"subject_types" validate:"required,min=1"`
Predicate string `bson:"predicate" json:"predicate" validate:"required,min=2"`
ObjectTypes []string `bson:"object_types" json:"object_types" validate:"required,min=1"`
InString string `bson:"in_string,omitempty" json:"in_string,omitempty"`
OutString string `bson:"out_string,omitempty" json:"out_string,omitempty"`
}
Relationship contains metadata about a relationship. Note, predicate should be unique.
func GetByPredicate
func GetByPredicate(context interface{}, db *db.DB, predicate string) (*Relationship, error)
GetByPredicate retrieves a relationship by predicate from Mongo.
func (*Relationship) Validate
func (r *Relationship) Validate() error
Validate checks the Relationship value for consistency.
Generated by godoc2md
# Packages
No description provided by the author
# Functions
Delete removes a relationship from from Mongo.
GetAll retrieves the current relationships from Mongo.
GetByPredicate retrieves a relationship by predicate from Mongo.
Upsert upserts a relationship to the collection of currently utilized relationships.
# Constants
Collection is the Mongo collection containing relationship metadata.
# Variables
ErrNotFound is an error variable thrown when no results are returned from a Mongo query.
# Structs
Relationship contains metadata about a relationship.