history

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHistoryError

func NewHistoryError(recordType RecordType, historyFile string) error

Types

type ApiHistoryItem

type ApiHistoryItem struct {
	Api      string           `json:"api"`
	Request  *RequestHistory  `json:"request"`
	Response *ResponseHistory `json:"response"`
}

type EventHistoryItem

type EventHistoryItem struct {
	Event   *EventRecord `json:"event,omitempty"`
	Payload string       `json:"payload,omitempty"`
}

type EventRecord

type EventRecord struct {
	WorkerKey string `json:"workerKey,omitempty"`
	TopicKey  string `json:"topicKey,omitempty"`
}

type History

type History struct {
	ProjectDir string
}

func (*History) DeleteHistoryRecord

func (h *History) DeleteHistoryRecord(recordType RecordType) error

func (*History) ReadAllHistoryRecords

func (h *History) ReadAllHistoryRecords() (*HistoryRecords, error)

func (*History) ReadHistoryRecords

func (h *History) ReadHistoryRecords(recordType RecordType) ([]*HistoryRecord, error)

func (*History) WriteHistoryRecord

func (h *History) WriteHistoryRecord(recordType RecordType, historyRecord *HistoryRecord) error

type HistoryRecord

type HistoryRecord struct {
	Time    int64 `json:"time,omitempty"`
	Success bool  `json:"success,omitempty"`
	EventHistoryItem
	ApiHistoryItem
}

type HistoryRecords

type HistoryRecords struct {
	ScheduleHistory []*HistoryRecord `json:"schedules"`
	TopicHistory    []*HistoryRecord `json:"topics"`
	ApiHistory      []*HistoryRecord `json:"apis"`
}

type Param

type Param struct {
	Key   string `json:"key,omitempty"`
	Value string `json:"value,omitempty"`
}

type RecordType

type RecordType string
const (
	API      RecordType = "apis"
	TOPIC    RecordType = "topics"
	SCHEDULE RecordType = "schedules"
)

type RequestHistory

type RequestHistory struct {
	Method      string              `json:"method"`
	Path        string              `json:"path"`
	QueryParams []Param             `json:"queryParams"`
	PathParams  []Param             `json:"pathParams"`
	Body        []byte              `json:"body"`
	Headers     map[string][]string `json:"headers"`
}

Only log what is required from req/resp to avoid massive log files

type ResponseHistory

type ResponseHistory struct {
	Data    interface{}         `json:"data"`
	Status  int32               `json:"status"`
	Size    int                 `json:"size"`
	Time    int64               `json:"time"`
	Headers map[string][]string `json:"headers"`
}

type TriggerType

type TriggerType string

Jump to

Keyboard shortcuts

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