Comments (1)
After revisiting the SeaORM documentation, I've resolved the issue I encountered with the mock database while trying to mock the creation of an instance. The root cause was a misunderstanding of how the MockDatabase is intended to function, specifically regarding the use of append_query_results and append_exec_results.
To address the Type("A null value was encountered while decoding "id"") error, it was essential to properly simulate the database operations. For the example provided, both the creation of friendships::ActiveModel and the expected insert operation needed to be reflected in the mock setup—append_query_results for the select operations and append_exec_results for the insert/update/delete operations.
This clarification made it evident that the mock database doesn't act merely as a container but requires explicit setup for each type of database operation to accurately test the behavior of the code under different conditions.
I recommend enhancing the documentation to more clearly explain the interaction between append_query_results and append_exec_results, especially for new users of SeaORM. This guidance could prevent similar misunderstandings in the future. The documentation at https://www.sea-ql.org/SeaORM/docs/write-test/mock/ would be a great place for such detailed examples and explanations.
I'm closing this issue as it was resolved through a better understanding of the documentation and the intended use of SeaORM's mocking capabilities. Thank you.
from sea-orm.
Related Issues (20)
- Missing primary_key attributes when generating from a DB with partitions HOT 2
- doc: code blocks looks weird in light mode HOT 7
- Incorrect Route Matching Behavior in Actix Example Code HOT 1
- no column found for name: A_
- Missing okapi support HOT 1
- Insert to mysql, can find data inserted in mysql but the method returns with Err(RecordNotFound("Failed to find inserted item")). HOT 1
- Issues with tables that do not have primary/unique keys
- Insert an active model and get back the last insert id doesn't work with autoincrement
- Enum column named "model" generates code that conflicts with the struct Model
- ambiguous associated type when access Entity::Column HOT 5
- TimestampWithTimeZone returned as array
- Allow Defaulting `string_value` For ActiveEnum Based On Renaming Rules On Variants HOT 1
- transaction use probelm with state
- Sea-ORM still includes sqlx-mysql dependency even when no mysql feature is enabled
- sea-orm-migration - Compile error using most recent version of rc2 HOT 12
- Missing downward feature `runtime-tokio`. HOT 4
- sea-orm-cli generate error HOT 1
- .money_len type creates invalid SQL HOT 1
- Compilation error when building with sqlx-sqlite and runtime-async-std-rustls HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sea-orm.