api

package
v0.0.0-...-68a5074 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hello = "Hello! How are you?"
	Echo  = "Please echo"
	Read  = "Read from database"
	Write = "Write to database"
)

MessageType.

Variables

This section is empty.

Functions

func ApiHandler

func ApiHandler(request RequestMessage, response *ResponseMessage) error

ApiHandler handles a "nested call" API.

func BadRequest

func BadRequest(c *gin.Context)

func GinRun

func GinRun(ctx Context)

func HttpHandler

func HttpHandler(c *gin.Context)

func InternalServerError

func InternalServerError(c *gin.Context)

func KafkaHandler

func KafkaHandler(message RequestMessage)

func KafkaRun

func KafkaRun()

func NotFound

func NotFound(c *gin.Context)

func ReadEntity

func ReadEntity(store string, key string) (string, error)

ReadEntity returns value of key from some data store.

func WriteEntity

func WriteEntity(store string, key string, value string) error

WriteEntity writes a key/value pair to some data store.

Types

type Context

type Context struct {
	Mode string
	Port string
}

type Error

type Error struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type RequestMessage

type RequestMessage struct {
	CallTime string `json:"callTime"`
	Target   string `json:"target"`
	Message  string `json:"message"`
	Key      string `json:"key,omitempty"`
	Value    string `json:"value,omitempty"`
}

type ResponseMessage

type ResponseMessage struct {
	ReceivedTime string `json:"receivedTime"`
	ReturnTime   string `json:"returnTime"`
	Message      string `json:"message"`
}

Jump to

Keyboard shortcuts

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