You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[56.799ms] [rows:0] SELECT * FROM "posts" WHERE "posts"."parent_id" = '354fd551-96f0-4899-a7d7-e38ef524636f' AND "posts"."deleted_at" IS NULL
[56.020ms] [rows:1] SELECT * FROM "users" WHERE "users"."id" = '129f1a32-ad18-49f1-b989-b6cd4c243e30' AND "users"."deleted_at" IS NULL
[469.482ms] [rows:1] SELECT posts.*,
EXISTS (
SELECT 1
FROM like_user_posts
WHERE like_user_posts.post_id = posts.id AND like_user_posts.user_id = '7dfdf978-9706-4720-aa3f-382af4b14f70'
) AS is_liked
FROM "posts" WHERE posts.id = '354fd551-96f0-4899-a7d7-e38ef524636f' AND "posts"."deleted_at" IS NULL ORDER BY "posts"."id" LIMIT 1
ParentPost preload is wrong, actually the parent_id of the post is 6d591d06-80ee-4cf3-9695-e1eb986d7885, but it puts the post id in as 354fd551-96f0-4899-a7d7-e38ef524636f to perform preload
when i do the mappingFirst(&models.Post) parent post is preloaded correctly, but when i use PostWithLiked model then preload parentPost uses id of original post instead of parent_id. Please help me.
The text was updated successfully, but these errors were encountered:
The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking ✨
First, I have the
Post
model, which has been migrated to the database:Next, I have a similar model, but with an additional field isLiked, this model is not migrated and is only used to map from Post model to
This is the function to execute the query
Here is the query result
ParentPost preload is wrong, actually the parent_id of the post is 6d591d06-80ee-4cf3-9695-e1eb986d7885, but it puts the post id in as 354fd551-96f0-4899-a7d7-e38ef524636f to perform preload
when i do the mappingFirst(&models.Post) parent post is preloaded correctly, but when i use PostWithLiked model then preload parentPost uses id of original post instead of parent_id. Please help me.
The text was updated successfully, but these errors were encountered: