storage

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrReadOnlyStorage = errors.New("error read only storage")
	ErrInsert          = errors.New("error inserting into the db")
	ErrConstructQuery  = errors.New("error forming db query from api query")
	ErrQuery           = errors.New("error querying from the database")
)
View Source
var (
	DefaultTimestampFormat = "2006-01-02T15:04:05.000Z07:00"
)

Functions

This section is empty.

Types

type Log

type Log struct {
	JobID    uint64
	LogData  string
	Date     time.Time
	LogLevel string
}

Log defines the basic log info pushed by the server

type Query

type Query struct {
	JobID     *uint64
	Text      *string
	LogLevel  *string
	StartDate *time.Time
	EndDate   *time.Time
	PageSize  uint
	Page      uint
}

Query defines the different options to filter with

type Result

type Result struct {
	Logs     []Log
	Count    uint64
	Page     uint
	PageSize uint
}

Result defines the expected result returned from the db

type Storage

type Storage interface {
	StoreLog(ctx xcontext.Context, entry Log) error
	GetLogs(ctx xcontext.Context, query Query) (*Result, error)

	Close(ctx xcontext.Context) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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