Documentation
¶
Overview ¶
Package graphql provides support for executing mutations and queries against a database using GraphQL. It was designed specifically for working with [Dgraph](https://dgraph.io/).
Index ¶
- Constants
- type GraphQL
- func (g *GraphQL) CreateSchema(ctx context.Context, schemaString string, response interface{}) error
- func (g *GraphQL) DropAll(ctx context.Context, response interface{}) error
- func (g *GraphQL) Mutate(ctx context.Context, mutationString string, response interface{}) error
- func (g *GraphQL) Query(ctx context.Context, queryString string, response interface{}) error
- func (g *GraphQL) QueryPM(ctx context.Context, queryString string, response interface{}) error
- func (g *GraphQL) QuerySchema(ctx context.Context, response interface{}) error
- func (g *GraphQL) QueryWithVars(ctx context.Context, command string, queryString string, ...) error
Constants ¶
const ( CmdAlter = "alter" CmdAdmin = "admin" CmdSchema = "admin/schema" CmdQuery = "graphql" CmdQueryPM = "query" )
These commands represents the set of know graphql commands.
const ( HTTP = "http" HTTPS = "https" )
These are the supported protocols.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GraphQL ¶
type GraphQL struct {
// contains filtered or unexported fields
}
GraphQL represents a system that can accept a graphql query.
func New ¶
New constructs a GraphQL for use to making queries agains a specified host. The apiHost is just the IP:Port of the Dgraph API endpoint.
func (*GraphQL) CreateSchema ¶
func (g *GraphQL) CreateSchema(ctx context.Context, schemaString string, response interface{}) error
CreateSchema performs a schema operation against the configured server.
func (*GraphQL) DropAll ¶
DropAll perform an alter operatation against the configured server to remove all the data and schema.
func (*GraphQL) QuerySchema ¶
QuerySchema performs a schema query operation against the configured server.