siridb

command
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

README

SiriDB Module for ThingsDB

This module is written in Go.

Building the module

To build the siridb module, make sure Go is installed and configured.

First go to the module path and run the following command to install the module dependencies:

go mod tidy

Next, you are ready to build the module:

go build

Copy the created binary file to the ThingsDB module path.

Configure the module

The SiriDB module must be configured before it can be used. If you have multiple SiriDB databases, then simply configure the SiriDB module more than once.

In this example we will name the module SiriDB. This name is arbitrary and can be anything you like. The example uses a database named dbtest with the default username and password combination.

Run the following in the @thingsdb scope:

// The values MUST be change according to your situation, this is just an example
new_module('SiriDB', 'siridb', {
    username: 'iris',
    password: 'siri',
    database: 'dbtest',
    servers: [
        ["localhost", 9000]
    ]
});

Using the module

Query
future({
    module: 'SiriDB',
    query: 'select * from "my-series-001"'
}).then(|res| res);
Insert
future({
    module: 'SiriDB',
    deep: 2,
    insert: {
        mySeries001: [
            [int(now()), 3.14]
        ]
    }
}).then(|res| res);

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