Lines
90 %
Functions
33.33 %
Branches
100 %
use crate::{
schema::{Schema, SchemaName, Schematic},
Error,
};
#[doc(hidden)]
pub mod database;
#[cfg(feature = "multiuser")]
pub mod group;
pub mod role;
pub mod user;
pub use self::database::Database;
pub use self::{group::PermissionGroup, role::Role, user::User};
/// The `BonsaiDb` administration schema.
#[derive(Debug)]
pub struct Admin;
impl Schema for Admin {
fn schema_name() -> SchemaName {
SchemaName::new("khonsulabs", "bonsaidb-admin")
}
fn define_collections(schema: &mut Schematic) -> Result<(), Error> {
schema.define_collection::<database::Database>()?;
{
schema.define_collection::<group::PermissionGroup>()?;
schema.define_collection::<role::Role>()?;
schema.define_collection::<user::User>()?;
Ok(())
/// The name of the admin database.
pub const ADMIN_DATABASE_NAME: &str = "_admin";