|
2 | 2 |
|
3 | 3 | > Article contains some cases for migrate from `github.com/yandex-cloud/ydb-go-sdk/v2` to `github.com/ydb-platform/ydb-go-sdk/v3` |
4 | 4 |
|
5 | | -## Imports |
| 5 | +## Table of contents |
| 6 | +1. [Imports](#imports) |
| 7 | +2. [Connect to `YDB` by `endpoint` and `database`](#connect) |
| 8 | +3. [Connect to `YDB` using connection string](#connect-dsn) |
| 9 | +4. [Make table client and session pool](#table-client) |
| 10 | +5. [Execute query with table client and session pool](#execute-queries) |
| 11 | +6. [Scans query result into local variables](#scan-result) |
| 12 | +7. [Logging SDK's events](#logs) |
| 13 | +8. [Add metrics obout SDK's events](#metrics) |
| 14 | +9. [Add `Jaeger` traces about SDK's events](#jaeger) |
| 15 | + |
| 16 | +## Imports <a name="imports"></a> |
6 | 17 | - in `v2`: |
7 | 18 | ``` |
8 | 19 | "github.com/yandex-cloud/ydb-go-sdk/v2" |
|
14 | 25 | "github.com/ydb-platform/ydb-go-sdk/v3/table" |
15 | 26 | ``` |
16 | 27 |
|
17 | | -## Connect to `YDB` by `endpoint` and `database` |
| 28 | +## Connect to `YDB` by `endpoint` and `database` <a name="connect"></a> |
18 | 29 | - in `v2`: |
19 | 30 | ```go |
20 | 31 | config := &ydb.DriverConfig{ |
|
47 | 58 | }() |
48 | 59 | ``` |
49 | 60 |
|
50 | | -## Connect to `YDB` using connection string |
| 61 | +## Connect to `YDB` using connection string <a name="connect-dsn"></a> |
51 | 62 | - in `v2`: |
52 | 63 | ```go |
53 | 64 | import ( |
|
78 | 89 | }() |
79 | 90 | ``` |
80 | 91 |
|
81 | | -## Make table client and session pool |
| 92 | +## Make table client and session pool <a name="table-client"></a> |
82 | 93 | - in `v2`: |
83 | 94 | ```go |
84 | 95 | import ( |
|
97 | 108 | ``` |
98 | 109 | - in `v3`: nothing to do, table client with internal session pool always available with `db.Table()` |
99 | 110 |
|
100 | | -## Execute query with table client and session pool |
| 111 | +## Execute query with table client and session pool <a name="execute-queries"></a> |
101 | 112 | - in `v2`: |
102 | 113 | ```go |
103 | 114 | var res *table.Result |
|
132 | 143 | } |
133 | 144 | ``` |
134 | 145 |
|
135 | | -## Scans query result into local variables |
| 146 | +## Scans query result into local variables <a name="scan-result"></a> |
136 | 147 | - in `v2`: |
137 | 148 | ```go |
138 | 149 | var ( |
|
205 | 216 | } |
206 | 217 | ``` |
207 | 218 |
|
208 | | -## Logging SDK's events |
| 219 | +## Logging SDK's events <a name="logs"></a> |
209 | 220 | - in `v2`: |
210 | 221 | ```go |
211 | 222 | config.Trace = ydb.DriverTrace{ |
|
248 | 259 | ) |
249 | 260 | ``` |
250 | 261 |
|
251 | | -## Add metrics obout SDK's events |
| 262 | +## Add metrics obout SDK's events <a name="metrics"></a> |
252 | 263 | - in `v2`: |
253 | 264 | ```go |
254 | 265 | config.Trace = ydb.DriverTrace{ |
|
272 | 283 | ``` |
273 | 284 | * metrics to other monitoring systems may be add with common package `"github.com/ydb-platform/ydb-go-sdk-metrics"` |
274 | 285 |
|
275 | | -## Add `Jaeger` traces about SDK's events |
| 286 | +## Add `Jaeger` traces about SDK's events <a name="jaeger"></a> |
276 | 287 | - in `v2`: |
277 | 288 | ```go |
278 | 289 | config.Trace = ydb.DriverTrace{ |
|
0 commit comments