Module prelude

Module prelude 

Source
Expand description

Prelude exposes all the types for ic-dbms-api crate.

Structs§

Blob
Blob data type for the DBMS.
Boolean
Boolean data type for the DBMS.
CamelCaseValidator
A validator for CamelCase strings.
ClampSanitizer
Sanitizer that clamps integer values within a specified range.
ClampUnsignedSanitizer
Sanitizer that clamps unsigned integer values within a specified range.
CollapseWhitespaceSanitizer
Sanitizer that collapses multiple whitespace characters into a single space in strings.
ColumnDef
Defines a column in a database table.
CountryIso639Validator
Validator for ISO639 country codes.
CountryIso3166Validator
Validator for ISO3166 country codes.
Date
Date data type for the DBMS.
DateTime
Date time data type for the DBMS.
Decimal
Decimal data type for the DBMS.
EmailValidator
A validator for email addresses.
ForeignKeyDef
Defines a foreign key relationship for a column.
IcDbmsCanisterInitArgs
IcDbmsCanisterUpgradeArgs
Int8
An integer type wrapper around a primitive integer type.
Int16
An integer type wrapper around a primitive integer type.
Int32
An integer type wrapper around a primitive integer type.
Int64
An integer type wrapper around a primitive integer type.
KebabCaseValidator
A validator for kebab-case strings.
LowerCaseSanitizer
Sanitizer that converts strings to lowercase.
MaxStrlenValidator
A validator that checks if the length of a string does not exceed a maximum length.
MimeTypeValidator
A validator that checks if a string is a valid MIME type.
MinStrlenValidator
A validator that checks if the length of a string is at least a minimum length.
NoForeignFetcher
A no-op foreign fetcher that does not perform any fetching.
NullIfEmptySanitizer
The NullIfEmptySanitizer struct is used to sanitize input by converting empty strings to null values.
PhoneNumberValidator
A validator for phone numbers.
Principal
Principal data type for the DBMS.
Query
A struct representing a query in the DBMS.
QueryBuilder
A builder for constructing database Queryes.
RangeStrlenValidator
A validator that checks if the length of a string is within a specified range.
RgbColorValidator
A validator for RGB color strings.
RoundToScaleSanitizer
Sanitizer that rounds rust_decimal::Decimal values to a specified scale.
SlugSanitizer
Sanitizer sluggifies strings by converting them to lowercase, replacing spaces with hyphens, and removing non-alphanumeric characters.
SnakeCaseValidator
A validator for snake_case strings.
Text
Text data type for the DBMS.
TimezoneSanitizer
Sanitizer that ensures that all crate::prelude::DateTime values are within a specific timezone.
TrimSanitizer
Sanitizer that trims leading and trailing whitespace from strings.
Uint8
An integer type wrapper around a primitive integer type.
Uint16
An integer type wrapper around a primitive integer type.
Uint32
An integer type wrapper around a primitive integer type.
Uint64
An integer type wrapper around a primitive integer type.
UpperCaseSanitizer
Sanitizer that converts strings to uppercase.
UrlEncodingSanitizer
Sanitizer URL-encodes strings by converting them to percent-encoded format.
UrlValidator
A validator that checks if a string is a valid URL.
UtcSanitizer
Sanitizer that ensures that all crate::prelude::DateTime values are within the UTC timezone.
Uuid
UUID data type for the DBMS.

Enums§

DataSize
Represents the size of data types used in the DBMS canister.
DataTypeKind
An enumeration of all supported data type kinds in the DBMS.
DecodeError
An enum representing possible decoding errors.
DeleteBehavior
Defines the behavior for delete operations regarding foreign key constraints.
Filter
super::Query filters.
IcDbmsCanisterArgs
Arguments for initializing or updating an IC DBMS canister.
IcDbmsError
IcDbms Error type
MemoryError
An enum representing possible memory-related errors.
Nullable
Nullable data type for the DBMS.
OrderDirection
An enum representing the direction of ordering in a query.
QueryError
An enum representing possible errors that can occur during query operations.
Select
An enum representing the fields to select in a query.
TableError
Table related errors
TransactionError
An enum representing possible errors that can occur during transaction operations.
Value
A generic wrapper enum to hold any DBMS value.
ValuesSource
Indicates the source of the column values.

Constants§

DEFAULT_ALIGNMENT
Default alignment in bytes for DataSize::Dynamic data types.

Traits§

DataType
A trait representing a data type that can be stored in the DBMS.
Database
This module defines the Database trait and related database functionalities.
Encode
This trait defines the encoding and decoding behaviour for data types used in the DBMS canister.
ForeignFetcher
This trait defines the behavior of a foreign fetcher, which is responsible for fetching data from foreign sources or databases.
InsertRecord
This trait represents a record for inserting into a table.
Sanitize
Trait for sanitizing Values.
TableRecord
This trait represents a record returned by a crate::dbms::query::Query for a table.
TableSchema
Table schema representation.
UpdateRecord
This trait represents a record for updating a table.
Validate
Trait for validating crate::prelude::Values.

Functions§

self_reference_values
Helper function which takes a list of (ValuesSource, Value) tuples, take only those with ValuesSource::Foreign matching the provided table and column names, and returns a vector of the corresponding Values. with the ValuesSource set to ValuesSource::This.

Type Aliases§

IcDbmsResult
IcDbms Result type
MSize
Size type for memory operations.
MemoryResult
The result type for memory operations.
Page
Type identifying a memory page number.
PageOffset
Type identifying an offset within a memory page.
QueryResult
The result type for query operations.
TableColumns
TableFingerprint
A type representing a unique fingerprint for a table schema.
TransactionId
Type alias for Transaction ID

Derive Macros§

Encode
Automatically implements the `Encode`` trait for a struct.
Table
Given a struct representing a database table, automatically implements the TableSchema trait with all the necessary types to work with the ic-dbms-canister. So given this struct: