Skip to content

Commit 0c91a5a

Browse files
committed
Add some useful derives
1 parent 0ad52d0 commit 0c91a5a

File tree

10 files changed

+13
-13
lines changed

10 files changed

+13
-13
lines changed

src/database/db_connection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pub type DbConn = DatabaseConnection;
3838

3939
/// The type of database backend for real world databases.
4040
/// This is enabled by feature flags as specified in the crate documentation
41-
#[derive(Debug, Copy, Clone, PartialEq)]
41+
#[derive(Debug, Copy, Clone, PartialEq, Hash)]
4242
pub enum DatabaseBackend {
4343
/// A MySQL backend
4444
MySql,

src/database/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl SqlxConnectOptions {
7575
}
7676

7777
/// Defines the configuration options of a database
78-
#[derive(Debug)]
78+
#[derive(Debug, Clone)]
7979
pub struct ConnectOptions {
8080
/// The database sqlx::ConnectOptions used to connect to the database.
8181
pub(crate) connect_options: SqlxConnectOptions,

src/driver/sqlx_mysql.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::{
1818
use super::sqlx_common::*;
1919

2020
/// Defines the [sqlx::mysql] connector
21-
#[derive(Debug)]
21+
#[derive(Debug, PartialEq, Clone, Hash)]
2222
pub struct SqlxMySqlConnector;
2323

2424
/// Defines a sqlx MySQL pool

src/entity/column.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use sea_query::{Alias, BinOper, DynIden, Expr, SeaRc, SelectStatement, SimpleExp
33
use std::str::FromStr;
44

55
/// Defines a Column for an Entity
6-
#[derive(Debug, Clone, PartialEq)]
6+
#[derive(Debug, Clone, PartialEq, Hash)]
77
pub struct ColumnDef {
88
pub(crate) col_type: ColumnType,
99
pub(crate) null: bool,
@@ -12,7 +12,7 @@ pub struct ColumnDef {
1212
}
1313

1414
/// The type of column as defined in the SQL format
15-
#[derive(Debug, Clone, PartialEq)]
15+
#[derive(Debug, Clone, PartialEq, Hash)]
1616
pub enum ColumnType {
1717
/// `CHAR` type of specified fixed length
1818
Char(Option<u32>),

src/entity/relation.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ where
4242
}
4343

4444
/// Defines a relationship
45-
#[derive(Debug)]
45+
#[derive(Debug, Clone)]
4646
pub struct RelationDef {
4747
/// The type of relationship defined in [RelationType]
4848
pub rel_type: RelationType,

src/error.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/// An error from unsuccessful database operations
2-
#[derive(Debug, PartialEq)]
2+
#[derive(Debug, PartialEq, Clone, Hash)]
33
pub enum DbErr {
44
/// There was a problem with the database connection
55
Conn(String),
@@ -31,7 +31,7 @@ impl std::fmt::Display for DbErr {
3131
}
3232

3333
/// An error from a failed column operation when trying to convert the column to a string
34-
#[derive(Debug, Clone)]
34+
#[derive(Debug, PartialEq, Clone, Hash)]
3535
pub struct ColumnFromStrErr(pub String);
3636

3737
impl std::error::Error for ColumnFromStrErr {}

src/executor/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait TryGetable: Sized {
2727
}
2828

2929
/// An error from trying to get a row from a Model
30-
#[derive(Debug)]
30+
#[derive(Debug, PartialEq, Clone, Hash)]
3131
pub enum TryGetError {
3232
/// A database error was encountered as defined in [crate::DbErr]
3333
DbErr(DbErr),

src/metric.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub(crate) type Callback = Arc<dyn Fn(&Info<'_>) + Send + Sync>;
55
#[allow(unused_imports)]
66
pub(crate) use inner::{metric, metric_ok};
77

8-
#[derive(Debug)]
8+
#[derive(Debug, Clone, PartialEq)]
99
/// Query execution infos
1010
pub struct Info<'a> {
1111
/// Query executiuon duration

src/schema/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ mod entity;
44

55
/// This is a helper struct to convert [`EntityTrait`](crate::EntityTrait)
66
/// into different [`sea_query`](crate::sea_query) statements.
7-
#[derive(Debug)]
7+
#[derive(Debug, PartialEq, Clone, Hash)]
88
pub struct Schema {
99
backend: DbBackend,
1010
}

src/tests_cfg/entity_linked.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::entity::prelude::*;
22

3-
#[derive(Debug)]
3+
#[derive(Debug, PartialEq, Clone, Hash)]
44
pub struct CakeToFilling;
55

66
impl Linked for CakeToFilling {
@@ -16,7 +16,7 @@ impl Linked for CakeToFilling {
1616
}
1717
}
1818

19-
#[derive(Debug)]
19+
#[derive(Debug, PartialEq, Clone, Hash)]
2020
pub struct CakeToFillingVendor;
2121

2222
impl Linked for CakeToFillingVendor {

0 commit comments

Comments
 (0)