event1

package
v0.0.0-...-0518e84 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Examples

Constants

View Source
const (
	PkgPath = "github/advanced-go/log/event1"
	Route   = "log-events"
)

Variables

This section is empty.

Functions

func Get

func Get(r *http.Request, path string) ([]byte, http.Header, *core.Status)

Get - event1 GET

func Put

func Put(r *http.Request, path string, body []Entry) (http.Header, *core.Status)

Put - event1 PUT, with optional content override

Example
entries, _ := jsonx.New[[]Entry](testrsc.LOG1IngressEntry, nil)

h := make(http.Header)
h.Add(core.XExchangeStatus, jsonx.StatusTimeoutUri)
//ex := core.NewExchangeOverride("", "", json.StatusTimeoutUri)
//ctx := core.NewExchangeOverrideContext(nil, ex)

_, status := put[core.Output, Entry](context.Background(), h, entries)
fmt.Printf("test: put() -> [status:%v]\n", status)
Output:

test: put() -> [status:Timeout]

Types

type Entry

type Entry struct {
	CustomerId string    `json:"customer-id"`
	StartTime  time.Time `json:"start-time"`
	Duration   int64     `json:"duration"`
	Traffic    string    `json:"traffic"`
	CreatedTS  time.Time `json:"created-ts"`

	Origin core.Origin `json:"origin"`

	RequestId string `json:"request-id"`
	RelatesTo string `json:"relates-to"`
	Location  string `json:"location"`
	Protocol  string `json:"proto"`
	Method    string `json:"method"`
	From      string `json:"from"`
	To        string `json:"to"`
	Uri       string `json:"uri"`
	Path      string `json:"path"`
	Query     string `json:"query"`

	StatusCode int32  `json:"status-code"`
	Encoding   string `json:"encoding"`
	Bytes      int64  `json:"bytes"`

	Timeout        int32   `json:"timeout"`
	RateLimit      float64 `json:"rate-limit"`
	RateBurst      int32   `json:"rate-burst"`
	ControllerCode string  `json:"cc"`
}

Entry - timeseries access log struct

func EgressQuery

func EgressQuery(ctx context.Context, h http.Header, values url.Values) ([]Entry, *core.Status)

func IngressQuery

func IngressQuery(ctx context.Context, h http.Header, values url.Values) ([]Entry, *core.Status)

func (Entry) Rows

func (Entry) Rows(entries []Entry) [][]any

func (Entry) Scan

func (Entry) Scan(columnNames []string, values []any) (e Entry, err error)

func (Entry) Values

func (e Entry) Values() []any

Jump to

Keyboard shortcuts

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