Documentation ¶
Index ¶
- func AddNotificationToMongo(mongoHostURL string, mongoRootUsername string, mongoRootPassword string, ...) error
- func CheckNotificationExistsInMongoCollection(ctx context.Context, notification NotificationMongo, ...) (*bool, error)
- func ConnectToMongo(mongoURL string, mongoRootUsername string, mongoRootPassword string) (context.Context, *mongo.Client, context.CancelFunc, error)
- func GetMongoCollection(mongoClient *mongo.Client, databaseName string, collectionName string) *mongo.Collection
- type Notification
- type NotificationMongo
- type NotificationResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNotificationToMongo ¶ added in v1.1.0
func AddNotificationToMongo(mongoHostURL string, mongoRootUsername string, mongoRootPassword string, draw string, year int, owner string, number string, finalPrize float64, origin string) error
AddNotificationToMongo add a Document with Notification struct to mongoHost
func CheckNotificationExistsInMongoCollection ¶ added in v1.1.0
func CheckNotificationExistsInMongoCollection(ctx context.Context, notification NotificationMongo, mongoCollection *mongo.Collection) (*bool, error)
CheckNotificationExistsInMongoCollection checks is a Document that uses NotificationMongo struct exists in a specific collection
func ConnectToMongo ¶ added in v1.1.0
func ConnectToMongo(mongoURL string, mongoRootUsername string, mongoRootPassword string) (context.Context, *mongo.Client, context.CancelFunc, error)
ConnectToMongo check if is possible connect to mongo host provided and returns a mongoClient for interact with these host
func GetMongoCollection ¶ added in v1.1.0
func GetMongoCollection(mongoClient *mongo.Client, databaseName string, collectionName string) *mongo.Collection
GetMongoCollection obtain a collection into a specific database in mongo
Types ¶
type Notification ¶
type Notification struct { Token string `json:"token"` User string `json:"user"` Message string `json:"message"` }
Notification struct which contain information about notification for PushOver app
type NotificationMongo ¶ added in v1.1.0
type NotificationMongo struct { ID primitive.ObjectID `bson:"_id,omitempty"` Draw string `bson:"draw"` Year int `bson:"year"` Owner string `bson:"owner"` Number string `bson:"number"` Prize float64 `bson:"prize"` Origin string `bson:"origin"` Notified bool `bson:"notified"` }
NotificationMongo struct which contain information about notification send with a number result with prize
type NotificationResult ¶
NotificationResult struct which contain information about notification result for PushOver app
func SendPushOverNotification ¶
func SendPushOverNotification(owner string, finalPrize float64, number string, origin string) (*NotificationResult, error)
SendPushOverNotification makes a notification with pushOver to warn that a prize has been won