Skip to content

Commit

Permalink
chore: more fixes, more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
m4tx committed Jan 7, 2025
1 parent de82f60 commit c19c3c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion flareon/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ impl DatabaseError {
}
}

/// An alias for [`Result`] that uses [`DatabaseError`] as the error type.
pub type Result<T> = std::result::Result<T, DatabaseError>;

/// A model trait for database models.
Expand Down Expand Up @@ -211,6 +212,8 @@ impl Column {
}
}

/// A marker trait that denotes that a type can be used as a primary key in a
/// database.
pub trait PrimaryKey: DatabaseField + Clone {}

/// A row structure that holds the data of a single row retrieved from the
Expand Down Expand Up @@ -913,7 +916,7 @@ pub struct RowsNum(pub u64);
/// ```
/// use flareon::db::{model, Auto, Model};
/// # use flareon::db::migrations::{Field, Operation};
/// # use flareon::db::{Database, Identifier};
/// # use flareon::db::{Database, Identifier, DatabaseField};
/// # use flareon::Result;
///
/// #[model]
Expand Down Expand Up @@ -1025,6 +1028,8 @@ impl<const LIMIT: u32> PartialEq<LimitedString<LIMIT>> for String {
}
}

/// An error returned by [`LimitedString::new`] when the string is longer than
/// the specified limit.
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Error)]
#[error("string is too long ({length} > {LIMIT})")]
pub struct NewLimitedStringError<const LIMIT: u32> {
Expand Down
2 changes: 1 addition & 1 deletion flareon/src/db/relations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl From<ForeignKeyOnDeletePolicy> for sea_query::ForeignKeyAction {
}
}

/// A foreign key on delete constraint.
/// A foreign key on update constraint.
///
/// This is used to define the behavior of a foreign key when the referenced row
/// is updated.
Expand Down

0 comments on commit c19c3c1

Please sign in to comment.