Skip to content

Commit e602d2a

Browse files
committed
readme: merge documentation sections into one
- Add a section 'Documentation' and move 'Hello World' and 'Walking Through' examples to 'Documentation'. - Fix formatting in 'Walking-Through' example
1 parent c259d57 commit e602d2a

File tree

1 file changed

+30
-31
lines changed

1 file changed

+30
-31
lines changed

README.md

+30-31
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ faster than other packages according to public benchmarks.
1919
## Table of contents
2020

2121
* [Installation](#installation)
22-
* [Hello World](#hello-world)
23-
* [API reference](#api-reference)
24-
* [Walking\-through example](#walking-through-example)
22+
* [Documentation](#documentation)
2523
* [Help](#help)
2624
* [Contributing](#contributing)
2725
* [Alternative connectors](#alternative-connectors)
@@ -47,19 +45,9 @@ This should bring source and binary files into subdirectories of `/usr/local/go`
4745
making it possible to access by adding `github.com/tarantool/go-tarantool` in
4846
the `import {...}` section at the start of any Go program.
4947

50-
<h2>Hello World</h2>
48+
## Documentation
5149

52-
In the "[Connectors](https://www.tarantool.io/en/doc/latest/getting_started/getting_started_go/)"
53-
chapter of the Tarantool manual, there is an explanation of a very short (18-line)
54-
program written in Go. Follow the instructions at the start of the "Connectors"
55-
chapter carefully. Then cut and paste the example into a file named `example.go`,
56-
and run it. You should see: nothing.
57-
58-
If that is what you see, then you have successfully installed `go-tarantool` and
59-
successfully executed a program that manipulated the contents of a Tarantool
60-
database.
61-
62-
<h2>API reference</h2>
50+
### API Reference
6351

6452
Read the [Tarantool documentation](https://www.tarantool.io/en/doc/latest/book/box/data_model/)
6553
to find descriptions of terms like "connect", "space", "index", and the
@@ -76,31 +64,42 @@ The supported requests have parameters and results equivalent to requests in
7664
the [Tarantool CRUD operations](https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_space/).
7765
There are also Typed and Async versions of each data-manipulation function.
7866

79-
## Walking-through example
67+
### Hello World example
68+
69+
In the "[Connectors](https://www.tarantool.io/en/doc/latest/getting_started/getting_started_go/)"
70+
chapter of the Tarantool manual, there is an explanation of a very short (18-line)
71+
program written in Go. Follow the instructions at the start of the "Connectors"
72+
chapter carefully. Then cut and paste the example into a file named `example.go`,
73+
and run it. You should see: nothing.
74+
75+
If that is what you see, then you have successfully installed `go-tarantool` and
76+
successfully executed a program that manipulated the contents of a Tarantool
77+
database.
78+
79+
### Walking-through example
8080

8181
We can now have a closer look at the `example.go` program and make some observations
8282
about what it does.
8383

8484
```go
85-
package main
85+
package tarantool_test
8686

8787
import (
88-
"fmt"
89-
"github.com/tarantool/go-tarantool"
88+
"fmt"
89+
"github.com/tarantool/go-tarantool"
9090
)
9191

92-
func main() {
93-
opts := tarantool.Opts{User: "guest"}
94-
conn, err := tarantool.Connect("127.0.0.1:3301", opts)
95-
// conn, err := tarantool.Connect("/path/to/tarantool.socket", opts)
96-
if err != nil {
97-
fmt.Println("Connection refused:", err)
98-
}
99-
resp, err := conn.Insert(999, []interface{}{99999, "BB"})
100-
if err != nil {
101-
fmt.Println("Error", err)
102-
fmt.Println("Code", resp.Code)
103-
}
92+
func Example_walkThrough() {
93+
opts := tarantool.Opts{User: "guest"}
94+
conn, err := tarantool.Connect("127.0.0.1:3301", opts)
95+
if err != nil {
96+
fmt.Println("Connection refused:", err)
97+
}
98+
resp, err := conn.Insert(999, []interface{}{99999, "BB"})
99+
if err != nil {
100+
fmt.Println("Error", err)
101+
fmt.Println("Code", resp.Code)
102+
}
104103
}
105104
```
106105

0 commit comments

Comments
 (0)