Create a golang in-momory key/value store.
Any coding tools, googling, etc are allowed. Best practices can be skipped as long as theyre called out when they occur.
The Structured fields for an object should be:
type Entry struct {
ID string
CreatedAt time.Time
Labels []string
Data any
}
The data storage mechanism should be an in-memory data structure defined in your code.
Create: Add an entry for ID
Delete: Remove an entry by ID
List: list entries with query modifiers:
- Filtering:
Labels
- any of the provided labels
package main
type Entry struct {
ID string
CreatedAt time.Time
Labels []string
Data any
}
func main () {
// Add A with labels [1]
// Add B with labels [1,2]
// Add C with labels [3]
// List - returns all 3
// List with labels [1] - returns A, B
// List with labels [2] returns B
// List with labels [2,3] returns B, C
// Delete A
// List - returns B, C
}