Repository navigation
io.db.sqlite: the Sqlite transport and its constructor - #10
Merged
Merged
Conversation
`sqlite(path, table, order = [])` constructs one table of a database file
as `Sqlite : {Direct, RowTransport, Replayable, Writable}` (HQL-0047,
HQL-0048). `source` gives its rows as a `Seq<Data>` and `tap` as a
`Stream<Data>`; an annotated read decodes each column through the format's
boundary, reading only the columns the record reads. `target` writes a
declared record a column per field, replacing the table. A row transport
takes no format, and `sink` to it is refused, naming `target`.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
The
Sqlitetransport of HQL-0047, in the module HQL-0048 names. A program reaches a table of a database file without a configured endpoint:Sqlite : {Direct, RowTransport, Replayable, Writable}inio.db.sqlite. The constructorsqlite(path, table, order = [])takes the keys ofkind = "sqlite", and the module is imported by its full path.sourcegives aSeq<Data>,tapaStream<Data>. An annotated read decodes each column through the format's boundary (anINTEGER1 astrue, aTEXTdecimal with its digits) and reads only the columns the record names, as a configured table does.targetwrites a declared record, one column per field, replacing the rows the table held.sink. As for configuredsqliteendpoints, a database file is written whole, bytarget.file(...)does. A rendered document reads only databases under its directory and writes none.Docs
The changelog, generated reference pages for
io.db.sqlite, HQL-0048's status table, and book chapter 15 ("Transports") with a checked example against the shop'sdata/shop.db.Testing
tests/io_db_sqlite.rsdoes round trips against real database files in a temporary directory.cargo test --locked(653),cargo clippy --locked --all-targets -- -D warnings,cargo fmt --check,hql reference --checkandmkdocs build --strictpass locally.