database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlertExist

func AlertExist(dbPath string, url string) (bool, error)

AlertExist :: Check if an alert already exist

func AlertSent

func AlertSent(dbPath string, url string) error

AlertSent :: Mark an alert as sent

func ConnectDatabase

func ConnectDatabase(dbPath string) (*gorm.DB, error)

ConnectDatabase :: Connect to sqlite database

func Migrations

func Migrations(dbPath string) error

Migrations :: Database migrations

func NewAlert

func NewAlert(dbPath string, alert *common.Alert) error

NewAlert :: Create a new alert

Types

type Alert

type Alert struct {
	gorm.Model
	Date   string
	Topic  string
	Title  string
	Source string
	URL    string `gorm:"unique;not null"`
	Sent   int
}

Alert :: Alert database model

func AlertToSend

func AlertToSend(dbPath string) (*Alert, error)

AlertToSend :: Retrieve the next alert that need to be sent

Jump to

Keyboard shortcuts

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