Categorygithub.com/thingsdb/module-go-siridb
modulepackage
0.1.0
Repository: https://github.com/thingsdb/module-go-siridb.git
Documentation: pkg.go.dev

# README

SiriDB ThingsDB Module (Go)

SiriDB module written using the Go language.

Installation

Install the module by running the following command in the @thingsdb scope:

new_module('siridb', 'github.com/thingsdb/module-go-siridb');

Optionally, you can choose a specific version by adding a @ followed with the release tag. For example: @v0.1.0.

Configuration

The SiriDB module requires a thing a configuration with the following properties:

PropertyTypeDescription
usernamestr (required)Database user to authenticate with.
passwordstr (required)Password for the database user.
databasestr (required)Database to connect to.
serverslist (required)List with tuples containing the host and client port. e.g. [["siridb.local", 9000]].

Note: if you have multiple SiriDB databases, then install one SiriDB module for each database.

Example configuration:

set_module_conf('siridb', {
    username: 'iris',
    password: 'siri',
    database: 'dbtest',
    servers: [
        ["localhost", 9000]
    ]
});

Exposed functions

NameDescription
queryRun a SiriDB query.
insertInsert data into SiriDB.

query

Syntax: query(query_string)

Arguments

  • query_string: The query string to run.

Example:

siridb.query("select * from 'my-series-001'").then(|res| {
    res;  // just return the response.
});

insert

Syntax: insert(data)

Arguments

  • data: Thing with series and data points to insert.

Example:

data = {
    mySeries001: [
        [int(now()), 3.14]
    ]
};
siridb.insert(data);