Skip to content

Commit a6d55be

Browse files
committed
Connectors: Go tutorial - update per TW review
1 parent 19f4600 commit a6d55be

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

doc/code_snippets/snippets/connectors/go/hello.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
)
1212

1313
func main() {
14+
// Connect to the database
1415
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
1516
defer cancel()
1617
dialer := tarantool.NetDialer{
@@ -28,7 +29,8 @@ func main() {
2829
return
2930
}
3031

31-
// Interacting with the database
32+
// Interact with the database
33+
// ...
3234
// Insert data
3335
tuples := [][]interface{}{
3436
{1, "Roxette", 1986},
@@ -61,7 +63,7 @@ func main() {
6163
if err != nil {
6264
fmt.Println("Got an error:", err)
6365
}
64-
fmt.Println("Tuple selected the primary key value:", data)
66+
fmt.Println("Tuple selected by the primary key value:", data)
6567

6668
// Select by secondary key
6769
data, err = conn.Do(
@@ -74,7 +76,7 @@ func main() {
7476
if err != nil {
7577
fmt.Println("Got an error:", err)
7678
}
77-
fmt.Println("Tuple selected the secondary key value:", data)
79+
fmt.Println("Tuple selected by the secondary key value:", data)
7880

7981
// Update
8082
data, err = conn.Do(

doc/how-to/getting_started_go.rst

+13-13
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Connecting from Go
55

66
**Examples on GitHub**: `sample_db <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/connectors/instances.enabled/sample_db>`_, `go <https://github.com/tarantool/doc/tree/latest/doc/code_snippets/snippets/connectors/go>`_
77

8-
The tutorial shows how to use the 2.x version of the `go-tarantool <https://github.com/tarantool/go-tarantool>`__ library to create a Go application that connects to a remote Tarantool instance, performs CRUD operations, and executes a stored procedure.
8+
The tutorial shows how to use the `go-tarantool <https://github.com/tarantool/go-tarantool>`__ 2.x library to create a Go application that connects to a remote Tarantool instance, performs CRUD operations, and executes a stored procedure.
99
You can find the full package documentation here: `Client in Go for Tarantool <https://pkg.go.dev/github.com/tarantool/go-tarantool/v2>`__.
1010

1111

@@ -24,7 +24,7 @@ Sample database configuration
2424
Starting a sample database application
2525
--------------------------------------
2626

27-
Before creating and starting a client Go application, you need to run the :ref:`sample_db <getting_started_net_box_sample_db>` application using ``tt start``:
27+
Before creating and starting a client Go application, you need to run the :ref:`sample_db <getting_started_net_box_sample_db>` application using :ref:`tt start <tt-start>`:
2828

2929
.. code-block:: console
3030
@@ -94,19 +94,19 @@ Connecting to the database
9494

9595
.. literalinclude:: /code_snippets/snippets/connectors/go/hello.go
9696
:language: go
97-
:start-after: func main()
98-
:end-at: // Interacting with the database
97+
:start-at: // Connect to the database
98+
:end-before: // Insert data
9999
:dedent:
100100

101101
This code establishes a connection to a running Tarantool instance on behalf of ``sampleuser``.
102102
The ``conn`` object can be used to make CRUD requests and execute stored procedures.
103103

104104

105105

106-
.. _getting_started_go_using_data_operations:
106+
.. _getting_started_go_manipulating_data:
107107

108-
Using data operations
109-
~~~~~~~~~~~~~~~~~~~~~
108+
Manipulating data
109+
~~~~~~~~~~~~~~~~~
110110

111111
.. _getting_started_go_inserting_data:
112112

@@ -142,15 +142,15 @@ To get a tuple by the specified primary key value, use ``NewSelectRequest()`` to
142142
.. literalinclude:: /code_snippets/snippets/connectors/go/hello.go
143143
:language: go
144144
:start-at: // Select by primary key
145-
:end-at: Tuple selected the primary key value
145+
:end-at: Tuple selected by the primary key value
146146
:dedent:
147147

148148
You can also get a tuple by the value of the specified index by using ``Index()``:
149149

150150
.. literalinclude:: /code_snippets/snippets/connectors/go/hello.go
151151
:language: go
152152
:start-at: // Select by secondary key
153-
:end-at: Tuple selected the secondary key value
153+
:end-at: Tuple selected by the secondary key value
154154
:dedent:
155155

156156

@@ -260,8 +260,8 @@ Starting a client application
260260
[[2 Scorpions 1965]]
261261
[[3 Ace of Base 1987]]
262262
[[4 The Beatles 1960]]
263-
Tuple selected the primary key value: [[1 Roxette 1986]]
264-
Tuple selected the secondary key value: [[4 The Beatles 1960]]
263+
Tuple selected by the primary key value: [[1 Roxette 1986]]
264+
Tuple selected by the secondary key value: [[4 The Beatles 1960]]
265265
Updated tuple: [[2 Pink Floyd 1965]]
266266
Replaced tuple: [[1 Queen 1970]]
267267
Deleted tuple: [[5 The Rolling Stones 1962]]
@@ -272,8 +272,8 @@ Starting a client application
272272
273273
.. _getting_started-go-comparison:
274274

275-
Feature comparison
276-
------------------
275+
Go connectors feature comparison
276+
--------------------------------
277277

278278
There are two more connectors from the open-source community:
279279

doc/how-to/getting_started_net_box.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ This section describes the :ref:`configuration <configuration_file>` of a sample
2424

2525
- The configuration contains one instance that listens for incoming requests on the ``127.0.0.1:3301`` address.
2626
- ``sampleuser`` has :ref:`privileges <authentication-owners_privileges>` to select and modify data in the ``bands`` space and execute the ``get_bands_older_than`` stored function. This user can be used to connect to the instance remotely.
27-
- ``myapp.lua`` defines how data is stored in a database and includes a stored function.
27+
- ``myapp.lua`` defines the data model and a stored function.
2828

2929
The ``myapp.lua`` file looks as follows:
3030

0 commit comments

Comments
 (0)