Module bonsaidb_core::schema

source ·
Expand description

Types for defining database schema.


pub use self::view::map::Map;
pub use self::view::map::MappedValue;
pub use self::view::map::ViewMappedValue;
pub use self::view::CollectionViewSchema;
pub use self::view::DefaultViewSerialization;
pub use self::view::ReduceResult;
pub use self::view::SerializedView;
pub use self::view::View;
pub use self::view::ViewMapResult;
pub use self::view::ViewSchema;


Types for defining map/reduce-powered Views.


A future that resolves to an entry in a NamedCollection.
Retrieves a list of documents from a collection, when awaited. This structure also offers functions to customize the options for the operation.
The owner of a schema item. This should represent the company, group, or individual that created the item in question. This value is used for namespacing. Changing this after values are in use is not supported without manual migrations at this time.
The namespaced name of a Collection.
An error from inserting a CollectionDocument.
A name was unable to e parsed.
Retrieves a list of documents from a collection. This structure also offers functions to customize the options for the operation.
A schema name. Cloning is inexpensive.
A namespaced name.
The name of a Schema.
A collection of defined collections and views.
The name of a View.
A summary of a ViewSchema.


A reference to a collection that has a unique name view.


A namespaced collection of Document<Self> items and views.
A convenience trait for easily storing Serde-compatible types in documents.
A type that can be used as a unique reference for a collection that implements NamedCollection.
A collection with a unique name column.
Functions for creating qualified names
Defines a group of collections that are stored into a single database.
A collection that knows how to serialize and deserialize documents to an associated type.

Derive Macros

Derives the bonsaidb::core::schema::Collection trait. #[collection(authority = "Authority", name = "Name", views = [a, b, c])]
Derives the bonsaidb::core::schema::Schema trait. #[schema(name = "Name", authority = "Authority", collections = [A, B, C]), core = bonsaidb::core] authority, collections and core are optional
Derives the bonsaidb::core::schema::View trait. #[view(collection=CollectionType, key=KeyType, value=ValueType, name = "by-name")] name and value are optional