init

Initialize the SkyTable module.

:init(config)

Parameters

Name Description Type Required
config The SkyTable configuration. Table Y

Config Properties

Name Description Type Required
user The SkyTable user. String Y
password The user password. String Y
base The SkyTable base. String Y
host The SkyTable server host. String Y
key The SkyTable server key String Y
debug Output response data. Boolean N

Example

skytable:init({
  user = "<user-email>",
  password = "<user-password>",
  base = "app1",
  host = "http://<skytable-host>:7173",
  key = "<server-key>",
  debug = true
})

Important

The SkyTable server runs on port 7173, make sure to include this on the host property; http://<skytable-host>:7173.


open

Open a SkyTable for usage.

:open(table_name)

Parameters

Name Description Type Required
table_name The name of the SkyTable to use. String Y

Example

local profile = skytable:open("profile")

set

Set a value in a SkyTable.

:set([data_path,] data, listener[, options])

Parameters

Name Description Type Required
data_path Path to the item data. (See Data Paths) String N
data The data to set the item to. String Y
listener A listener function. (See Listeners) Function Y
options Additional options. Table N

Options Properties

Name Description Type Required
tag A descriptive name for the event. (See Tags) String N
flag NX or XX. (See Flags) String N
expiry Table expiration in seconds. (See Expiry) Number N

Example

profile:set("age", 23, onSetResult)

Tip

See Listeners and Data Paths in the Client Guide for detailed usage information.


get

Get a value from a SkyTable.

:get([data_path,] listener[, options])

Parameters

Name Description Type Required
data_path Path to the item data. (See Data Paths) String N
listener A listener function. (See Listeners) Function Y
options Additional options. Table N

Options Properties

Name Description Type Required
tag A descriptive name for the event. (See Tags) String N

Example

profile:get("age", onResult)

Tip

See Listeners and Data Paths in the Client Guide for detailed usage information.


delete

Delete a value in a SkyTable.

:delete([data_path,] listener[, options])

Parameters

Name Description Type Required
data_path Path to the item data. (See Data Paths) String N
listener A listener function. (See Listeners) Function Y
options Additional options. Table N

Options Properties

Name Description Type Required
tag A descriptive name for the event. (See Tags) String N

Example

profile:delete("color", onResult)

Tip

See Delete in the Client Guide for detailed usage information.


keys

Returns the SkyTable keys.

:keys([data_path,] listener[, options])

Parameters

Name Description Type Required
data_path Path to the item data. (See Data Paths) String N
listener A listener function. (See Listeners) Function Y
options Additional options. Table N

Options Properties

Name Description Type Required
tag A descriptive name for the event. (See Tags) String N

Example

profile:keys(onResult)