core

package
v0.0.0-...-2f56068 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlockingBackoff

func BlockingBackoff(fn func() error, attempts int, sleep time.Duration) error

func ReadJSON

func ReadJSON(r *http.Request, payload interface{}) error

func RenderTemplate

func RenderTemplate(w http.ResponseWriter, components templ.Component)

func WriteJSON

func WriteJSON(w http.ResponseWriter, payload interface{}) error

Types

type Database

type Database struct {
	*sqlx.DB

	Config DatabaseConfig
	// contains filtered or unexported fields
}

func (*Database) Connect

func (db *Database) Connect() error

func (Database) Migrate

func (db Database) Migrate() error

type DatabaseConfig

type DatabaseConfig struct {
	User     string
	Password string
	Host     string
	Port     string
	Name     string
}

func GetDefaultDatabaseConfig

func GetDefaultDatabaseConfig() DatabaseConfig

type HttpRouter

type HttpRouter struct {
	Mux *http.ServeMux
	// contains filtered or unexported fields
}

func NewHttpRouter

func NewHttpRouter(ctx *RouterContext) *HttpRouter

func (*HttpRouter) MapRoutes

func (r *HttpRouter) MapRoutes(routes []Route) *HttpRouter

func (*HttpRouter) Serve

func (r *HttpRouter) Serve()

type JsonMiddleware

type JsonMiddleware struct{}

func (JsonMiddleware) ServeHTTP

func (j JsonMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Route

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

func BuildRoute

func BuildRoute(path string, handler http.HandlerFunc, middleware ...http.Handler) Route

type RouterContext

type RouterContext struct {
	DB Database
}

Jump to

Keyboard shortcuts

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