<commit_before>[![GoDoc](https://godoc.org/github.com/VoltDB/voltdb-client-go/voltdbclient?status.svg)](https://godoc.org/github.com/VoltDB/voltdb-client-go/voltdbclient) 

# VoltDB Golang Client Library

The VoltDB golang client library implements the native VoltDB wire protocol. You can
use the library to connect to a VoltDB cluster, invoke stored procedures and
read responses.

# Installation

    go get -v -u github.com/VoltDB/voltdb-client-go/voltdbclient

# Client API

The VoltDB golang client implements the interfaces specified in the database/sql/driver
package.  The interfaces specified by database/sql/driver are typically used to implement
a driver to be used with the golang database/sql package.

The code here can be used as a driver in this manner; it can also be used as a stand<commit_msg>Add Usage section<commit_after>[![GoDoc](https://godoc.org/github.com/VoltDB/voltdb-client-go/voltdbclient?status.svg)](https://godoc.org/github.com/VoltDB/voltdb-client-go/voltdbclient) 

# VoltDB Golang Client Library

The VoltDB golang client library implements the native VoltDB wire protocol. You can
use the library to connect to a VoltDB cluster, invoke stored procedures and
read responses.

# Installation

    go get -v -u github.com/VoltDB/voltdb-client-go/voltdbclient

# Usage

As `database/sql` driver

```go
package main

import (
	"database/sql"
	"fmt"
	"log"
	"os"

	_ "github.com/VoltDB/voltdb-client-go/voltdbclient"
)

func main() {
	// If using a version of VoltDB server prior to 5.2, then
	// set the version of the wire protocol to 0.  The default
	// value 1, indicates a server version of 5.2 or later.
	// voltdbclient.ProtocolVersion = 0

	db, err := sql.Open("voltdb", "localhost:21212")
	if err != nil {
		log.Fatal(err)
		os.Exit(-1)
	}
	defer db.Close()

	err = db.Ping()
	if err != nil {
		log.Fatal(err)
		os.Exit(-1)
	}
	rows, err := db.Query("HELLOWORLD.select", "French")
	if err != nil {
		log.Fatal(err)
		os.Exit(-1)
	}
	printRows(rows)

	// with prepared statement
	stmt, err := db.Prepare("select * from HELLOWORLD where dialect = ?")
	if err != nil {
		log.Fatal(err)
		os.Exit(-1)
	}

	rows, err = stmt.Query("French")
	if err != nil {
		log.Fatal(err)
		os.Exit(-1)
	}
	printRows(rows)

}

func printRows(rows *sql.Rows) {
	for rows.Next() {
		var hello string
		var world string
		var dialect string
		err := rows.Scan(&hello, &world, &dialect)
		if err != nil {
			fmt.Println(err)
			break
		}
		fmt.Printf("SUCCESS: %s %s %s\n", hello, world, dialect)
	}
}
```

# Client API

The VoltDB golang client implements the interfaces specified in the database/sql/driver
package.  The interfaces specified by database/sql/driver are typically used to implement
a driver to be used with the golang database/sql package.

The code here can be used as a driver in this manner; it can also be used as a stand
{'fraction_non_alphanumeric': 0.11052815669814621, 'fraction_numerical': 0.005946135012242042, 'mean_word_length': 3.7350993377483444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7069777', 'n_tokens_mistral': 1037, 'n_tokens_neox': 972, 'n_words': 318}