dgraph

package
v0.18.0-alpha.8 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2025 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DgraphAlterSchemaCallStack = testutils.NewCallStack()
View Source
var DgraphDropAllCallStack = testutils.NewCallStack()
View Source
var DgraphDropAttrCallStack = testutils.NewCallStack()
View Source
var DgraphQueryCallStack = testutils.NewCallStack()

Functions

func AlterSchema

func AlterSchema(connection, schema string) error

Alters the schema of the dgraph database

func DropAll

func DropAll(connection string) error

Drops all data from the database.

func DropAttr

func DropAttr(connection, attr string) error

Drops an attribute from the schema.

func EscapeRDF added in v0.17.1

func EscapeRDF(value string) string

Ensures proper escaping of RDF string literals

Types

type Mutation

type Mutation struct {

	// JSON for setting data
	SetJson string

	// JSON for deleting data
	DelJson string

	// RDF N-Quads for setting data
	SetNquads string

	// RDF N-Quads for deleting data
	DelNquads string

	// Condition for the mutation, as a DQL @if directive
	Condition string
}

Represents a Dgraph mutation.

func NewMutation added in v0.17.1

func NewMutation() *Mutation

Creates a new Dgraph mutation.

func (*Mutation) WithCondition added in v0.17.1

func (m *Mutation) WithCondition(cond string) *Mutation

Adds a condition to the mutation, as a DQL @if directive.

func (*Mutation) WithDelJson added in v0.17.1

func (m *Mutation) WithDelJson(json string) *Mutation

Adds a JSON string for deleting data to the mutation.

func (*Mutation) WithDelNquads added in v0.17.1

func (m *Mutation) WithDelNquads(nquads string) *Mutation

Adds RDF N-Quads for deleting data to the mutation.

func (*Mutation) WithSetJson added in v0.17.1

func (m *Mutation) WithSetJson(json string) *Mutation

Adds a JSON string for setting data to the mutation.

func (*Mutation) WithSetNquads added in v0.17.1

func (m *Mutation) WithSetNquads(nquads string) *Mutation

Adds RDF N-Quads for setting data to the mutation.

type Query

type Query struct {
	Query     string
	Variables map[string]string
}

Represents a Dgraph query.

func NewQuery added in v0.17.1

func NewQuery(query string) *Query

Creates a new Dgraph query.

func (*Query) WithVariable added in v0.17.1

func (q *Query) WithVariable(key string, value any) *Query

Adds a variable to the query.

type Request

type Request struct {
	Query     *Query
	Mutations []*Mutation
}

Represents a Dgraph request.

type Response

type Response struct {
	Json string
	Uids map[string]string
}

Represents a Dgraph response.

func Execute deprecated

func Execute(connection string, request *Request) (*Response, error)

Deprecated: Use ExecuteQuery or ExecuteMutations instead.

func ExecuteMutations added in v0.17.1

func ExecuteMutations(connection string, mutations ...*Mutation) (*Response, error)

Executes one or more mutations on the Dgraph database.

func ExecuteQuery added in v0.17.1

func ExecuteQuery(connection string, query *Query, mutations ...*Mutation) (*Response, error)

Executes a DQL query on the Dgraph database, optionally with mutations.

Jump to

Keyboard shortcuts

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