This is the ThingsDB documentation for version v0, click here for the latest version!



Simple install the package to your $GOPATH with the go tool from shell:

$ go get

Make sure Git is installed on your machine and in your system’s PATH.

Quick usage

package main

import (

    thingsdb ""

func example(conn *thingsdb.Conn, res chan interface{}) {
    var data interface{}
    var err error

    if err := conn.Connect(); err != nil {
        res <- err

    defer conn.Close()

	if err := conn.AuthToken("Fai6NmH7QYxA6WLYPdtgcy"); err != nil {
		res <- err

	if data, err = conn.Query(
		"//Doc",                // Scope
		".greetings.choice();", // ThingsDB code
		nil, // Optional array with variable (may be `nil`)
		120, // Timeout in seconds
	); err != nil {
		res <- err

	res <- data

func main() {
	// Only required for a secure connection
	conf := &tls.Config{
		InsecureSkipVerify: false,

	// In this example we will use a channel to read the example response
	res := make(chan interface{})

	// Create a new ThingsDB connection
	conn := thingsdb.NewConn("", 9400, conf)

	// Set-up a log channel, this is not required
	conn.LogCh = make(chan string)

	// Start our example
	go example(conn, res)

	// Log handler
	go func() {
		for {
			msg := <-conn.LogCh
			fmt.Printf("Log: %s\n", msg)

	// Wait for the response
	data := <-res

	// Print the response (or error)
	fmt.Printf("%v\n", data)

Possible response

Log: connected to using a secure connection
Welcome at ThingsDB!

More info

A more complete description of the Go client can be found in the link below.