storage

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: May 10, 2022 License: BSD-3-Clause Imports: 9 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"`
	Code         errorx.Code         `db:"code" json:"code"`
	Fields       errorx.Fields       `db:"fields" json:"fields"`
	OpTraces     []errorx.Op         `db:"op_traces" json:"op_traces"`
	Message      errorx.Message      `db:"message" json:"message"`
	Line         errorx.Line         `db:"line" json:"line"`
	MetricStatus errorx.MetricStatus `db:"metric_status" json:"metric_status"`
}

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         string          `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"`
	Error      ErrorDetail     `db:"error" json:"error"`
	Metadata   HistoryMetadata `db:"metadata" json:"metadata"`
}

type HistoryFilter

type HistoryFilter struct {
	Order         string  `db:"order" json:"order"`
	Limit         int     `db:"limit" json:"limit"`
	StartingAfter *string `db:"starting_after" json:"starting_after"`
	EndingBefore  *string `db:"ending_before" json:"ending_before"`
}

type HistoryMetadata

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

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