ack

package module
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: Apache-2.0 Imports: 10 Imported by: 9

README

Ack

Ack: A TXN2 common API acknowledgement (ACK) struct.

Example Implementation

Run Example

go run ./example/server.go

Example Ack Payload

{
    "ack_version": 8,
    "agent": "test",
    "srv_env": "dev",
    "srv_ns": "example",
    "ack_uuid": "65143cad-8b06-4388-b618-ce3a364b7136",
    "req_uuid": "",
    "date_time": "2019-04-11T19:09:32-07:00",
    "success": true,
    "error_code": "",
    "error_message": "",
    "server_code": 200,
    "location": "/test",
    "payload_type": "Message",
    "payload": "A test message.",
    "duration": "514ns"
}

Example Ack Headers

< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< X-Ack-Agent: test
< X-Ack-Duration: 487ns
< X-Ack-Payload-Type: Message
< X-Ack-Req-Uuid: 2031e500-20d6-454a-a641-dc409334e8f3
< X-Ack-Srv-Env: dev
< X-Ack-Srv-Ns: example
< X-Ack-Uuid: 21fe6c71-6148-4ade-b64c-d9ccd71f8325
< X-Ack-Version: 8
< Date: Fri, 12 Apr 2019 02:58:52 GMT
< Content-Length: 366

Documentation

Overview

Package ack

Package ack

Index

Constants

View Source
const VERSION = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type Ack

type Ack struct {
	Version      int         `json:"ack_version"`
	Agent        string      `json:"agent"`
	SrvEnv       string      `json:"srv_env"`
	SrvNS        string      `json:"srv_ns"`
	Uuid         string      `json:"ack_uuid"`
	RequestUuid  string      `json:"req_uuid"`
	DateTime     string      `json:"date_time"`
	Success      bool        `json:"success"`
	ErrorCode    string      `json:"error_code"`
	ErrorMessage string      `json:"error_message"`
	ServerCode   int         `json:"server_code"`
	Location     string      `json:"location"`
	PayloadType  string      `json:"payload_type"`
	Payload      interface{} `json:"payload"`
	Duration     string      `json:"duration"`
	// contains filtered or unexported fields
}

func (*Ack) MakeError

func (a *Ack) MakeError(ServerCode int, errorCode string, errorMessage string)

func (*Ack) SetPayload

func (a *Ack) SetPayload(payload interface{})

func (*Ack) SetPayloadType

func (a *Ack) SetPayloadType(payloadType string)

func (*Ack) StartTimer

func (a *Ack) StartTimer()

type GinAck

type GinAck struct {
	Ack Ack
	// contains filtered or unexported fields
}

GinAck

func Gin

func Gin(c *gin.Context) GinAck

Gin Ack

func (*GinAck) GinErrorAbort

func (ga *GinAck) GinErrorAbort(ServerCode int, errorCode string, errorMessage string)

GinError aborts gin context with JSON error

func (*GinAck) GinSend

func (ga *GinAck) GinSend(payload interface{})

GinSend responds with JSON on the gin context

func (*GinAck) MakeError

func (ga *GinAck) MakeError(ServerCode int, errorCode string, errorMessage string)

MakeError

func (*GinAck) SetPayload

func (ga *GinAck) SetPayload(payload interface{})

SetPayload

func (*GinAck) SetPayloadType

func (ga *GinAck) SetPayloadType(payloadType string)

SetPayloadType

func (*GinAck) UnmarshalAbort

func (ga *GinAck) UnmarshalAbort(data []byte, v interface{}) error

UnmarshalAbort unmarshals data and aborts if it can not.

func (*GinAck) UnmarshalPostAbort

func (ga *GinAck) UnmarshalPostAbort(v interface{}) error

UnmarshalPostAbort unmarshal raw data posted through gin or aborts.

type MappedMetricFamily

type MappedMetricFamily map[string]*ioprometheusclient.MetricFamily

MappedMetricFamily

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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