db

package
v0.0.0-...-8562624 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateID

func GenerateID() string

Types

type ApiResult

type ApiResult struct {
	Status    int           `json:"status,omitempty"`
	Name      string        `json:"name,omitempty"`
	Error     string        `json:"error,omitempty"`
	Duration  time.Duration `json:"duration,omitempty"`
	Timestamp time.Time     `json:"timestamp,omitempty"`
	TestID    string        `json:"test_id,omitempty"`
}

type ApiTest

type ApiTest struct {
	URL  string `json:"url,omitempty"`
	Cron string `json:"cron,omitempty"`
	Name string `json:"name,omitempty"`
	ID   string `json:"id,omitempty"`
}

func (*ApiTest) Run

func (test *ApiTest) Run() *ApiResult

Run runs the API test

type Results

type Results []*ApiResult

type Store

type Store struct {
	*bolt.DB
	TestBucket   []byte
	ResultBucket []byte
}

Store represent a bolt db datastore

func NewStore

func NewStore(path string) (*Store, error)

NewStore creates a new store.

func (*Store) CreateBuckets

func (db *Store) CreateBuckets() error

CreateBuckets creates a new buckets

func (*Store) DeleteTest

func (s *Store) DeleteTest(id string) error

func (*Store) GetAllTests

func (s *Store) GetAllTests() ([]*ApiTest, error)

func (*Store) GetResultsByTest

func (s *Store) GetResultsByTest(id string) ([]*ApiResult, error)

func (*Store) Put

func (db *Store) Put(key string, bucket, data []byte) error

func (*Store) RemoveBucket

func (db *Store) RemoveBucket(name []byte) error

RemoveBucket deletes bucket by name

func (*Store) SaveResult

func (s *Store) SaveResult(result *ApiResult) error

Jump to

Keyboard shortcuts

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