Expand description
§dbent - database entity types
Provides types for defining simple database entities and relationships in structs for when you don’t want to use an ORM but still want to organize your code in an object-oriented manner.
§Usage
This crate is on crates.io and can be
used by adding dbent
to your dependencies in your project’s Cargo.toml
.
[dependencies]
dbent = "0.1.0"
§Features
The following features are supported:
default
: enablesserde
andderive
features by defaultserde
: forserde
serializationrusqlite
: forrusqlite
ToSql and FromSql implementations for the Key typederive
: for the derive macrosEntity
andLabel
§Example
This was used for the world-tables app in the world-tables-base.
§License
Licensed under either of Apache License, Version 2.0 or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in dbent by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Modules§
- prelude
- Convenience re-export of common members
Structs§
Enums§
- Entity
- Enum for defining a simple entity that will hold a Key or the created/fetched data
- Entity
Label - Enum for situations when you want to define not just a Key but also a Label
- Error
- The error type for all errors in this crate
- Many
- Enum for defining one-to-many or many-to-many relationships
Traits§
- Keyed
- Trait for entities to define which struct field holds their primary key
- Label
- Trait for entities that optionally have a label defined
- Tagged
- Convenience trait for returning both key and label as a Tag
Type Aliases§
- Entity
Int - An Entity that has an Int as key
- Entity
Label Int - An EntityLabel that has an Int as key
- Entity
Label String - An EntityLabel that has a String as key
- Entity
String - An Entity that has a String as key
- Int
- An Int typedef for convenience to be used as Key number
- Result
- The result typedef for this crate for convenience