notifications

package
v1.1.80 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 20, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

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

type NotificationResult struct {
	Status  int    `json:"status"`
	Request string `json:"request"`
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL