Age | Commit message (Collapse) | Author |
|
|
|
The name `extract()` didn't make sense to me any more since the function
is doing more than its originally intended behaviour which was to
extract the YAML into a hash-like format for easy insertion into the
database.
I decided to give up on that behaviour since this works for what we want
it to do. Maybe this function is doing more than it should, but I'm okay
with that for the current functional requirements.
|
|
|
|
This saves us from having to declare and use a vestigial unit struct
value for the hash.
In retrospect, I could have used the unit type instead of creating a
unit struct, but this is even cleaner. Only a couple hours ago learned
that `HashSet` exists.
|
|
Create an adapter from `std::fmt::Write` to `std::io::Write` based on
the following idea in the standard library:
https://github.com/rust-lang/rust/blob/master/library/std/src/io/mod.rs#L1634-L1652
Since `yaml_rust::YamlEmitter::new()` requires a `std::fmt::Write`,
adapt standard output so the emitter can write to it.
|
|
It doesn't need to be completely public.
|
|
This allows us to use a borrowed `yaml_rust::Yaml` for `ToSql` and an
owned `yaml_rust::Yaml` for `FromSql`.
|
|
Use a new `yaqlite::Error` type. Remove the other error types and use
this main error type everywhere. For now, that seems simpler.
The real reason why I centralised on one error type is that I wanted a
single `Error::Sqlite` variant for both `rusqlite::Error` and
`SqliteError` errors. However, I wasn't sure if it's possible to do that
with `thiserror`, and I didn't want to bother having to write my own
`std::error::Error` impls.
|
|
|
|
|
|
|
|
Check that the function inserts a record into the database based on a
YAML input.
Adjust the `extract()` function to take the table name as an argument.
|
|
|
|
Want to use `yaqlite::yaml` for the YAML extraction function.
|
|
Separate this code from the main binary file.
|