mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Uniquing an Object #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @PaulWoodIII on GitHub (Jul 31, 2015).
I've got a recommendation for some additional documentation, and by the way your documentation is great, Its obvious that you care so thats why I'm recommending some more
How to fetch or create a unique object, below is my current way of doing it but I'd like to know your way and I think others would like to know as well
@JohnEstropia commented on GitHub (Jul 31, 2015):
@PaulWoodIII
Personally I'll just write it like this
But that's totally just aesthetic preference and depends entirely on other requirements. You should be free to decide your own best practice.
Your comment's timing is really good though. The next in CoreStore's roadmap is Data importing utilities for transactions. While the fetch-or-create pattern is common, part of the optimization utilities I'm designing is for uniquing multiple objects when importing from an external source. In pseudo-code,
Instead of doing 1 fetch/create each loop, this saves a lot of I/O by doing all fetches in one request and just loop creation on the non-existent items.