storage

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	WriteHistory(ctx context.Context, req *History) error
	ReadHistories(ctx context.Context, req *HistoryFilter) ([]History, error)
}

type ErrorDetail

type ErrorDetail struct {
	Err          string              `db:"err"           json:"err,omitempty"`
	Code         errorx.Code         `db:"code"          json:"code,omitempty"`
	Fields       errorx.Fields       `db:"fields"        json:"fields,omitempty"`
	OpTraces     []errorx.Op         `db:"op_traces"     json:"op_traces,omitempty"`
	Message      errorx.Message      `db:"message"       json:"message,omitempty"`
	Line         errorx.Line         `db:"line"          json:"line,omitempty"`
	MetricStatus errorx.MetricStatus `db:"metric_status" json:"metric_status,omitempty"`
}

func (*ErrorDetail) Scan

func (e *ErrorDetail) Scan(value interface{}) error

func (*ErrorDetail) Value

func (e *ErrorDetail) Value() (driver.Value, error)

type History

type History struct {
	ID          int64           `db:"id"           json:"id"`
	CreatedAt   time.Time       `db:"created_at"   json:"created_at"`
	Name        string          `db:"name"         json:"name"`
	Status      string          `db:"status"       json:"status"`
	StatusCode  int64           `db:"status_code"  json:"status_code"`
	StartedAt   time.Time       `db:"started_at"   json:"started_at"`
	FinishedAt  time.Time       `db:"finished_at"  json:"finished_at"`
	Latency     int64           `db:"latency"      json:"latency"`
	LatencyText string          `db:"latency_text" json:"latency_text"`
	Error       ErrorDetail     `db:"error"        json:"error"`
	Metadata    HistoryMetadata `db:"metadata"     json:"metadata"`
}

type HistoryFilter

type HistoryFilter struct {
	Sorts         sortx.Sorts `db:"sorts"          json:"sorts"`
	Limit         int         `db:"limit"          json:"limit"`
	StartingAfter *int64      `db:"starting_after" json:"starting_after"`
	EndingBefore  *int64      `db:"ending_before"  json:"ending_before"`
}

type HistoryMetadata

type HistoryMetadata struct {
	MachineID  string `db:"machine_id"   json:"machine_id,omitempty"`
	EntryID    int64  `db:"entry_id"     json:"entry_id,omitempty"`
	Wave       int64  `db:"wave"         json:"wave,omitempty"`
	TotalWave  int64  `db:"total_wave"   json:"total_wave,omitempty"`
	IsLastWave bool   `db:"is_last_wave" json:"is_last_wave,omitempty"`
}

func (*HistoryMetadata) Scan

func (h *HistoryMetadata) Scan(value interface{}) error

func (*HistoryMetadata) Value

func (h *HistoryMetadata) Value() (driver.Value, error)

type NoopClient

type NoopClient struct{}

func NewNoopClient

func NewNoopClient() *NoopClient

NewNoopClient returns a no operation client.

func (NoopClient) ReadHistories

func (n NoopClient) ReadHistories(_ context.Context, _ *HistoryFilter) ([]History, error)

func (NoopClient) WriteHistory

func (n NoopClient) WriteHistory(_ context.Context, _ *History) error

type PostgreClient

type PostgreClient struct {
	// contains filtered or unexported fields
}

func NewPostgreClient

func NewPostgreClient(db database.PostgreClientItf) *PostgreClient

func (*PostgreClient) ReadHistories

func (p *PostgreClient) ReadHistories(ctx context.Context, req *HistoryFilter) ([]History, error)

func (*PostgreClient) WriteHistory

func (p *PostgreClient) WriteHistory(ctx context.Context, req *History) error

Jump to

Keyboard shortcuts

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