azfunctions

package module
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 20 Imported by: 0

README

azfunctions

Go Reference

Azure Functions framework routes incoming requests, intercepts any logging and output that the function produces and returns the correct invocation result format back to Azure. It sends any error of the endpoints to Sentry and returns an improved standard error template if the function fails.

Install

go get github.com/altipla-consulting/azfunctions

Contributing

You can make pull requests or create issues in GitHub. Any code you send should be formatted using make gofmt.

License

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(s string) error

BadRequest returns a 400 HTTP error.

func BadRequestf

func BadRequestf(s string, args ...interface{}) error

BadRequestf returns a 400 HTTP error and formats its message.

func Internal

func Internal(s string) error

Internal returns a 500 HTTP error.

func Internalf

func Internalf(s string, args ...interface{}) error

Internalf returns a 500 HTTP error and formats its message.

func LoggerFromContext

func LoggerFromContext(ctx context.Context) *log.Entry

LoggerFromContext returns the logger from a context. The context must have been previously extracted from r.Context().

func LoggerFromRequest

func LoggerFromRequest(r *http.Request) *log.Entry

LoggerFromRequest returns the logger from an HTTP request.

func NotFound

func NotFound(s string) error

NotFound returns a 404 HTTP error.

func NotFoundf

func NotFoundf(s string, args ...interface{}) error

NotFoundf returns a 404 HTTP error and formats its message.

func RequestFromContext

func RequestFromContext(ctx context.Context) *http.Request

RequestFromContext returns the HTTP request from a context. The context must have been previously extracted from r.Context().

func Unauthorized

func Unauthorized(s string) error

Unauthorized returns a 401 HTTP error.

func Unauthorizedf

func Unauthorizedf(s string, args ...interface{}) error

Unauthorizedf returns a 401 HTTP error and formats its message.

Types

type HTTPHandler

type HTTPHandler func(w http.ResponseWriter, r *http.Request) error

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts ...ServerOption) *Server

func (*Server) HTTPGet

func (server *Server) HTTPGet(funcName string, handler HTTPHandler)

func (*Server) HTTPPost

func (server *Server) HTTPPost(funcName string, handler HTTPHandler)

func (*Server) Serve

func (server *Server) Serve()

type ServerOption

type ServerOption func(server *Server)

func WithDebug

func WithDebug() ServerOption

func WithTrace

func WithTrace() ServerOption

Jump to

Keyboard shortcuts

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