web

package
v0.0.0-...-eda6419 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseId

func ParseId(w http.ResponseWriter, input string) int64

func ReadJSONRequest

func ReadJSONRequest(w http.ResponseWriter, r *http.Request, dest any)

func WriteJSONResponse

func WriteJSONResponse(w http.ResponseWriter, err error, statusCode int, data any)

func WriteValidationErrors

func WriteValidationErrors(w http.ResponseWriter, payload validator.ValidationErrors)

Types

type Application

type Application struct {
	Config  *config.Configuration
	Service *Service
}

func (*Application) SetupRouter

func (app *Application) SetupRouter() http.Handler

type JSONError

type JSONError struct {
	Status int               `json:"status"`
	Code   string            `json:"code,omitempty"`
	Title  string            `json:"title,omitempty"`
	Detail string            `json:"detail,omitempty"`
	Errors map[string]string `json:"errors,omitempty"`
	Meta   struct{}          `json:"meta,omitempty"`
}

type JSONResponse

type JSONResponse struct {
	Status string `json:"status"`
	Data   any    `json:"data"`
}

type Service

type Service struct {
	CodeSnippets *stores.CodeSnippetStore
	Events       *stores.EventStore
	Links        *stores.LinkStore
	Notes        *stores.NoteStore
	Posts        *stores.PostStore
	Tasks        *stores.TaskStore
}

Jump to

Keyboard shortcuts

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