database

package
Version: v0.0.0-...-a1b785a Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2020 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

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL