history

package
v1.33.6 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const AddRecordTopic = "history:addrecord"

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 {
	// contains filtered or unexported fields
}

func NewHistory added in v1.33.1

func NewHistory(projectDir string) *History

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)

type HistoryRecord

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

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