# README
wire
import "github.com/coralproject/shelf/internal/wire"
Overview
Package wire provides support for generating views.
Index
- Variables
- func AddToGraph(context interface{}, db *db.DB, store *cayley.Handle, item map[string]interface{}) error
- func RemoveFromGraph(context interface{}, db *db.DB, store *cayley.Handle, item map[string]interface{}) error
- type QuadParam
- type Result
- type ViewParams
Package files
Variables
var (
// ErrItemType is used in item parsing.
ErrItemType = errors.New("Could not parse item type")
// ErrItemData is used in item parsing.
ErrItemData = errors.New("Could not parse item data")
// ErrItemID is used in item parsing.
ErrItemID = errors.New("Could not parse item ID")
)
var (
// ErrNotFound is an error variable thrown when no results are returned from a Mongo query.
ErrNotFound = errors.New("View items Not found")
)
func AddToGraph
func AddToGraph(context interface{}, db *db.DB, store *cayley.Handle, item map[string]interface{}) error
AddToGraph adds relationships as quads into the cayley graph.
func RemoveFromGraph
func RemoveFromGraph(context interface{}, db *db.DB, store *cayley.Handle, item map[string]interface{}) error
RemoveFromGraph removes relationship quads from the cayley graph.
type QuadParam
type QuadParam struct {
Subject string `validate:"required,min=2"`
Predicate string `validate:"required,min=2"`
Object string `validate:"required,min=2"`
}
QuadParam contains information needed to add/remove relationships to/from the cayley graph.
func (*QuadParam) Validate
func (q *QuadParam) Validate() error
Validate checks the QuadParams value for consistency.
type Result
type Result struct {
Results interface{} `json:"results"`
}
Result represents what a user will receive after generating a view.
func Execute
func Execute(context interface{}, mgoDB *db.DB, graphDB *cayley.Handle, viewParams *ViewParams) (*Result, error)
Execute executes a graph query to generate the specified view.
type ViewParams
type ViewParams struct {
ViewName string `json:"view_name"`
ItemKey string `json:"item_key"`
ResultsCollection string `json:"results_collection"`
BufferLimit int `json:"buffer_limit"`
}
ViewParams represents how the View will be generated and persisted.
Generated by godoc2md
# Packages
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
# Functions
AddToGraph adds relationships as quads into the cayley graph.
Execute executes a graph query to generate the specified view.
RemoveFromGraph removes relationship quads from the cayley graph.
# Variables
ErrItemData is used in item parsing.
ErrItemID is used in item parsing.
ErrItemType is used in item parsing.
ErrNotFound is an error variable thrown when no results are returned from a Mongo query.
# Structs
QuadParam contains information needed to add/remove relationships to/from the cayley graph.
Result represents what a user will receive after generating a view.
ViewParams represents how the View will be generated and persisted.