aboutsummaryrefslogtreecommitdiffstats
path: root/src/yaml.rs
AgeCommit message (Collapse)Author
2022-03-27Add license (GNU GPLv3+)v0.0.1Teddy Wing
2022-03-23extract(): Rename function to `db_insert()`Teddy Wing
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.
2022-03-21Add placeholders for code documentation remindersTeddy Wing
2022-03-21get_column_names(): Use `HashSet` instead of `HashMap`Teddy Wing
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.
2022-03-19main: Write YAML to standard outputTeddy Wing
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.
2022-03-18yaml::sql::Yaml: Make this type `pub(crate)`Teddy Wing
It doesn't need to be completely public.
2022-03-17Yaml: Wrap a `Cow<'_, yaml_rust::Yaml>` instead of `yaml_rust::Yaml`Teddy Wing
This allows us to use a borrowed `yaml_rust::Yaml` for `ToSql` and an owned `yaml_rust::Yaml` for `FromSql`.
2022-03-13insert(): Remove `unwrap()`sTeddy Wing
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.
2022-03-13extract(): Remove handled TODOTeddy Wing
2022-03-13extract(): Remove `unwrap()`sTeddy Wing
2022-03-13extract(): Idea for splitting up this functionTeddy Wing
2022-03-13yaqlite::insert(): Add testTeddy Wing
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.
2022-03-12Move `yaml_extract()` to `yaqlite::yaml::extract()`Teddy Wing
2022-03-12Move `yaqlite::yaml` to `yaqlite::yaml::sql`Teddy Wing
Want to use `yaqlite::yaml` for the YAML extraction function.
2022-03-12Move `Yaml` newtype to a new module in library crateTeddy Wing
Separate this code from the main binary file.