db

package
v0.0.0-...-149ce59 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2018 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	Setup() error

	AddAlert(alert ...*cap.Alert) error
	AlertExists(reference *cap.Reference) (bool, error)
	GetAlert(reference *cap.Reference) (*cap.Alert, error)
	GetAlertById(id string) (*cap.Alert, error)

	NewInfoFinder() InfoFinder
}

type InfoFinder

type InfoFinder interface {
	AlertId(id string) InfoFinder

	// Filter
	Superseded(superseded bool) InfoFinder
	Status(status cap.Status) InfoFinder
	MessageType(messageType cap.MessageType) InfoFinder
	Scope(scope cap.Scope) InfoFinder

	Language(language string) InfoFinder
	Certainty(certainty cap.Certainty) InfoFinder
	Severity(severity cap.Severity) InfoFinder
	Urgency(urgency cap.Urgency) InfoFinder
	Headline(headline string) InfoFinder
	Description(description string) InfoFinder
	Instruction(instruction string) InfoFinder
	EffectiveGte(t time.Time) InfoFinder
	EffectiveGt(t time.Time) InfoFinder
	EffectiveLte(t time.Time) InfoFinder
	EffectiveLt(t time.Time) InfoFinder
	ExpiresGte(t time.Time) InfoFinder
	ExpiresGt(t time.Time) InfoFinder
	ExpiresLte(t time.Time) InfoFinder
	ExpiresLt(t time.Time) InfoFinder
	OnsetGte(t time.Time) InfoFinder
	OnsetGt(t time.Time) InfoFinder
	OnsetLte(t time.Time) InfoFinder
	OnsetLt(t time.Time) InfoFinder

	Area(area string) InfoFinder
	Point(lat, lon float64) InfoFinder

	// Pagination
	Start(start int) InfoFinder
	Count(count int) InfoFinder

	// Sorting
	Sort(fields ...string) InfoFinder

	Find() (*InfoResults, error)
}

type InfoHit

type InfoHit struct {
	Id      string    `json:"id"`
	AlertId string    `json:"alert_id"`
	Info    *cap.Info `json:"info"`
}

type InfoResults

type InfoResults struct {
	TotalHits int64      `json:"total_hits"`
	Hits      []*InfoHit `json:"hits"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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