Skip to content

Commit

Permalink
Login before running schema queries (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
mangalaman93 authored Nov 21, 2019
1 parent 3efa60e commit c3109ce
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions example_get_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,12 @@ import (
"fmt"
"log"

"github.com/dgraph-io/dgo/v2"
"github.com/dgraph-io/dgo/v2/protos/api"
"google.golang.org/grpc"
)

func Example_getSchema() {
conn, err := grpc.Dial("127.0.0.1:9180", grpc.WithInsecure())
if err != nil {
log.Fatal("While trying to dial gRPC")
}
defer conn.Close()

dc := api.NewDgraphClient(conn)
dg := dgo.NewDgraphClient(dc)
dg, cancel := getDgraphClient()
defer cancel()

op := &api.Operation{}
op.Schema = `
Expand All @@ -46,7 +38,7 @@ func Example_getSchema() {
`

ctx := context.Background()
err = dg.Alter(ctx, op)
err := dg.Alter(ctx, op)
if err != nil {
log.Fatal(err)
}
Expand Down

0 comments on commit c3109ce

Please sign in to comment.