core

package
v0.0.0-...-3c6d5b9 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: GPL-3.0 Imports: 10 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 GetDefaultCacheServer

func GetDefaultCacheServer() string

Types

type Cache

type Cache interface {
	Get(string) ([]byte, error)
	Set(string, []byte) error
}

func ConnectCache

func ConnectCache(server string) Cache

type Database

type Database struct {
	SqlDB  *sql.DB
	Config DatabaseConfig
}

func NewDatabaseConnection

func NewDatabaseConnection(config DatabaseConfig) Database

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 JsonMiddleware

type JsonMiddleware struct{}

func (JsonMiddleware) ServeHTTP

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

type MemcachedCache

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

func (MemcachedCache) Get

func (mc MemcachedCache) Get(key string) ([]byte, error)

func (MemcachedCache) Set

func (mc MemcachedCache) Set(key string, value []byte) error

type Route

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

func BuildRoute

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

type Router

type Router struct {
	DB     Database
	Routes []Route
	Mux    *http.ServeMux
	Cache  Cache
}

func (*Router) MapRoutes

func (r *Router) MapRoutes()

func (*Router) Serve

func (r *Router) Serve()

Jump to

Keyboard shortcuts

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