Expand description
§webgates-repositories
Repository traits, in-memory implementations, and storage backends for webgates applications.
This crate is the persistence layer of the workspace. It provides repository traits, in-memory implementations, optional database backends, shared repository errors, and repository-scoped workflows for common account operations.
§When to use this crate
Use webgates-repositories when you want:
- persistence contracts for accounts, secrets, groups, and permission mappings
- in-memory repositories for tests or local development
- SeaORM or SurrealDB storage backends
- session repository implementations for
webgates-sessions - repository-level services such as account insert and delete
§Key modules
Most developers should choose one layer first:
- start with
account_repository,secret_repository, or the other trait modules when defining a persistence boundary - start with
memorywhen you want zero-configuration repositories for tests or local development - move to
serviceswhen you want repository-scoped account workflows - enable
surrealdborsea_ormonly when you are ready to connect a real backend
Use these canonical module paths instead of crate-root shortcuts.
§Examples
In-memory repositories are the easiest way to get started:
use std::sync::Arc;
use webgates_core::groups::Group;
use webgates_core::roles::Role;
use webgates_repositories::memory::account::MemoryAccountRepository;
use webgates_repositories::memory::secret::MemorySecretRepository;
let accounts = Arc::new(MemoryAccountRepository::<Role, Group>::default());
let secrets = Arc::new(MemorySecretRepository::new_with_argon2_hasher().unwrap());
let _ = (accounts, secrets);§Getting started on docs.rs
A good reading order is:
account_repositoryandsecret_repositorymemoryservicessea_ormorsurrealdbif you need persistent storage
Modules§
- account_
repository - Account repository traits and contracts.
- audit
- Audit logging utilities for repository-scoped account workflows.
- comma_
separated_ value - Comma-separated value conversion trait for SeaORM storage.
- errors
- Error types and result aliases for repository implementations.
- group_
repository - Group repository traits and contracts.
- memory
- In-memory repository implementations for development and testing.
- permission_
mapping_ repository - Permission-mapping repository traits and contracts.
- sea_orm
- SeaORM repository integration.
- secret_
repository - Secret repository traits and contracts.
- services
- Repository-level services for common account workflows.
- surrealdb
- SurrealDB-backed repositories.
Enums§
- Table
Name - Canonical table or collection names shared by storage backends.