Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var RollbackError = errors.New("rollback this tx")
Functions ¶
Types ¶
type ScanAggr ¶
type ScanAggr struct { Host string `db:"host" json:"host"` NumberOfSamples int `db:"number_of_samples" json:"number_of_samples"` Up bool `db:"up" json:"up"` }
ScanAggr represents struct for scan aggregations over some interval
type ScanAggrStore ¶
type ScanAggrStore struct {
// contains filtered or unexported fields
}
ScanAggrStore is a struct ot access agggeration related db stuff
func NewDefaultScanAggrStore ¶
func NewDefaultScanAggrStore() *ScanAggrStore
NewDefaultScanAggrStore creates new store using default db connection
func NewScanAggrStore ¶
func NewScanAggrStore(dbh dbHandler) *ScanAggrStore
NewScanAggrStore creates new store using given db handler
func (*ScanAggrStore) AllScanAggregationsFor ¶
func (store *ScanAggrStore) AllScanAggregationsFor(interval time.Duration) ([]ScanAggr, error)
AllScanAggregationsFor returns scan agggerations for last interval
type ScanResult ¶
type ScanResult struct { ResultID int `db:"scan_result_id"` ScanIP string `db:"scan_ip"` Host string `db:"host"` Plaftorm string `db:"platform"` Up bool `db:"up"` CreatedAt time.Time `db:"created_at"` QueryData []byte `db:"query_data"` }
ScanResult represent record in a table
type ScanResultStore ¶
type ScanResultStore struct {
// contains filtered or unexported fields
}
ScanResultStore is a struct ot access scan results from db
func NewDefaultScanResultStore ¶
func NewDefaultScanResultStore() *ScanResultStore
NewDefaultScanResultStore creates new store using default db connection
func NewScanResultStore ¶
func NewScanResultStore(dbh dbHandler) *ScanResultStore
NewScanResultStore creates new store using given db handler
func (*ScanResultStore) AllScanResults ¶
func (store *ScanResultStore) AllScanResults() ([]*ScanResult, error)
AllScanResults returns all scan_results from db
func (*ScanResultStore) DeleteResultsOlderThan ¶
func (store *ScanResultStore) DeleteResultsOlderThan(age time.Duration) error
DeleteResultsOlderThan will delete all results older than given age
func (*ScanResultStore) SaveScanResult ¶
func (store *ScanResultStore) SaveScanResult(sr *ScanResult) error
SaveScanResult saves one given scan result
func (*ScanResultStore) SelectScanResults ¶
func (store *ScanResultStore) SelectScanResults(query string) ([]*ScanResult, error)
SelectScanResults selects scan results based on query