wire

package
v0.4.8 Latest Latest
Warning

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

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

README

wire

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

Overview

Package wire provides support for generating views.

Index

Package files

relationships.go wire.go

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

Documentation

Overview

Package wire provides support for generating views.

Index

Constants

This section is empty.

Variables

View Source
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")
)
View Source
var (
	// ErrNotFound is an error variable thrown when no results are returned from a Mongo query.
	ErrNotFound = errors.New("View items Not found")
)

Functions

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.

Types

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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