Create a golang in-memory key/value store.
Any coding tools, googling, etc are allowed. Best practices can be skipped as long as they're called out when they occur.
The Structured fields for an entity should be:
type Entity struct {
Key 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 entity for Key
Delete: Remove an entity by Key
List: list entities with query modifiers:
- Filtering:
Labels
- any of the provided labels
package main
type Entity struct {
Key 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
}