internal

package
v0.0.0-...-97e4283 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigFilename

func GetConfigFilename(debug bool) (string, error)

func GetDebugVar

func GetDebugVar() bool

func HttpError

func HttpError(w http.ResponseWriter, r *http.Request, message string, code int)

func LogRequest

func LogRequest(r *http.Request, message string, code int)

Types

type Config

type Config struct {
	APIKey   string `toml:"api_key"`
	Database struct {
		Host     string `toml:"host"`
		Port     int    `toml:"port"`
		User     string `toml:"user"`
		Password string `toml:"password"`
		Name     string `toml:"name"`
	} `toml:"database"`
}

Define struct for config

func LoadConfig

func LoadConfig(filename string) (Config, error)

type Logger

type Logger struct {
	zap.Logger
}

func NewLogger

func NewLogger(dir, file string) *Logger

func (*Logger) Close

func (l *Logger) Close()

func (*Logger) SetLevel

func (l *Logger) SetLevel(level zapcore.Level)

type RouteInjector

type RouteInjector interface {
	Register(r *mux.Router, logger *Logger)
}

type Server

type Server struct {
	http.Server
	Router *mux.Router
	Logger *Logger
}

func NewServer

func NewServer(logger *Logger, router *mux.Router, routes []RouteInjector) *Server

func (*Server) Start

func (s *Server) Start(addr string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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