Skip to content

Commit 0da0b89

Browse files
authored
Fixed go code examples
1 parent 2821005 commit 0da0b89

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

ydb/docs/en/core/reference/ydb-sdk/coordination.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ Coordination nodes are created in {{ ydb-short-name }} databases in the same nam
1515
- Go
1616

1717
```go
18-
err := db.Coordination().CreateNode(
19-
ctx,
18+
err := db.Coordination().CreateNode(ctx,
2019
"/path/to/mynode",
2120
)
2221
```
@@ -61,8 +60,7 @@ To start working with coordination nodes, a client must establish a session with
6160
- Go
6261

6362
```go
64-
session, err := db.Coordination().CreateSession(
65-
ctx,
63+
session, err := db.Coordination().CreateSession(ctx,
6664
"/path/to/mynode", // Coordination Node name in the database
6765
)
6866
```
@@ -161,7 +159,7 @@ To acquire a semaphore, the client must call the `AcquireSemaphore` method and w
161159
162160
```go
163161
lease, err := session.AcquireSemaphore(ctx,
164-
"mySemaphore", // semaphore name
162+
"my-semaphore", // semaphore name
165163
5, // value to increase semaphore by
166164
)
167165
```
@@ -210,6 +208,14 @@ Using the `UpdateSemaphore` method, you can update (replace) the semaphore data
210208

211209
{% list tabs %}
212210

211+
- Go
212+
```go
213+
err := session.UpdateSemaphore(
214+
"my-semaphore", // semaphore name
215+
options.WithUpdateData([]byte("updated-data")), // new semaphore data
216+
)
217+
```
218+
213219
- C++
214220

215221
```cpp
@@ -230,6 +236,16 @@ This call doesn't require acquiring the semaphore and doesn't lead to it. If you
230236

231237
{% list tabs %}
232238

239+
- Go
240+
241+
```go
242+
description, err := session.DescribeSemaphore(
243+
"my-semaphore" // semaphore name
244+
options.WithDescribeOwners(true), // to get list of owners
245+
options.WithDescribeWaiters(true), // to get list of waiters
246+
)
247+
```
248+
233249
- C++
234250

235251
```cpp

ydb/docs/ru/core/reference/ydb-sdk/coordination.md

+22-5
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
- Go
1212

1313
```go
14-
err := db.Coordination().CreateNode(
15-
ctx,
14+
err := db.Coordination().CreateNode(ctx,
1615
"/path/to/mynode",
1716
)
1817
```
@@ -55,8 +54,7 @@
5554
- Go
5655

5756
```go
58-
session, err := db.Coordination().CreateSession(
59-
ctx,
57+
session, err := db.Coordination().CreateSession(ctx,
6058
"/path/to/mynode", // имя Coordination Node в базе
6159
)
6260
```
@@ -155,7 +153,7 @@
155153

156154
```go
157155
lease, err := session.AcquireSemaphore(ctx,
158-
"mySemaphore", // semaphore name
156+
"my-semaphore", // semaphore name
159157
5, // value to increase semaphore by
160158
)
161159
```
@@ -202,6 +200,15 @@
202200

203201
{% list tabs %}
204202

203+
- Go
204+
205+
```go
206+
err := session.UpdateSemaphore(
207+
"my-semaphore", // semaphore name
208+
options.WithUpdateData([]byte("updated-data")), // new semaphore data
209+
)
210+
```
211+
205212
- C++
206213

207214
```cpp
@@ -222,6 +229,16 @@
222229

223230
{% list tabs %}
224231

232+
- Go
233+
234+
```go
235+
description, err := session.DescribeSemaphore(
236+
"my-semaphore" // semaphore name
237+
options.WithDescribeOwners(true), // to get list of owners
238+
options.WithDescribeWaiters(true), // to get list of waiters
239+
)
240+
```
241+
225242
- C++
226243

227244
```cpp

0 commit comments

Comments
 (0)