Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PLATFORM-1504]: Examples are not compiling with rust 1.75 #189

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM public.ecr.aws/prima/rust:1.69.0
FROM public.ecr.aws/prima/rust:1.75.0

WORKDIR /code

COPY entrypoint /code/entrypoint

RUN cargo install sqlx-cli --no-default-features --features native-tls,postgres --version 0.6.2
RUN cargo install sqlx-cli --no-default-features --features native-tls,postgres --version 0.7.1

RUN chown -R app:app /code

Expand Down
5 changes: 4 additions & 1 deletion examples/aggregate_deletion/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::store::{EventStore, StoreEvent};
use esrs::AggregateState;

use crate::common::{new_pool, BasicAggregate, BasicCommand, BasicError, BasicEvent, BasicEventHandler, BasicView};
use crate::common::basic::event_handler::BasicEventHandler;
use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicCommand, BasicError, BasicEvent};
use crate::common::util::new_pool;

#[path = "../common/lib.rs"]
mod common;
Expand Down
3 changes: 2 additions & 1 deletion examples/common/basic/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use uuid::Uuid;
use esrs::handler::EventHandler;
use esrs::store::StoreEvent;

use crate::common::{BasicAggregate, BasicEvent, BasicView};
use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicEvent};

#[derive(Clone)]
pub struct BasicEventHandler {
Expand Down
6 changes: 2 additions & 4 deletions examples/common/basic/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
use serde::{Deserialize, Serialize};

use esrs::Aggregate;
pub use event_handler::*;
pub use view::*;

mod event_handler;
mod view;
pub mod event_handler;
pub mod view;

#[derive(Clone)]
pub struct BasicAggregate;
Expand Down
2 changes: 1 addition & 1 deletion examples/common/basic/view.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sqlx::{Executor, Pool, Postgres};
use uuid::Uuid;

use crate::common::random_letters;
use crate::common::util::random_letters;

#[derive(sqlx::FromRow, Debug)]
pub struct BasicViewRow {
Expand Down
18 changes: 5 additions & 13 deletions examples/common/lib.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
//! Common structs shared between all the other examples

pub use a::*;
pub use b::*;
pub mod a;
pub mod b;
#[cfg(feature = "postgres")]
pub use basic::*;
#[cfg(feature = "postgres")]
pub use shared::*;
pub use util::*;

mod a;
mod b;
#[cfg(feature = "postgres")]
mod basic;
pub mod basic;

#[allow(dead_code)]
#[cfg(feature = "postgres")]
mod shared;
pub mod shared;

mod util;
pub mod util;

#[derive(Debug, thiserror::Error)]
pub enum CommonError {}
4 changes: 3 additions & 1 deletion examples/common/shared/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ use sqlx::{Pool, Postgres};
use esrs::handler::{EventHandler, ReplayableEventHandler};
use esrs::store::StoreEvent;

use crate::common::{AggregateA, AggregateB, EventA, EventB, SharedView, UpsertSharedView};
use crate::common::a::{AggregateA, EventA};
use crate::common::b::{AggregateB, EventB};
use crate::common::shared::view::{SharedView, UpsertSharedView};

#[derive(Clone)]
pub struct SharedEventHandler {
Expand Down
7 changes: 2 additions & 5 deletions examples/common/shared/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
pub use event_handler::*;
pub use view::*;

mod event_handler;
mod view;
pub mod event_handler;
pub mod view;
2 changes: 1 addition & 1 deletion examples/common/shared/view.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use sqlx::{Executor, Pool, Postgres};
use uuid::Uuid;

use crate::common::random_letters;
use crate::common::util::random_letters;

#[derive(Clone)]
pub struct SharedView {
Expand Down
5 changes: 4 additions & 1 deletion examples/event_bus/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ use esrs::manager::AggregateManager;
use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::AggregateState;

use crate::common::{new_pool, random_letters, BasicAggregate, BasicCommand, BasicError, BasicEventHandler, BasicView};
use crate::common::basic::event_handler::BasicEventHandler;
use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicCommand, BasicError};
use crate::common::util::{new_pool, random_letters};
use crate::kafka::KafkaEventBusConsumer;
use crate::rabbit::RabbitEventBusConsumer;

Expand Down
2 changes: 1 addition & 1 deletion examples/event_bus/rabbit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use esrs::handler::EventHandler;
use esrs::store::StoreEvent;
use esrs::Aggregate;

use crate::common::random_letters;
use crate::common::util::random_letters;

pub struct RabbitEventBusConsumer<A> {
consumer: Consumer,
Expand Down
5 changes: 4 additions & 1 deletion examples/eventual_view/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ use esrs::manager::AggregateManager;
use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::AggregateState;

use crate::common::{new_pool, BasicAggregate, BasicCommand, BasicError, BasicEventHandler, BasicView};
use crate::common::basic::event_handler::BasicEventHandler;
use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicCommand, BasicError};
use crate::common::util::new_pool;

#[path = "../common/lib.rs"]
mod common;
Expand Down
3 changes: 2 additions & 1 deletion examples/locking_strategies/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::store::EventStore;
use esrs::AggregateState;

use crate::common::{new_pool, BasicAggregate, BasicCommand, BasicError, BasicEvent};
use crate::common::basic::{BasicAggregate, BasicCommand, BasicError, BasicEvent};
use crate::common::util::new_pool;

#[path = "../common/lib.rs"]
mod common;
Expand Down
9 changes: 6 additions & 3 deletions examples/multi_aggregate_rebuild/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::store::StoreEvent;
use esrs::AggregateState;

use crate::common::{
new_pool, AggregateA, AggregateB, CommandA, CommandB, CommonError, EventA, EventB, SharedEventHandler, SharedView,
};
use crate::common::a::{AggregateA, CommandA, EventA};
use crate::common::b::{AggregateB, CommandB, EventB};
use crate::common::shared::event_handler::SharedEventHandler;
use crate::common::shared::view::SharedView;
use crate::common::util::new_pool;
use crate::common::CommonError;
use crate::transactional_event_handler::SharedTransactionalEventHandler;

#[path = "../common/lib.rs"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ use esrs::handler::TransactionalEventHandler;
use esrs::store::postgres::PgStoreError;
use esrs::store::StoreEvent;

use crate::common::{AggregateA, AggregateB, EventA, EventB, SharedView, UpsertSharedView};
use crate::common::a::{AggregateA, EventA};
use crate::common::b::{AggregateB, EventB};
use crate::common::shared::view::{SharedView, UpsertSharedView};

#[derive(Clone)]
pub struct SharedTransactionalEventHandler {
Expand Down
10 changes: 4 additions & 6 deletions examples/readme/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
use sqlx::{PgConnection, Pool, Postgres};

use serde::{Deserialize, Serialize};
use sqlx::{PgConnection, Pool, Postgres};
use thiserror::Error;

use esrs::bus::EventBus;
use esrs::handler::{EventHandler, TransactionalEventHandler};
use esrs::manager::AggregateManager;
use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::store::StoreEvent;
use esrs::Aggregate;

use esrs::bus::EventBus;
use thiserror::Error;

use crate::common::new_pool;
use crate::common::util::new_pool;

#[path = "../common/lib.rs"]
mod common;
Expand Down
5 changes: 3 additions & 2 deletions examples/rebuilder/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ use sqlx::{Pool, Postgres};
use esrs::handler::{EventHandler, ReplayableEventHandler};
use esrs::store::StoreEvent;

use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicEvent};

/// This is just an example. The need of v1 and v2 is due to having both the version of this event
/// handler compiled in the code. In user codebase there will be only one `BasicEventHandler`
/// got modified.
use crate::common::{BasicAggregate, BasicEvent, BasicView};

#[derive(Clone)]
pub struct BasicEventHandlerV1 {
pub pool: Pool<Postgres>,
Expand Down
4 changes: 3 additions & 1 deletion examples/rebuilder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ use esrs::rebuilder::{PgRebuilder, Rebuilder};
use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::AggregateState;

use crate::common::{new_pool, BasicAggregate, BasicCommand, BasicError, BasicView};
use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicCommand, BasicError};
use crate::common::util::new_pool;
use crate::event_handler::{AnotherEventHandler, BasicEventHandlerV1, BasicEventHandlerV2};
use crate::transactional_event_handler::{BasicTransactionalEventHandlerV1, BasicTransactionalEventHandlerV2};

Expand Down
3 changes: 2 additions & 1 deletion examples/rebuilder/transactional_event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use esrs::handler::TransactionalEventHandler;
use esrs::store::postgres::PgStoreError;
use esrs::store::StoreEvent;

use crate::common::{BasicAggregate, BasicEvent, BasicView};
use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicEvent};

/// The `BasicTransactionalEventHandlerV1` and `BasicTransactionalEventHandlerV1` exists in this
/// example just for the sake of showing how a single transactional event handler, in this case called
Expand Down
3 changes: 2 additions & 1 deletion examples/saga/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ use esrs::store::EventStore;
use esrs::AggregateState;

use crate::aggregate::{SagaAggregate, SagaCommand, SagaEvent};
use crate::common::{new_pool, CommonError};
use crate::common::util::new_pool;
use crate::common::CommonError;
use crate::event_handler::SagaEventHandler;

mod aggregate;
Expand Down
9 changes: 6 additions & 3 deletions examples/shared_view/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@ use esrs::manager::AggregateManager;
use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::AggregateState;

use crate::common::{
new_pool, AggregateA, AggregateB, CommandA, CommandB, CommonError, SharedEventHandler, SharedView,
};
use crate::common::a::{AggregateA, CommandA};
use crate::common::b::{AggregateB, CommandB};
use crate::common::shared::event_handler::SharedEventHandler;
use crate::common::shared::view::SharedView;
use crate::common::util::new_pool;
use crate::common::CommonError;

#[path = "../common/lib.rs"]
mod common;
Expand Down
3 changes: 2 additions & 1 deletion examples/store_crud/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ use esrs::store::postgres::{PgStore, PgStoreBuilder};
use esrs::store::{EventStore, StoreEvent};
use esrs::AggregateState;

use crate::common::{new_pool, BasicAggregate, BasicEvent};
use crate::common::basic::{BasicAggregate, BasicEvent};
use crate::common::util::new_pool;

#[path = "../common/lib.rs"]
mod common;
Expand Down
4 changes: 3 additions & 1 deletion examples/transactional_view/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ use esrs::store::postgres::{PgStore, PgStoreBuilder, PgStoreError};
use esrs::store::EventStore;
use esrs::AggregateState;

use crate::common::{new_pool, BasicAggregate, BasicCommand, BasicError, BasicView, BasicViewRow};
use crate::common::basic::view::{BasicView, BasicViewRow};
use crate::common::basic::{BasicAggregate, BasicCommand, BasicError};
use crate::common::util::new_pool;
use crate::transactional_event_handler::BasicTransactionalEventHandler;

#[path = "../common/lib.rs"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use esrs::handler::TransactionalEventHandler;
use esrs::store::postgres::PgStoreError;
use esrs::store::StoreEvent;

use crate::common::{BasicAggregate, BasicEvent, BasicView};
use crate::common::basic::view::BasicView;
use crate::common::basic::{BasicAggregate, BasicEvent};

pub struct BasicTransactionalEventHandler {
pub view: BasicView,
Expand Down
Loading