浏览代码

Fix some clippy nits, add skeleton changelog, bump versions for release.

Kestrel 2 月之前
父节点
当前提交
1779eefc1c
共有 6 个文件被更改,包括 33 次插入21 次删除
  1. 12 0
      CHANGELOG.md
  2. 1 1
      microrm-macros/Cargo.toml
  3. 9 9
      microrm-macros/src/lib.rs
  4. 1 1
      microrm/Cargo.toml
  5. 8 8
      microrm/src/lib.rs
  6. 2 2
      microrm/src/schema/datum.rs

+ 12 - 0
CHANGELOG.md

@@ -0,0 +1,12 @@
+## 0.4
+
+- Complete rework of query interface and schema specification.
+    - In particular, added support for foreign key lookups
+- Added `clap` CLI generation
+
+## 0.3
+- Unified query interface to use type composition instead of ad-hoc functionality.
+    - Added support for joins
+
+## 0.2
+- Initial release

+ 1 - 1
microrm-macros/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "microrm-macros"
-version = "0.4.0-rc.4"
+version = "0.4.0"
 edition = "2021"
 license = "BSD-4-Clause"
 authors = ["Kestrel <kestrel@flying-kestrel.ca>"]

+ 9 - 9
microrm-macros/src/lib.rs

@@ -13,7 +13,7 @@ mod index;
 /// - Defines and derives `EntityPart` for each field in the source structure,
 /// - Defines an `EntityID` type,
 /// - Derives a `std::fmt::Debug` implementation for the structure that handles some of the
-/// `microrm::schema` types nicely.
+///   `microrm::schema` types nicely.
 ///
 /// The prerequisites for this macro are:
 /// - Must be applied on a struct with named fields,
@@ -21,16 +21,16 @@ mod index;
 ///
 /// Three attributes, applied to fields, modify the behaviour of the generation as follows:
 /// - The `unique` attribute causes the resulting sqlite table to attach a unique constraint for
-/// the given column. Note that this is a restriction that is applied per-column, not over all
-/// columns tagged with `#[unique]`.
+///   the given column. Note that this is a restriction that is applied per-column, not over all
+///   columns tagged with `#[unique]`.
 /// - The `elide` attribute removes the datum field from several end-user-visible iterations, such
-/// as the `Debug` impl. Useful for hiding fields that hold secret information that shouldn't be
-/// visible in log files.
+///   as the `Debug` impl. Useful for hiding fields that hold secret information that shouldn't be
+///   visible in log files.
 /// - The `key` attribute adds a field to the search key defined for this entity, for smoother
-/// access. This attribute can be applied to multiple fields, and the key-uniqueness constraint is
-/// applied across the tuple of all columns with the attribute. Note that this is not _quite_ the
-/// primary key for the table, as internally the integral ID is used as the primary key; it can be
-/// thought of as the 'secondary key' for the table.
+///   access. This attribute can be applied to multiple fields, and the key-uniqueness constraint is
+///   applied across the tuple of all columns with the attribute. Note that this is not _quite_ the
+///   primary key for the table, as internally the integral ID is used as the primary key; it can be
+///   thought of as the 'secondary key' for the table.
 ///
 /// For example:
 ///

+ 1 - 1
microrm/Cargo.toml

@@ -1,6 +1,6 @@
 [package]
 name = "microrm"
-version = "0.4.0-rc.5"
+version = "0.4.0"
 edition = "2021"
 license = "BSD-4-Clause"
 authors = ["Kestrel <kestrel@flying-kestrel.ca>"]

+ 8 - 8
microrm/src/lib.rs

@@ -10,12 +10,12 @@
 //!
 //! There are three externally-facing components in microrm:
 //! - Object modelling (via the [`Datum`](schema/datum/trait.Datum.html) and
-//! [`Entity`](schema/entity/trait.Entity.html) traits)
+//!   [`Entity`](schema/entity/trait.Entity.html) traits)
 //! - Database querying (via [`Queryable`](prelude/trait.Queryable.html),
-//! [`RelationInterface`](prelude/trait.RelationInterface.html) and
-//! [`Insertable`](prelude/trait.Insertable.html) traits)
+//!   [`RelationInterface`](prelude/trait.RelationInterface.html) and
+//!   [`Insertable`](prelude/trait.Insertable.html) traits)
 //! - Command-line interface generation via the [`clap`](https://docs.rs/clap/latest/clap/) crate
-//! (see [`cli::Autogenerate`] and [`cli::EntityInterface`]; requires the optional crate feature `clap`)
+//!   (see [`cli::Autogenerate`] and [`cli::EntityInterface`]; requires the optional crate feature `clap`)
 //!
 //! microrm pushes the Rust type system somewhat to provide better ergonomics, so the MSRV is
 //! currently 1.75. Don't be scared off by the web of traits in the `schema` module --- you should
@@ -102,6 +102,7 @@
 //!     pub cost: f64,
 //! }
 //!
+//! // define a relation between customers and orders
 //! pub struct CustomerOrders;
 //! impl microrm::Relation for CustomerOrders {
 //!     type Domain = Customer;
@@ -145,7 +146,7 @@
 //!
 //!     pub billing_address: Option<String>,
 //!
-//!     // we'll assume for now that there's no product multiplicities
+//!     // we'll assume for now that there's no product multiplicities, i.e. this is not a multiset
 //!     pub contents: microrm::RelationMap<Product>,
 //! }
 //!
@@ -201,7 +202,7 @@
 //! // process the payment for our order by updating the entity
 //! order1.order_state.as_mut().push(
 //!     OrderState::PaymentReceived {
-//!         confirmation: "money received in full, promise".into()
+//!         confirmation: "money received in full, i promise".into()
 //!     }
 //! );
 //!
@@ -213,9 +214,8 @@
 //! ```
 
 #![warn(missing_docs)]
-
 // this requires clippy 1.78
-// #![warn(clippy::empty_docs)]
+#![warn(clippy::empty_docs)]
 
 // to make the proc_macros work inside the microrm crate; needed for tests and the metaschema.
 extern crate self as microrm;

+ 2 - 2
microrm/src/schema/datum.rs

@@ -129,10 +129,10 @@ pub trait DatumVisitor {
 /// stand in for `Y` during a query. For example, the following should be true:
 /// 1. for datum `T`, `&T` should implement `QueryEquivalent<T>`
 ///     - rationale: you should be able to query for something matching a value without passing an
-///     owned value
+///       owned value
 /// 2. for datum `T`, `StringQuery` should implement `QueryEquivalent<T>`
 ///     - rationale: `StringQuery` explicitly shoves off equality checking to sqlite, which means
-///     you should be able to use it in any query place.
+///       you should be able to use it in any query place.
 ///
 /// Note that this is abstracted across [`ConcreteDatum`] and not [`Datum`]; this is to avoid
 /// issues with [`StringQuery`] -- which is not concrete -- having two implementations of