Documentation
¶
Index ¶
- func CloudflareCompatibleIP(ctx echo.Context) string
- func DrakenHandler(w http.ResponseWriter, r *http.Request) (*Response, *Request)
- func HeartbeatRoute(ctx echo.Context) error
- func LoggerMiddleware(l zerolog.Logger) echo.MiddlewareFunc
- func RequestIdMiddleware() echo.MiddlewareFunc
- func WebserverMiddleware() echo.MiddlewareFunc
- type Cache
- type CacheConfig
- type CacheType
- type Config
- type ContextKey
- type Draken
- type Environment
- type HeartbeatConfig
- type R2
- type R2Config
- type Redis
- func (r *Redis) Exists(key string) bool
- func (r *Redis) Expire(key string, ttl time.Duration) error
- func (r *Redis) Get(key string) (*string, error)
- func (r *Redis) Init(e bool)
- func (r *Redis) Len(key string) (int64, error)
- func (r *Redis) Pop(key string) (string, error)
- func (r *Redis) Push(key string, value any) error
- func (r *Redis) Set(key string, value any, ttl time.Duration) error
- func (r *Redis) Stop()
- type Request
- type Response
- type Router
- func (r *Router) CreateSubrouter(route string) *Router
- func (r *Router) Delete(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) EssentialMiddlewares()
- func (r *Router) Get(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) Middleware(middlewares ...echo.MiddlewareFunc)
- func (r *Router) Patch(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) Post(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
- func (r *Router) Put(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
- type ServerConfig
- type SqlDatabase
- type Storage
- type StorageConfig
- type StorageType
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloudflareCompatibleIP ¶ added in v0.4.5
func DrakenHandler ¶
func HeartbeatRoute ¶ added in v0.3.0
func LoggerMiddleware ¶
func LoggerMiddleware(l zerolog.Logger) echo.MiddlewareFunc
func RequestIdMiddleware ¶
func RequestIdMiddleware() echo.MiddlewareFunc
func WebserverMiddleware ¶
func WebserverMiddleware() echo.MiddlewareFunc
Types ¶
type CacheConfig ¶ added in v0.4.0
type Config ¶
type Config struct {
Environment Environment
Debug bool
Server ServerConfig
Storage StorageConfig
Cache CacheConfig
R2 R2Config
}
type Draken ¶
type Draken struct {
Config Config
Storage Storage
Cache Cache
StartedAt time.Time
R2 *R2
Router *Router
}
func (*Draken) CreateRouter ¶
func (d *Draken) CreateRouter()
func (*Draken) OverwriteLogger ¶ added in v0.5.2
type Environment ¶
type Environment uint8
const ( EnvironmentLocal Environment = iota EnvironmentDev EnvironmentStaging EnvironmentProd )
type HeartbeatConfig ¶
type R2 ¶ added in v0.3.3
type Redis ¶ added in v0.4.0
func (*Redis) Pop ¶ added in v0.4.1
Pop removes and returns the head element of the list at key. If the list is empty, it returns ("", nil), but you could also choose to return ("", redis.Nil) and let the caller distinguish that yourself.
type Request ¶
func GetRequest ¶
func (*Request) CtxGetString ¶
func (r *Request) CtxGetString(key ContextKey) string
type Response ¶
type Response struct {
http.ResponseWriter
// contains filtered or unexported fields
}
func GetResponse ¶
func GetResponse(w http.ResponseWriter) *Response
func (*Response) SetContentType ¶
type Router ¶ added in v0.2.0
type Router struct {
Echo *echo.Echo
Group *echo.Group
Draken *Draken
ParentRouter *Router
Subrouters map[string]*Router
}
func (*Router) CreateSubrouter ¶ added in v0.2.0
func (*Router) Delete ¶ added in v0.2.0
func (r *Router) Delete(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
func (*Router) EssentialMiddlewares ¶ added in v0.2.0
func (r *Router) EssentialMiddlewares()
func (*Router) Get ¶ added in v0.2.0
func (r *Router) Get(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
func (*Router) Middleware ¶ added in v0.2.0
func (r *Router) Middleware(middlewares ...echo.MiddlewareFunc)
func (*Router) Patch ¶ added in v0.2.0
func (r *Router) Patch(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
func (*Router) Post ¶ added in v0.2.0
func (r *Router) Post(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
func (*Router) Put ¶ added in v0.2.0
func (r *Router) Put(route string, handler echo.HandlerFunc, middlewares ...echo.MiddlewareFunc)
type ServerConfig ¶
type ServerConfig struct {
Hidden bool
Port uint16
Heartbeat HeartbeatConfig
Security bool
}
type SqlDatabase ¶
type SqlDatabase struct {
DB *sql.DB
Client *bun.DB
Context context.Context
Cancel context.CancelFunc
}
func NewPostgres ¶
func NewPostgres(dsn string) *SqlDatabase
NewPostgres creates a new postgres database
func NewSqlite ¶
func NewSqlite(sqliteFolder ...string) *SqlDatabase
func (*SqlDatabase) Bun ¶
func (d *SqlDatabase) Bun() *bun.DB
func (*SqlDatabase) Ctx ¶
func (d *SqlDatabase) Ctx() context.Context
func (*SqlDatabase) Init ¶
func (d *SqlDatabase) Init(debug bool)
func (*SqlDatabase) Stop ¶
func (d *SqlDatabase) Stop()
type StorageConfig ¶
type StorageConfig struct {
Enabled bool
Type StorageType
DSN string
}
type StorageType ¶
type StorageType uint8
const ( StorageTypeLibsql StorageType = iota StorageTypeSqlite StorageTypePostgres )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.
