helper

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractAddrFromSessionID

func ExtractAddrFromSessionID(sessionID string) string

extractAddrFromSessionID decodes the session ID to the addr.

func GenerateSessionID

func GenerateSessionID(addr string) string

generateSessionID encodes the addr to a session ID, which is used to identify the session. And then can be used to parse the leader listening address back.

func ResponseBadRequest

func ResponseBadRequest(c *gin.Context, err error)

func ResponseCreated

func ResponseCreated(c *gin.Context, data interface{})

func ResponseError

func ResponseError(c *gin.Context, err error)

func ResponseNoContent

func ResponseNoContent(c *gin.Context)

func ResponseOK

func ResponseOK(c *gin.Context, data interface{})

Types

type Error

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

type Response

type Response struct {
	Error *Error      `json:"error,omitempty"`
	Data  interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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