client

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(val bool, nq *graph.NQuad) error

func Date

func Date(date time.Time, nq *graph.NQuad) error

func Datetime

func Datetime(date time.Time, nq *graph.NQuad) error

func Float

func Float(val float64, nq *graph.NQuad) error

func Int

func Int(val int32, nq *graph.NQuad) error

func Password added in v0.7.3

func Password(val string, nq *graph.NQuad) error

func Str

func Str(val string, nq *graph.NQuad) error

func Uid

func Uid(uid uint64) string

Uid converts an uint64 to a string, which can be used as part of Subject and ObjectId fields in the graph.NQuad

func ValueFromGeoJson

func ValueFromGeoJson(json string, nq *graph.NQuad) error

Types

type BatchMutation

type BatchMutation struct {
	// contains filtered or unexported fields
}

func NewBatchMutation

func NewBatchMutation(ctx context.Context, conn *grpc.ClientConn,
	size int, pending int) *BatchMutation

func (*BatchMutation) AddMutation

func (batch *BatchMutation) AddMutation(nq graph.NQuad, op Op) error

func (*BatchMutation) Counter

func (batch *BatchMutation) Counter() Counter

func (*BatchMutation) Flush

func (batch *BatchMutation) Flush()

type Counter

type Counter struct {
	Rdfs      uint64
	Mutations uint64
	Elapsed   time.Duration
}

type Op

type Op int
const (
	SET Op = iota
	DEL
)

type Req

type Req struct {
	// contains filtered or unexported fields
}

Req wraps the graph.Request so that we can define helper methods for the client around it.

func (*Req) AddMutation

func (req *Req) AddMutation(nq graph.NQuad, op Op) error

To add a mutation with a DELETE operation

if err := req.AddMutation(graph.NQuad{
	Sub:   "alice",
	Pred:  "name",
	Value: client.Str("Alice"),
}, client.DEL); err != nil {

.... handle error .... }

func (*Req) Request

func (req *Req) Request() *graph.Request

Request returns the graph request object which is sent to the server to perform a query/mutation.

func (*Req) SetQuery

func (req *Req) SetQuery(q string)

SetQuery sets a query as part of the request. Example usage req := client.Req{} req.SetQuery("{ me(_xid_: alice) { name falls.in } }") resp, err := c.Query(context.Background(), req.Request()) Check response and handle errors

Jump to

Keyboard shortcuts

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