I have a structure of notifications, which looks like:
type Notification struct {
ID bson.ObjectId //unique id for this notification
ClientID bson.ObjectId //this identifies the client attached to
Description string //notification message
Date string //date using time.Now()
}
So in practice, I have a jumbled collection of data, for example: "User1 has been invited", "User3 has accepted their invite", "User2 has made a payment", "User3 has made a payment", "User1 has accepted their invite", etc, etc...
QUESTION: I don't know how many clients I may have at one time, but I want to be able to search the struct and find out how many unique ClientID's I have. My objective is to start creating a dynamic map where I'm attaching all of the notifications to their individual clients.
The final goal is to be able to pass to the front end (GoLang Template) a display report that looks like this?
ClientID(User1): "User1 has been invited", "User1 has accepted their invite"
ClientID(User2): "User2 has made a payment"
ClientID(User3): "User3 has accepted their invite", "User3 has made a payment"