There are many times when you need to add new parameters to an existing item that is already in the store. One way to do this is to get the existing item, add/combine/merge the new stuff, and then replace the existing item with the new merged item.
But what if we could provide that functionality in the store? Hmm, for this to work, the Data Store would have to define what types of data can be merged together and how to do it. That means the Data Store is no longer data agnostic.
As an exercise, let’s define a merge feature that allows for 2 arrays to be merged together. In this episode, we’ll talk through the scenarios and decision logic.
Your functions are bloated. Put them on a diet. Think "skinny" and "as few lines as possible."
Total Lab Runtime: 02:39:26
- 1 Planning Introductionfree 02:50
- 2 What is a Data Store?free 03:51
- 3 Defining the Basics of a Data Storepro 09:19
- 4 Document the Basicspro 14:06
- 5 Simulate Store and Getpro 08:46
- 6 Identifying Items in the Storepro 17:07
- 7 Defining the Container: Data Type & Retainpro 16:48
- 8 Reviewfree 05:05
- 9 Feature: Check if Item Exists in Storepro 04:44
- 10 Feature: Remove an Item From the Storepro 06:53
- 11 Feature: Replace an Item in the Storepro 11:29
- 12 Feature: Merge with (Add To) Existing Itempro 10:33
- 13 Feature: Empty the Data Storepro 05:34
- 14 The Need for an APIpro 09:16
- 15 Document the API Basicspro 14:52
- 16 Global, But Controlled Accesspro 07:49
- 17 Push to GitHub, PR, Merge, & Syncpro 08:01
- 18 Wrap it Upfree 02:23