Skip to content

Commit 4f30fbe

Browse files
committed
chore: more fixes, more docs
1 parent de82f60 commit 4f30fbe

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

flareon/src/db.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ impl DatabaseError {
7373
}
7474
}
7575

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

7879
/// A model trait for database models.
@@ -211,6 +212,8 @@ impl Column {
211212
}
212213
}
213214

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

216219
/// A row structure that holds the data of a single row retrieved from the
@@ -913,7 +916,7 @@ pub struct RowsNum(pub u64);
913916
/// ```
914917
/// use flareon::db::{model, Auto, Model};
915918
/// # use flareon::db::migrations::{Field, Operation};
916-
/// # use flareon::db::{Database, Identifier};
919+
/// # use flareon::db::{Database, Identifier, DatabaseField};
917920
/// # use flareon::Result;
918921
///
919922
/// #[model]
@@ -925,7 +928,7 @@ pub struct RowsNum(pub u64);
925928
/// # async fn main() -> Result<()> {
926929
///
927930
/// # const OPERATION: Operation = Operation::create_model()
928-
/// # .table_name(Identifier::new("todoapp__my_model"))
931+
/// # .table_name(Identifier::new("my_model"))
929932
/// # .fields(&[
930933
/// # Field::new(Identifier::new("id"), <i32 as DatabaseField>::TYPE)
931934
/// # .primary_key()
@@ -1025,6 +1028,8 @@ impl<const LIMIT: u32> PartialEq<LimitedString<LIMIT>> for String {
10251028
}
10261029
}
10271030

1031+
/// An error returned by [`LimitedString::new`] when the string is longer than
1032+
/// the specified limit.
10281033
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Error)]
10291034
#[error("string is too long ({length} > {LIMIT})")]
10301035
pub struct NewLimitedStringError<const LIMIT: u32> {

flareon/src/db/relations.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl From<ForeignKeyOnDeletePolicy> for sea_query::ForeignKeyAction {
104104
}
105105
}
106106

107-
/// A foreign key on delete constraint.
107+
/// A foreign key on update constraint.
108108
///
109109
/// This is used to define the behavior of a foreign key when the referenced row
110110
/// is updated.

0 commit comments

Comments
 (0)