Skip to content

Commit 390af0f

Browse files
authored
Merge pull request #74 from scylladb/mmt/update
Merge gocql master
2 parents 3af2863 + 45582b5 commit 390af0f

30 files changed

+1783
-323
lines changed

.github/issue_template.md

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Please answer these questions before submitting your issue. Thanks!
66
### What version of Gocql are you using?
77

88

9+
### What version of Go are you using?
10+
11+
912
### What did you do?
1013

1114

AUTHORS

+3
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,6 @@ Ivan Boyarkin <[email protected]>; <[email protected]>
117117
118118
Jorge Bay <[email protected]>
119119
Dmitriy Kozlov <[email protected]>
120+
Alexey Romanovsky <[email protected]>
121+
Jaume Marhuenda Beltran <[email protected]>
122+
Piotr Dulikowski <[email protected]>

README.md

+1-67
Original file line numberDiff line numberDiff line change
@@ -226,73 +226,7 @@ statement.
226226
Example
227227
-------
228228

229-
```go
230-
/* Before you execute the program, Launch `cqlsh` and execute:
231-
create keyspace example with replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
232-
create table example.tweet(timeline text, id UUID, text text, PRIMARY KEY(id));
233-
create index on example.tweet(timeline);
234-
*/
235-
package main
236-
237-
import (
238-
"fmt"
239-
"log"
240-
241-
"github.com/scylladb/gocql"
242-
)
243-
244-
func main() {
245-
// connect to the cluster
246-
cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3")
247-
cluster.Keyspace = "example"
248-
cluster.Consistency = gocql.Quorum
249-
session, _ := cluster.CreateSession()
250-
defer session.Close()
251-
252-
// insert a tweet
253-
if err := session.Query(`INSERT INTO tweet (timeline, id, text) VALUES (?, ?, ?)`,
254-
"me", gocql.TimeUUID(), "hello world").Exec(); err != nil {
255-
log.Fatal(err)
256-
}
257-
258-
var id gocql.UUID
259-
var text string
260-
261-
/* Search for a specific set of records whose 'timeline' column matches
262-
* the value 'me'. The secondary index that we created earlier will be
263-
* used for optimizing the search */
264-
if err := session.Query(`SELECT id, text FROM tweet WHERE timeline = ? LIMIT 1`,
265-
"me").Consistency(gocql.One).Scan(&id, &text); err != nil {
266-
log.Fatal(err)
267-
}
268-
fmt.Println("Tweet:", id, text)
269-
270-
// list all tweets
271-
iter := session.Query(`SELECT id, text FROM tweet WHERE timeline = ?`, "me").Iter()
272-
for iter.Scan(&id, &text) {
273-
fmt.Println("Tweet:", id, text)
274-
}
275-
if err := iter.Close(); err != nil {
276-
log.Fatal(err)
277-
}
278-
}
279-
```
280-
281-
282-
Authentication
283-
-------
284-
285-
```go
286-
cluster := gocql.NewCluster("192.168.1.1", "192.168.1.2", "192.168.1.3")
287-
cluster.Authenticator = gocql.PasswordAuthenticator{
288-
Username: "user",
289-
Password: "password"
290-
}
291-
cluster.Keyspace = "example"
292-
cluster.Consistency = gocql.Quorum
293-
session, _ := cluster.CreateSession()
294-
defer session.Close()
295-
```
229+
See [package documentation](https://pkg.go.dev/github.com/scylladb/gocql#pkg-examples).
296230

297231
Data Binding
298232
------------

0 commit comments

Comments
 (0)