Skip to content

Commit 555d27f

Browse files
committed
remove references to named namespaces
1 parent fe4ff1f commit 555d27f

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

dgraph/v25-preview.mdx

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ Namespaces allow you to create logically separated environments for your data,
5555
enabling multi-customer apps without the overhead of managing a database per
5656
customer.
5757

58-
The default namespace is created when the cluster is provisioned. It is named
59-
`root`.
58+
The default namespace is created when the cluster is provisioned.
6059

6160
Namespace APIs are part of the [v2 APIs](#v2-apis). The v2 APIs are available in
6261
the `dgo/v250` package today. Other SDKs are being updated currently.
@@ -66,27 +65,18 @@ the `dgo/v250` package today. Other SDKs are being updated currently.
6665
To create a namespace, use the `CreateNamespace` function.
6766

6867
```go
69-
err := client.CreateNamespace(context.TODO(), "finance-graph")
68+
namespaceID, err := client.CreateNamespace(context.TODO())
69+
// handle error
70+
fmt.Printf("%d\n", namespaceID)
7071
// handle error
7172
```
7273

73-
You can now pass this name to `SetSchema`, `RunDQL` or similar functions.
74-
7574
### Dropping a namespace
7675

7776
To drop a namespace, use the `DropNamespace` function.
7877

7978
```go
80-
err := client.DropNamespace(context.TODO(), "finance-graph")
81-
// handle error
82-
```
83-
84-
### Rename a namespace
85-
86-
To rename a namespace, use the `RenameNamespace` function.
87-
88-
```go
89-
err := client.RenameNamespace(context.TODO(), "finance-graph", "new-finance-graph")
79+
err := client.DropNamespace(context.TODO())
9080
// handle error
9181
```
9282

@@ -165,7 +155,7 @@ sch := `
165155
email: string @index(exact) @unique .
166156
age: int .
167157
`
168-
err := client.SetSchema(context.TODO(), dgo.RootNamespace, sch)
158+
err := client.SetSchema(context.TODO(), sch)
169159
// handle error
170160
```
171161

@@ -181,7 +171,7 @@ mutationDQL := `{
181171
_:alice <age> "29" .
182172
}
183173
}`
184-
resp, err := client.RunDQL(context.TODO(), dgo.RootNamespace, mutationDQL)
174+
resp, err := client.RunDQL(context.TODO(), mutationDQL)
185175
// handle error
186176
// print map of blank UIDs
187177
fmt.Printf("%+v\n", resp.BlankUids)
@@ -199,7 +189,7 @@ queryDQL := `{
199189
age
200190
}
201191
}`
202-
resp, err := client.RunDQL(context.TODO(), dgo.RootNamespace, queryDQL)
192+
resp, err := client.RunDQL(context.TODO(), queryDQL)
203193
// handle error
204194
fmt.Printf("%s\n", resp.QueryResult)
205195
```
@@ -217,7 +207,7 @@ queryDQL = `query Alice($name: string) {
217207
}
218208
}`
219209
vars := map[string]string{"$name": "Alice"}
220-
resp, err := client.RunDQLWithVars(context.TODO(), dgo.RootNamespace, queryDQL, vars)
210+
resp, err := client.RunDQLWithVars(context.TODO(), queryDQL, vars)
221211
// handle error
222212
fmt.Printf("%s\n", resp.QueryResult)
223213
```
@@ -234,7 +224,7 @@ queryDQL := `{
234224
age
235225
}
236226
}`
237-
resp, err := client.RunDQL(context.TODO(), dgo.RootNamespace, queryDQL, dgo.WithBestEffort())
227+
resp, err := client.RunDQL(context.TODO(), queryDQL, dgo.WithBestEffort())
238228
// handle error
239229
fmt.Printf("%s\n", resp.QueryResult)
240230
```
@@ -251,7 +241,7 @@ queryDQL := `{
251241
age
252242
}
253243
}`
254-
resp, err := client.RunDQL(context.TODO(), dgo.RootNamespace, queryDQL, dgo.WithReadOnly())
244+
resp, err := client.RunDQL(context.TODO(), queryDQL, dgo.WithReadOnly())
255245
// handle error
256246
fmt.Printf("%s\n", resp.QueryResult)
257247
```
@@ -274,7 +264,7 @@ queryDQL := `{
274264
age
275265
}
276266
}`
277-
resp, err = client.RunDQL(context.TODO(), dgo.RootNamespace, queryDQL, dgo.WithResponseFormat(api_v2.RespFormat_RDF))
267+
resp, err = client.RunDQL(context.TODO(), queryDQL, dgo.WithResponseFormat(api_v2.RespFormat_RDF))
278268
// handle error
279269
fmt.Printf("%s\n", resp.QueryResult)
280270
```
@@ -295,7 +285,7 @@ upsertQuery := `upsert {
295285
}
296286
}
297287
}`
298-
resp, err := client.RunDQL(context.TODO(), dgo.RootNamespace, upsertQuery)
288+
resp, err := client.RunDQL(context.TODO(), upsertQuery)
299289
// handle error
300290
fmt.Printf("%s\n", resp.QueryResult)
301291
fmt.Printf("%+v\n", resp.BlankUids)
@@ -315,7 +305,7 @@ upsertQuery := `upsert {
315305
}
316306
}
317307
}`
318-
resp, err := client.RunDQL(context.TODO(), dgo.RootNamespace, upsertQuery)
308+
resp, err := client.RunDQL(context.TODO(), upsertQuery)
319309
// handle error
320310
fmt.Printf("%s\n", resp.QueryResult)
321311
```

0 commit comments

Comments
 (0)