Documentation ¶
Index ¶
Constants ¶
View Source
const Collection = "relationships"
Collection is the Mongo collection containing relationship metadata.
Variables ¶
View Source
var ErrNotFound = errors.New("Relationship Not found")
ErrNotFound is an error variable thrown when no results are returned from a Mongo query.
Functions ¶
Types ¶
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 GetAll ¶
func GetAll(context interface{}, db *db.DB) ([]Relationship, error)
GetAll retrieves the current relationships from Mongo.
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.
Click to show internal directories.
Click to hide internal directories.