-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add separate abstraction for messages stored in mongo
- Loading branch information
1 parent
ace1be0
commit 3d702bc
Showing
5 changed files
with
52 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,21 @@ | ||
package models | ||
|
||
import "time" | ||
import ( | ||
"time" | ||
|
||
"go.mongodb.org/mongo-driver/bson" | ||
) | ||
|
||
// Message represents a chat message | ||
type Message struct { | ||
Timestamp time.Time `json:"timestamp" bson:"timestamp"` | ||
Payload string `json:"payload" bson:"payload"` | ||
Topic string `json:"topic" bson:"topic"` | ||
} | ||
|
||
// MongoMessage represents a chat message stored in Mongo. | ||
type MongoMessage struct { | ||
Timestamp int64 `bson:"timestamp"` | ||
Payload bson.M `bson:"original_payload"` | ||
Topic string `bson:"topic"` | ||
} |