-
Notifications
You must be signed in to change notification settings - Fork 2
feat: rename iii-database to database #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,7 @@ on: | |
| options: | ||
| - acp | ||
| - console | ||
| - iii-database | ||
| - database | ||
| - iii-directory | ||
| - iii-lsp | ||
| - iii-lsp-vscode | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| # iii-database | ||
| # database | ||
|
|
||
| > Connect to PostgreSQL, MySQL, and SQLite. Run queries, prepared statements, transactions, and subscribe to row-level change feeds. | ||
|
|
||
|
|
@@ -12,7 +12,7 @@ | |
| ## Install | ||
|
|
||
| ```sh | ||
| iii worker add iii-[email protected] | ||
| iii worker add [email protected] | ||
| ``` | ||
|
|
||
| ## Configure | ||
|
|
@@ -21,7 +21,7 @@ Add a single `databases` block to your `config.yaml`. SQLite is the recommended | |
|
|
||
| ```yaml | ||
| workers: | ||
| - name: iii-database | ||
| - name: database | ||
| config: | ||
| databases: | ||
| primary: | ||
|
|
@@ -95,18 +95,18 @@ SQLite ignores the `tls` block (local-file driver). | |
| ```ts | ||
| import { call } from 'iii-sdk' | ||
|
|
||
| await call('iii-database::execute', { | ||
| await call('database::execute', { | ||
| db: 'primary', | ||
| sql: 'CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, email TEXT)' | ||
| }) | ||
|
|
||
| await call('iii-database::execute', { | ||
| await call('database::execute', { | ||
| db: 'primary', | ||
| sql: 'INSERT INTO users (email) VALUES (?), (?)', | ||
| params: ['a@x', 'b@x'] | ||
| }) | ||
|
|
||
| const { rows } = await call('iii-database::query', { | ||
| const { rows } = await call('database::query', { | ||
| db: 'primary', | ||
| sql: 'SELECT id, email FROM users ORDER BY id' | ||
| }) | ||
|
|
@@ -116,27 +116,27 @@ const { rows } = await call('iii-database::query', { | |
|
|
||
| | Function | Purpose | | ||
| |---|---| | ||
| | `iii-database::query` | Read SQL. Returns `{ rows, row_count, columns }`. | | ||
| | `iii-database::execute` | Write SQL. Returns `{ affected_rows, last_insert_id, returned_rows }`.<br>**`last_insert_id` semantics:** SQLite/MySQL surface the engine's `last_insert_rowid()` / `LAST_INSERT_ID()` (only populated for INSERT). Postgres has no equivalent — `last_insert_id` is set from the **first column of the first RETURNING row**, so put your PK first: `RETURNING id, name`, not `RETURNING name, id`. | | ||
| | `iii-database::prepareStatement` | Pin a connection and return `{ handle: { id, expires_at } }`. | | ||
| | `iii-database::runStatement` | Run a previously-prepared handle. (No `timeout_ms` — uses the pinned connection's session lifetime; configure via `ttl_seconds` on `prepareStatement`.) | | ||
| | `iii-database::transaction` | Atomic batch sequence; rolls back on first failure. One-shot — pass all statements together. | | ||
| | `iii-database::beginTransaction` | Open an interactive transaction. Returns `{ transaction: { id, expires_at } }`. Configurable `timeout_ms` (default 30 000, max 300 000) auto-rolls back if the deadline elapses. | | ||
| | `iii-database::transactionQuery` | Read SQL inside an interactive transaction. Same envelope as `query`. | | ||
| | `iii-database::transactionExecute` | Write SQL inside an interactive transaction. Same envelope as `execute`. Rejects bare `BEGIN`/`COMMIT`/`ROLLBACK`/`SAVEPOINT`/`SET TRANSACTION` with `INVALID_PARAM` — finalize via the dedicated handlers below. | | ||
| | `iii-database::commitTransaction` | Commit and finalize an interactive transaction. Subsequent calls against the same id return `TRANSACTION_NOT_FOUND`. | | ||
| | `iii-database::rollbackTransaction` | Rollback and finalize an interactive transaction. Subsequent calls against the same id return `TRANSACTION_NOT_FOUND`. | | ||
| | `database::query` | Read SQL. Returns `{ rows, row_count, columns }`. | | ||
| | `database::execute` | Write SQL. Returns `{ affected_rows, last_insert_id, returned_rows }`.<br>**`last_insert_id` semantics:** SQLite/MySQL surface the engine's `last_insert_rowid()` / `LAST_INSERT_ID()` (only populated for INSERT). Postgres has no equivalent — `last_insert_id` is set from the **first column of the first RETURNING row**, so put your PK first: `RETURNING id, name`, not `RETURNING name, id`. | | ||
| | `database::prepareStatement` | Pin a connection and return `{ handle: { id, expires_at } }`. | | ||
| | `database::runStatement` | Run a previously-prepared handle. (No `timeout_ms` — uses the pinned connection's session lifetime; configure via `ttl_seconds` on `prepareStatement`.) | | ||
| | `database::transaction` | Atomic batch sequence; rolls back on first failure. One-shot — pass all statements together. | | ||
| | `database::beginTransaction` | Open an interactive transaction. Returns `{ transaction: { id, expires_at } }`. Configurable `timeout_ms` (default 30 000, max 300 000) auto-rolls back if the deadline elapses. | | ||
| | `database::transactionQuery` | Read SQL inside an interactive transaction. Same envelope as `query`. | | ||
| | `database::transactionExecute` | Write SQL inside an interactive transaction. Same envelope as `execute`. Rejects bare `BEGIN`/`COMMIT`/`ROLLBACK`/`SAVEPOINT`/`SET TRANSACTION` with `INVALID_PARAM` — finalize via the dedicated handlers below. | | ||
| | `database::commitTransaction` | Commit and finalize an interactive transaction. Subsequent calls against the same id return `TRANSACTION_NOT_FOUND`. | | ||
| | `database::rollbackTransaction` | Rollback and finalize an interactive transaction. Subsequent calls against the same id return `TRANSACTION_NOT_FOUND`. | | ||
|
|
||
| ## Triggers | ||
|
|
||
| ### `iii-database::row-change` | ||
| ### `database::row-change` | ||
| Postgres only. Streams row-level changes via logical replication (`pgoutput`). | ||
|
|
||
| > **NOTE (v1.0.0):** Event dispatch is not yet functional. The publication and replication slot are created at startup, but the streaming decode loop is stubbed pending an upstream `tokio-postgres` replication API release. Operators can pre-provision slots and publications now; events will start flowing in a later release. | ||
|
|
||
| ```yaml | ||
| triggers: | ||
| - type: iii-database::row-change | ||
| - type: database::row-change | ||
| config: | ||
| db: primary | ||
| schema: public | ||
|
|
@@ -171,7 +171,7 @@ A few operations are no-ops on certain drivers. They emit a `tracing::warn!` rat | |
| | `execute` with `returning: [...]` | ✓ | ✓ | warn-once + ignore | | ||
| | `transaction` `isolation: read_committed` / `repeatable_read` | warn + use serializable | ✓ | ✓ | | ||
| | `transaction` `isolation: serializable` | ✓ (`BEGIN IMMEDIATE`) | ✓ | ✓ | | ||
| | `iii-database::row-change` trigger | — | setup-only in v1.0.0 (see above) | — | | ||
| | `database::row-change` trigger | — | setup-only in v1.0.0 (see above) | — | | ||
|
|
||
|
|
||
| ## Troubleshooting | ||
|
|
||
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| iii: v1 | ||
| name: iii-database | ||
| name: database | ||
| language: rust | ||
| deploy: binary | ||
| manifest: Cargo.toml | ||
| bin: iii-database | ||
| bin: database | ||
| description: Talk to PostgreSQL, MySQL, and SQLite from iii — query, execute, transactions, prepared statements, and change feeds. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 432
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 726
🏁 Script executed:
Repository: iii-hq/workers
Length of output: 1409
Pin GitHub Action refs to commit SHAs.
Line 37 uses
actions/setup-node@v4(mutable version tag), which violates strict workflow hardening practices and can failunpinned-usespolicy checks. Convert to a pinned commit SHA (e.g.,actions/setup-node@1e21ff14b671a668ad81a1eac58d86bc5915f5a6).Note: This pattern appears across multiple workflows—consider auditing all workflow files to pin GitHub Actions consistently.
🧰 Tools
🪛 zizmor (1.25.2)
[error] 37-37: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy)
(unpinned-uses)
🤖 Prompt for AI Agents