plusminus

package module
v0.0.0-...-b64f26f Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2020 License: MIT Imports: 3 Imported by: 0

README

plusminus

Build Status Go Report Card Documentation GitHub issues license Release

A query builder for dgraph.

import "github.com/nicklanng/plusminus"

PlusMinus helps to compose query statements for dgraph, especially in cases that queries must be built bit by bit.

The library only creates a query string, which can be then passed to something like github.com/dgraph-io/dgo.

import pm "github.com/nicklanng/plusminus"

q := pm.Query("queryfriends").Blocks(
  pm.Block("data", pm.Eq("name", "Alice")).Predicates(
    pm.Predicate("name"),
    pm.Predicate("friend").Facets("close").Predicates(
      pm.Predicate("name"),
      pm.Predicate("car").Facets(),
    ),
  ),
).String()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllOfTerms

func AllOfTerms(name string, terms string) funcAllOfTerms

AllOfTerms is a function that selects nodes with all matching terms of the named field.

func And

func And(left, right expr) funcAnd

And is a composite function that requires both the left and right side to be true.

func Block

func Block(name string, function expr) *block

Block is a query block that can make up part of a query.

func Eq

func Eq(name string, val interface{}) funcEq

Eq is a function that selects nodes with the matching value.

func Has

func Has(name string) funcHas

Has is a function that checks for existence of the named predicate.

func Le

func Le(name string, val interface{}) funcLe

Le is a function that selects nodes with values of the named field that are less than the supplied value.

func Predicate

func Predicate(name string) *predicate

Predicate defines a predicate to return from a node.

func Query

func Query(name string) *query

Query is a top-level query to dgraph.

func UID

func UID(values ...interface{}) funcUID

UID is a function that selects a node with the provided uid.

Types

This section is empty.

Jump to

Keyboard shortcuts

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