From 24f2b45e07f8d464d7fd16c4402b140f25a9730a Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sat, 21 Mar 2026 11:12:06 -0500 Subject: [PATCH] add docs for db and redis --- astro.config.mjs | 20 +++++++++++++++++ src/content/docs/modules/db/sqlite.md | 21 ++++++++++++++++++ src/content/docs/modules/midi/output.mdx | 2 +- .../docs/modules/network/udp-client.md | 2 +- src/content/docs/modules/redis/client.mdx | 22 +++++++++++++++++++ src/content/docs/processors/db/query.md | 19 ++++++++++++++++ src/content/docs/processors/kv/get.md | 20 +++++++++++++++++ src/content/docs/processors/kv/set.md | 22 +++++++++++++++++++ 8 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 src/content/docs/modules/db/sqlite.md create mode 100644 src/content/docs/modules/redis/client.mdx create mode 100644 src/content/docs/processors/db/query.md create mode 100644 src/content/docs/processors/kv/get.md create mode 100644 src/content/docs/processors/kv/set.md diff --git a/astro.config.mjs b/astro.config.mjs index c0abc68..d8cfa83 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -35,6 +35,11 @@ export default defineConfig({ collapsed: true, autogenerate: { directory: 'modules/time' } }, + { + label: "Database", + collapsed: true, + autogenerate: { directory: 'modules/db' } + }, { label: "Network", collapsed: true, @@ -60,6 +65,11 @@ export default defineConfig({ collapsed: true, autogenerate: { directory: 'modules/mqtt' } }, + { + label: "Redis", + collapsed: true, + autogenerate: { directory: 'modules/redis' } + }, ] }, { @@ -70,6 +80,11 @@ export default defineConfig({ collapsed: true, autogenerate: { directory: 'processors/router' } }, + { + label: "Database", + collapsed: true, + autogenerate: { directory: 'processors/db' } + }, { label: "Filter", collapsed: true, @@ -111,6 +126,11 @@ export default defineConfig({ collapsed: true, autogenerate: { directory: 'processors/time' } }, + { + label: "Key/Value", + collapsed: true, + autogenerate: { directory: 'processors/kv' } + } ] }, { diff --git a/src/content/docs/modules/db/sqlite.md b/src/content/docs/modules/db/sqlite.md new file mode 100644 index 0000000..4385bc3 --- /dev/null +++ b/src/content/docs/modules/db/sqlite.md @@ -0,0 +1,21 @@ +--- +title: SQLite +sidebar: + order: 1 +--- +The `db.sqlite` module can open/create SQLite databases + +- **type**: `db.sqlite` +- **params**: + - **dsn**: the data source name, this can be a file path or the special `:memory:` name for an in-memory DB + +## Cap + +### Example snippet +Opens an in-memory SQLite database +``` +- id: db + type: db.sqlite + params: + dsn: ":memory:" +``` \ No newline at end of file diff --git a/src/content/docs/modules/midi/output.mdx b/src/content/docs/modules/midi/output.mdx index 354f891..018b431 100644 --- a/src/content/docs/modules/midi/output.mdx +++ b/src/content/docs/modules/midi/output.mdx @@ -9,7 +9,7 @@ import { Aside } from '@astrojs/starlight/components'; This module is not currently included in the pre-compiled binaries for [showbridge](https://github.com/jwetzell/showbridge-go/releases/latest) -The `midi.output` module connects to a midi device (or virtual device) and allows sending MIDI messages out to that device. This module does not receive any message and so using it as an `input` to a [route](/concepts/routes) would be pointless. +The `midi.output` module connects to a midi device (or virtual device) and allows sending MIDI messages out to that device. This module does not produce any messages and so using it as an `input` to a [route](/concepts/routes) would be pointless. - **type**: `midi.output` - **params**: diff --git a/src/content/docs/modules/network/udp-client.md b/src/content/docs/modules/network/udp-client.md index 237f873..7674e89 100644 --- a/src/content/docs/modules/network/udp-client.md +++ b/src/content/docs/modules/network/udp-client.md @@ -3,7 +3,7 @@ title: UDP Client sidebar: order: 3 --- -The `net.udp.client` module sends messages to a the configured `host` and `port`. This module does not receive any message and so using it as an `input` to a [route](/concepts/routes) would be pointless. +The `net.udp.client` module sends messages to a the configured `host` and `port`. This module does not produce any messages and so using it as an `input` to a [route](/concepts/routes) would be pointless. - **type**: `net.udp.client` - **params**: diff --git a/src/content/docs/modules/redis/client.mdx b/src/content/docs/modules/redis/client.mdx new file mode 100644 index 0000000..beaf23d --- /dev/null +++ b/src/content/docs/modules/redis/client.mdx @@ -0,0 +1,22 @@ +--- +title: Redis Client +sidebar: + order: 1 +--- + +The `redis.client` module connects to a Redis server. This module does not produce any messages and so using it as an `input` to a [route](/concepts/routes) would be pointless. + +- **type**: `redis.client` +- **params**: + - **host**: the Redis server host + - **port**: the Redis server port + +### Example +Connect to a Redis server running on `localhost` at port `6379`. +``` +- id: redisClient + type: redis.client + params: + host: "localhost" + port: 6379 +``` \ No newline at end of file diff --git a/src/content/docs/processors/db/query.md b/src/content/docs/processors/db/query.md new file mode 100644 index 0000000..9294d28 --- /dev/null +++ b/src/content/docs/processors/db/query.md @@ -0,0 +1,19 @@ +--- +title: Query +sidebar: + order: 1 +--- +The `db.query` processor will issue a query to the specified module and return the result to the next processor in line. + +- **type**: `db.query` +- **params**: + - **module**: the id of the [module](/concepts/modules) to issue query to. + - **query**: the query to execute. +### Example +Issue a `SELECT` statement to a module with id `sqlite`. +``` +- type: db.query + params: + module: sqlite + query: "SELECT * from users;" +``` \ No newline at end of file diff --git a/src/content/docs/processors/kv/get.md b/src/content/docs/processors/kv/get.md new file mode 100644 index 0000000..5a1ad8d --- /dev/null +++ b/src/content/docs/processors/kv/get.md @@ -0,0 +1,20 @@ +--- +title: Get +sidebar: + order: 1 +--- +The `kv.get` processor gets the value associated with a key from a compatible module. The output payload is the value if the key is found. + +- **type**: `kv.get` +- **params**: + - **module**: id of the module + - **key**: the key to look up + +### Example +This will attempt to get the value for the `counter` key from the module with an id of `redis` +``` +- type: kv.get + params: + module: redis + key: counter +``` \ No newline at end of file diff --git a/src/content/docs/processors/kv/set.md b/src/content/docs/processors/kv/set.md new file mode 100644 index 0000000..3d4d8bd --- /dev/null +++ b/src/content/docs/processors/kv/set.md @@ -0,0 +1,22 @@ +--- +title: Set +sidebar: + order: 2 +--- +The `kv.set` processor sets the value associated with a key from a compatible module. The payload is unchanged so whatever is received by this payload is output unless any errors are encountered. + +- **type**: `kv.set` +- **params**: + - **module**: id of the module + - **key**: the key to look up + - **value**: the value to set + +### Example +This will attempt to set the key `hello` to `world` using the module with an id of `redis` +``` +- type: kv.set + params: + module: redis + key: hello + value: world +``` \ No newline at end of file