Documentation
¶
Index ¶
- Constants
- Variables
- func CreateHash(key string) []byte
- func DecryptData(data []byte, passphrase string) []byte
- func DefaultHTTPErrorHandler(err error, c echo.Context)
- func EncryptData(data []byte, passphrase string) []byte
- func NewAPIErrorResponse(c echo.Context, code int, message string, data error) error
- type APIError
- type TracerSpan
- func (c *TracerSpan) CreateChildInContext(ctx context.Context, spanName string, logger zerolog.Logger) (context.Context, oteltrace.Span)
- func (c *TracerSpan) LoadFromContext(ctx context.Context) (oteltrace.Span, bool)
- func (c *TracerSpan) SetAttribute(cspan oteltrace.Span, kv attribute.KeyValue, logger zerolog.Logger) oteltrace.Span
Constants ¶
const ( // APIErrorSourceForge indicates that the error is reported from Forge APIErrorSourceForge = "forge" // APIErrorInternalServer indicates an unexpected error is reported from Forge APIErrorInternalServer = "An unexpected error occurred while processing the request" // APIErrorNotFound indicates that the requested path was not found APIErrorNotFound = "The requested path was not found" )
const ( // InventoryReceiptInterval is the interval between 2 subsequent inventory receipts InventoryReceiptInterval = 3 * time.Minute // WorkflowExecutionTimeout is the timeout for a workflow execution WorkflowExecutionTimeout = time.Minute * 1 // WorkflowContextTimeout is the timeout for a workflow context WorkflowContextTimeout = time.Second * 50 // WorkflowContextNewAfterTimeout is the timeout for a new workflow context WorkflowContextNewAfterTimeout = time.Second * 5 )
Variables ¶
var ( // ErrBadRequest (400) is returned for bad request (validation) ErrBadRequest = echo.ErrBadRequest ErrUnauthorized = echo.ErrUnauthorized // ErrInternal (500) is returned when an internal server error occurs ErrInternal = echo.ErrInternalServerError )
Functions ¶
func CreateHash ¶
CreateHash takes a string and returns SHA 256 digest in a byte array
func DecryptData ¶
DecryptData provides mechanism to decrypt arguments being passed into workflows
func DefaultHTTPErrorHandler ¶
DefaultHTTPErrorHandler is the default HTTP error handler. It sends a structured error response
NOTE: In case errors happens in middleware call-chain that is returning from handler (handler ran into unrecovered error): When handler has already sent response (ala c.JSON()) and there is error in middleware that is returning from handler, then the error that global error handler received will be ignored because we have already "committed" the response and status code header has been sent to the client.
func EncryptData ¶
EncryptData provides mechanism to encrypt arguments being passed into workflows so it is not visible within Temporal system
Types ¶
type APIError ¶
type APIError struct {
Code int `json:"-"`
Source string `json:"source"`
Message string `json:"message"`
Data error `json:"data"`
}
APIError respresents a structured Forge API error
type TracerSpan ¶
type TracerSpan struct {
}
TracerSpan holds span information
func NewTracerSpan ¶
func NewTracerSpan() *TracerSpan
func (*TracerSpan) CreateChildInContext ¶
func (c *TracerSpan) CreateChildInContext(ctx context.Context, spanName string, logger zerolog.Logger) (context.Context, oteltrace.Span)
CreateChildInContext create a child span from specified span name and context
func (*TracerSpan) LoadFromContext ¶
LoadFromContext validate and get the spanner from current context