pattern

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

pattern

import "github.com/coralproject/shelf/internal/wire/pattern"

Overview

Index

Package files

model.go pattern.go

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

Documentation

Index

Constants

View Source
const Collection = "patterns"

Collection is the Mongo collection containing pattern metadata.

Variables

View Source
var ErrNotFound = errors.New("Pattern Not found")

ErrNotFound is an error variable thrown when no results are returned from a Mongo query.

Functions

func Delete

func Delete(context interface{}, db *db.DB, itemType string) error

Delete removes a pattern from 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.

Types

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 GetAll

func GetAll(context interface{}, db *db.DB) ([]Pattern, error)

GetAll retrieves the current patterns from Mongo.

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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