db

package
v0.0.0-...-d4864d5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package db provides helper functionality for interacting with the database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	*sql.DB
}

DB is a wrapper for the standard library DB object (via embedding), with some added helpers. This effectively emulates inheritance. Note that since this simply contains a pointer, we can recreate freely, no need to worry passing this by value.

func New

func New(path string) (DB, error)

New returns DB struct, given a valid path to the local database file.

func (DB) GetOutput

func (d DB) GetOutput(p PathTime) (string, error)

GetOutput returns the playbook output for a particular path and time. Will error if more than one that output is returned.

func (DB) GetPathTimes

func (d DB) GetPathTimes() ([]PathTime, error)

GetPathTimes returns the paths and start times of all previously executed runs.

func (DB) Init

func (d DB) Init() error

Init creates the required table for storing runs, if it doesn't exist already.

func (DB) Insert

func (d DB) Insert(r *playbook.Result) error

Insert adds the results of a playbook's execution to the database.

type PathTime

type PathTime struct {
	Path      string
	StartTime time.Time
}

PathTime is a minimal struct that associates a playbook path with a start time.

Jump to

Keyboard shortcuts

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