notification

package
v0.0.0-...-70c8363 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SEL_NOTIFICATION_SINGLE   = `SELECT * from notifications WHERE id = $1`
	SEL_NOTIFICATIONS_SINCE   = `SELECT * from notifications WHERE created_on >= $1 AND heard = $2`
	SEL_NOTIFICATIONS_UNHEARD = `SELECT * from notifications WHERE heard = %d`
)
View Source
const (
	// Priorities
	PRIO_LOW  = 10
	PRIO_MED  = 20
	PRIO_HIGH = 30

	// Actions
	ACT_POLL = 10
	ACT_PUSH = 20

	// Heard status
	HRD_UNHEARD = 10
	HRD_HEARD   = 20
)
View Source
const (
	INSERT_NOTIFICATION = `` /* 216-byte string literal not displayed */

)
View Source
const (
	MARK_HEARD_NOTIFICATION = `UPDATE notifications
	SET
	heard=%d
	WHERE
	id in %s`
)

Variables

This section is empty.

Functions

func MarkHeard

func MarkHeard(conn *sqlx.DB, unheardIds []int) (err error)

Types

type Notification

type Notification struct {
	Id        int       `json:"id" db:"id"`
	Title     string    `json:"title" db:"title"`
	Url       string    `json:"url, omitempty" db:"url"`
	Key       string    `json:"key" db:"key"`
	Heard     int       `json:"heard" db:"heard"`
	Provider  int       `json:"provider" db:"provider"`
	CreatedOn time.Time `json:"created_on, omitempty" db:"created_on"`
	Priority  int       `json:"priority" db:"priority"`
	Action    int       `json:"action" db:"action"`

	// this exists to enable providers to push without knowing their id
	ProviderName string `json:"provider_name, omitempty" db:"provider_name"`
}

func GetSince

func GetSince(conn *sqlx.DB, since time.Time) (n []*Notification, err error)

func GetSingle

func GetSingle(conn *sqlx.DB, id int) (n *Notification, err error)

func GetUnheard

func GetUnheard(conn *sqlx.DB) (n []*Notification, err error)

func (*Notification) Insert

func (self *Notification) Insert(conn *sqlx.DB) (err error)

func (*Notification) ValidInsert

func (self *Notification) ValidInsert() error

Jump to

Keyboard shortcuts

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