accesslog

package
v0.0.0-...-7a4a0fd Latest Latest
Warning

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

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

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var (
	Uri = pkgPath
)

Functions

func Get

func Get[E runtime.ErrorHandler, T GetConstraints](ctx context.Context, values map[string][]string) (T, *runtime.Status)

Get - templated function to query for a set of AccessLog entries from a datastore

Example
err := testStartup()
if err != nil {
	fmt.Printf("test: ClientStartup() -> [error:%v] [started:%v]\n", err, pgxsql.IsStarted())
} else {
	defer pgxsql.ClientShutdown()
	events, status1 := Get[runtime.DebugError, []content.Entry](nil, nil)
	fmt.Printf("test: Get[runtime.DebugError,[]Entry](nil,nil) -> [status:%v] [events:%v]\n", status1, events)

}
Output:

test: Get[runtime.DebugError,[]Entry](nil,nil) -> [status:OK] [events:[{customer7 2024-04-07 08:51:51.532388 -0500 CDT 0 450ms egress new mexico            0 0  0 100 0 false 0 0 false} {customer7 2024-04-07 08:51:51.532388 -0500 CDT 0 450ms egress new mexico            0 0  0 100 0 false 0 0 false}]]

func GetByte

func GetByte[E runtime.ErrorHandler](ctx context.Context, contentLocation string, values map[string][]string) ([]byte, *runtime.Status)

GetByte - templated function to query for a set of AccessLog entries from a datastore

Example
err := testStartup()
if err != nil {
	fmt.Printf("test: ClientStartup() -> [error:%v] [started:%v]\n", err, pgxsql.IsStarted())
} else {
	defer pgxsql.ClientShutdown()
	buf, status := GetByte[runtime.DebugError](nil, "", nil)
	fmt.Printf("test: GetByte[runtime.DebugError](nil,current,nil) -> [status:%v] [buf:%v]\n", status, string(buf))

}
Output:

test: GetByte[runtime.DebugError](nil,current,nil) -> [status:OK] [buf:[{"CustomerId":"customer7","StartTime":"2024-04-07T08:51:51.532388-05:00","Duration":0,"DurationString":"450ms","Traffic":"egress","Region":"new mexico","Zone":"","SubZone":"","Service":"","InstanceId":"","RouteName":"","RequestId":"","Url":"","Protocol":"","Method":"","Host":"","Path":"","StatusCode":0,"BytesSent":0,"StatusFlags":"","Timeout":0,"RateLimit":100,"RateBurst":0,"Retry":false,"RetryRateLimit":0,"RetryRateBurst":0,"Failover":false},{"CustomerId":"customer7","StartTime":"2024-04-07T08:51:51.532388-05:00","Duration":0,"DurationString":"450ms","Traffic":"egress","Region":"new mexico","Zone":"","SubZone":"","Service":"","InstanceId":"","RouteName":"","RequestId":"","Url":"","Protocol":"","Method":"","Host":"","Path":"","StatusCode":0,"BytesSent":0,"StatusFlags":"","Timeout":0,"RateLimit":100,"RateBurst":0,"Retry":false,"RetryRateLimit":0,"RetryRateBurst":0,"Failover":false}]]

func IsStarted

func IsStarted() bool

IsStarted - determine if this package has completed startup

func Put

Put - templated function to Put a set of log entries into a datastore

Example
err := testStartup()
if err != nil {
	fmt.Printf("test: ClientStartup() -> [error:%v] [started:%v]\n", err, pgxsql.IsStarted())
} else {
	defer pgxsql.ClientShutdown()
	events := []content.Entry{event, event2}
	tag, status := Put[runtime.DebugError, []content.Entry](nil, events)
	fmt.Printf("test: Put[runtime.DebugError,[]Entry](nil,events) -> [status:%v] [result:%v]\n", status, tag)

	//body := &httptest.ReaderCloser{Reader: bytes.NewReader(buf), Err: nil}
	//req, _ := http.NewRequest("", "www.google.com", body)
	//status = Put[runtime.DebugError, *http.Request](nil, RscId, req)
	//fmt.Printf("test: Put(nil,[]byte) -> [status:%v]\n", status)
}
Output:

test: Put[runtime.DebugError,[]Entry](nil,events) -> [status:OK] [result:{INSERT 0 2 2 true false false false}]

func PutByte

func PutByte[E runtime.ErrorHandler](ctx context.Context, contentLocation string, data []byte) (pgxsql.CommandTag, *runtime.Status)

PutByte - templated function to Put a set of log entries into a datastore

Example
err := testStartup()
if err != nil {
	fmt.Printf("test: ClientStartup() -> [error:%v] [started:%v]\n", err, pgxsql.IsStarted())
} else {
	defer pgxsql.ClientShutdown()
	events := []content.Entry{event, event2}

	buf, _ := json.Marshal(&events)
	tag, status := PutByte[runtime.DebugError](nil, "", buf)
	fmt.Printf("test: PutByte[runtime.DebugError](nil,VersionCurrent,buf) -> [status:%v] [result:%v]\n", status, tag)

}
Output:

test: PutByte[runtime.DebugError](nil,VersionCurrent,buf) -> [status:OK] [result:{INSERT 0 2 2 true false false false}]

Types

type GetConstraints

type GetConstraints interface {
	[]content.Entry | []content.EntryV2
}

GetConstraints - interface defining constraints for the Get function

type PutConstraints

type PutConstraints interface {
	[]content.Entry | []content.EntryV2
}

PutConstraints - generic constraints

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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