common

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServerReadHeaderTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	DB *sql.DB
	T  storage.DirectoryAdmin
	L  *zap.Logger
	// contains filtered or unexported fields
}

func NewServer

func NewServer(
	logger *zap.Logger,
	listen string,
	db *sql.DB,
	t storage.DirectoryAdmin,
	debug bool,
	shutdownTime time.Duration,
	unix string,
) *Server

func (*Server) AddReadinessCheck

func (s *Server) AddReadinessCheck(name string, f ginx.CheckFunc) *Server

AddReadinessCheck will accept a function to be ran during calls to /readyx. These functions should accept a context and only return an error. When adding a readiness check a name is also provided, this name will be used when returning the state of all the checks.

func (*Server) DefaultEngine

func (s *Server) DefaultEngine(logger *zap.Logger) *gin.Engine

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run will start the server.

func (*Server) SetHandler

func (s *Server) SetHandler(h http.Handler)

func (*Server) Shutdown

func (s *Server) Shutdown() error

Shutdown will gracefully shutdown the server.

Jump to

Keyboard shortcuts

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