-
Notifications
You must be signed in to change notification settings - Fork 43
Update the Get Started tutorial for Go connector #4193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
7772b32
to
3b54d84
Compare
0bb705a
to
b95c668
Compare
5bed468
to
2f36ece
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clear and complete tutorial, like it 👍
Some minor comments/ideas from my side.
) | ||
|
||
func main() { | ||
ctx, cancel := context.WithTimeout(context.Background(), time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: you can add a comment // Connect to the database
to make this source file more readable even without the doc page.
if err != nil { | ||
fmt.Println("Got an error:", err) | ||
} | ||
fmt.Println("Tuple selected the primary key value:", data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
by the key value?
Same for secondary key (line 77)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
omg, thanks!
doc/how-to/getting_started_go.rst
Outdated
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Pre-requisites | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd use the direct order of words:
... how to use the go-tarantool 2.x library
because this page is firstly about go-tarantool, and secondarily - about 2.x version.
Besides, if I get it right, we're not gonna provide content on earlier go-tarantool versions, so no sense in highlighting the version in the first place.
This section describes the :ref:`configuration <configuration_file>` of a sample database that allows remote connections: | ||
|
||
.. literalinclude:: /code_snippets/snippets/connectors/instances.enabled/sample_db/config.yaml | ||
:language: yaml | ||
:dedent: | ||
|
||
- The configuration contains one instance that listens incoming requests on the ``127.0.0.1:3301`` address. | ||
- The configuration contains one instance that listens for incoming requests on the ``127.0.0.1:3301`` address. | ||
- ``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. | ||
- ``myapp.lua`` defines how data is stored in a database and includes a stored function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- ``myapp.lua`` defines how data is stored in a database and includes a stored function. | |
- ``myapp.lua`` defines the data model and a stored function. |
doc/how-to/getting_started_go.rst
Outdated
|
||
#. In order to connect to Tarantool as an administrator, reset the password | ||
for the ``admin`` user: | ||
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``: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe some link to tutorial on starting the app?
I expect that some readers may be Go developers that are complete newcomers to Tarantool and literally know nothing about it and tt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a link to 'tt start'
doc/how-to/getting_started_go.rst
Outdated
Finally, it would be nice to select all the tuples in a space. But there is no | ||
one-liner for this in Go; you would need a script like | ||
:ref:`this one <cookbook-select-all-go>`. | ||
Using data operations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe Performing?
Or just Manipulating data
Using operations sounds a bit strange to me
To delete all tuples in a space (or to delete an entire space), use ``Call``. | ||
We'll focus on this function in more detail in the | ||
:ref:`next <getting_started-go-stored-procs>` section. | ||
``NewUpdateRequest()`` can be used to update a tuple identified by the primary key as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
``NewUpdateRequest()`` can be used to update a tuple identified by the primary key as follows: | |
``NewUpdateRequest()`` updates a tuple identified by the primary key as follows: |
Here and in some places below.
Less words, more direct expression. Anyway, up to you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, NewUpdateRequest() doesn't update a tuple - it creates an object that is used by the connection to update a tuple. So, I'd keep it as is.
:end-at: Connection is closed | ||
:dedent: | ||
|
||
.. NOTE:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put this note in the beginning of Developing subsection so that some readers can read the code instead of the procedure doc if they like.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Usually, I place the links to full samples at the beginning and at the end of tutorials. Note that the first link already added right after the topic's title.
doc/how-to/getting_started_go.rst
Outdated
|
||
.. _getting_started-go-comparison: | ||
|
||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Feature comparison |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a clearer heading here. Readers don't know about other connectors Feature comparison is unclear in this context: "Whose features? Comparison with what?"
e23c5f0
to
d084a84
Compare
Updated the
Connecting from Go
tutorial:https://docs.d.tarantool.io/en/doc/connectors/how-to/getting_started_go/
This tutorial has the same steps and uses the same database as the Connecting to a database using net.box tutorial. The upcoming Python/C++ tutorials are going to have the same layout.