# README
pattern
import "github.com/coralproject/shelf/internal/wire/pattern"
Overview
Index
- Constants
- Variables
- func Delete(context interface{}, db *db.DB, itemType string) error
- func GetAll(context interface{}, db *db.DB) ([]Pattern, error)
- func Upsert(context interface{}, db *db.DB, pattern *Pattern) error
- type Inference
- type Pattern
Package files
Constants
const Collection = "patterns"
Collection is the Mongo collection containing pattern metadata.
Variables
var ErrNotFound = errors.New("Pattern 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, itemType string) error
Delete removes a pattern from from Mongo.
func GetAll
func GetAll(context interface{}, db *db.DB) ([]Pattern, error)
GetAll retrieves the current patterns from Mongo.
func Upsert
func Upsert(context interface{}, db *db.DB, pattern *Pattern) error
Upsert upserts a pattern to the collection of currently utilized patterns.
type Inference
type Inference struct {
RelIDField string `bson:"related_ID_field" json:"related_ID_field" validate:"required,min=2"`
RelType string `bson:"related_type,omitempty" json:"related_type,omitempty"`
Predicate string `bson:"predicate" json:"predicate" validate:"required,min=2"`
Direction string `bson:"direction" json:"direction" validate:"required,min=2"`
Required bool `bson:"required" json:"required"`
}
Inference includes information used to infer a particular relationship within an item.
func (*Inference) Validate
func (inf *Inference) Validate() error
Validate checks the Inference value for consistency.
type Pattern
type Pattern struct {
Type string `bson:"type" json:"type" validate:"required,min=2"`
Inferences []Inference `bson:"inferences" json:"inferences" validate:"required,min=1"`
}
Pattern includes information used to infer relationships given an item of an certain type.
func GetByType
func GetByType(context interface{}, db *db.DB, itemType string) (*Pattern, error)
GetByType retrieves a pattern by type from Mongo.
func (*Pattern) Validate
func (p *Pattern) Validate() error
Validate checks the Pattern value for consistency.
Generated by godoc2md
# Packages
No description provided by the author
# Constants
Collection is the Mongo collection containing pattern metadata.
# Variables
ErrNotFound is an error variable thrown when no results are returned from a Mongo query.