module-go-siridb

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2021 License: MIT Imports: 6 Imported by: 0

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:

Property Type Description
username str (required) Database user to authenticate with.
password str (required) Password for the database user.
database str (required) Database to connect to.
servers list (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

Name Description
query Run a SiriDB query.
insert Insert 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);

Documentation

Overview

Demo is a ThingsDB module which may be used as a template to build modules.

This module simply extract a given `message` property from a request and returns this message.

For example:

    // Create the module (@thingsdb scope)
    new_module('DEMO', 'demo', nil, nil);

    // When the module is loaded, use the module in a future
    future({
      module: 'DEMO',
      message: 'Hi ThingsDB module!',
    }).then(|msg| {
	      `Got the message back: {msg}`
    });

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL