# Crate db_core

source · [−]
Expand description

## `mCaptcha` database operations

Traits and datastructures used in mCaptcha to interact with database.

To use an unsupported database with mCaptcha, traits present within this crate should be implemented.

### Organisation

Database functionality is divided across various modules:

- errors: error data structures used in this crate
- ops: meta operations like connection pool creation, migrations and getting connection from pool

## Re-exports

`pub use ops::GetConnection;`

## Modules

dev

useful imports for supporting a new database

errors

represents all the ways a trait can fail using this crate

ops

meta operations like migration and connecting to a database

prelude

useful imports for users working with a supported database

tests

Test utilities

## Structs

AddNotification

Data required to add notification

Captcha

Data representing a captcha

CreateCaptcha

data required to create new captcha

Level

Level struct that describes threshold-difficulty factor mapping

NameHash

type encapsulating username and hashed password of a user

Notification

Represents notification

Register

Data required to register a new user

Secret

datastructure representing a user’s secret

StatsUnixTimestamp

Captcha statistics with time recorded in UNIX epoch formats

TrafficPattern

User’s traffic pattern; used in generating a captcha configuration

UpdateEmail

data required to update them email of a user

## Enums

Login

types of credentials used as identifiers during login

## Traits

CloneSPDatabase

Trait to clone MCDatabase

MCDatabase

mCaptcha’s database requirements. To implement support for $Database, kindly implement this trait.