module-go-demo

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: 4 Imported by: 0

README

Demo ThingsDB Module (Go)

Demo module written using the Go language.

Installation

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

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

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

Configuration

This module does not require any config.

Exposed functions

Name Description
echo Accepts an input message (string) and returns the same message back.
echo

Syntax: echo(message)

Arguments
  • message: The string which will be returned.
Example:
demo.echo("Hi Demo module!").then(|reply| {
    reply;  // just return the reply.
});

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