Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

stepaniukm
Copy link
Contributor

@stepaniukm stepaniukm commented Mar 2, 2025

This PR introduces the first iteration of in memory database that is more compatible with Pongo, than the first tries. It is supposed to be the 3rd step from the issue: #179

}
}

export class ConcurrencyInMemoryDatabaseError extends EmmettError {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONCERN: @stepaniukm any reason why not use just regular ConcurrencyError?

@stepaniukm stepaniukm marked this pull request as draft March 3, 2025 13:11
} = {},
): DocumentsCollection<T> => {
const toFullId = (id: string) => `${collectionName}-${id}`;
const ensureCollectionCreated = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COMMENT: This is a bit redundant, but I think that's good to have, as we can later on add some other storages, like JSON or local storage or so.

store: (id: string, obj: T) => void;
delete: (id: string) => void;
get: (id: string) => T | null;
export interface DocumentsCollection<T extends Document> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUESTION: @stepaniukm, maybe we could already add in this PR find method that takes a regular filtering predicate? That'd close the basic set of features like find one and find many for read models.

{ operationName: 'replaceOne', collectionName, errors },
);
},
handle: (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIX: @stepaniukm could you add tests for that? You could copy them from Pongo :)

...result,
acknowledged: true,
successful: result.successful,
assertSuccessful: (errorMessage?: string) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FIX: @stepaniukm, could you add tests for that?

},
{ operationName: 'deleteOne', collectionName, errors },
);
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION: That's minor, but you can skip this else, as you're retuning the result in IF statement.

Suggested change
} else {
}

Copy link
Collaborator

@oskardudycz oskardudycz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stepaniukm looks great, added just a few minor comments and requests for enhancing test coverage, once that's done, I'm more than happy to pull that in 🙂 👍

@oskardudycz oskardudycz marked this pull request as ready for review March 6, 2025 10:50
@oskardudycz
Copy link
Collaborator

@stepaniukm, after our discussion, I'm pulling that in, as comments are not show-stoppers. Let's tackle them in the dedicated, follow-up PR 👍

@oskardudycz oskardudycz merged commit 4f56d07 into event-driven-io:main Mar 6, 2025
1 check passed
@oskardudycz oskardudycz added this to the 0.35.0 milestone Mar 6, 2025
@oskardudycz oskardudycz linked an issue Apr 25, 2025 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add inline projections to In Memory event store
2 participants