src

package
v0.0.0-...-416caf1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConn

func GetConn(cfg Config, logger *zap.Logger) *pgxpool.Pool

Types

type Config

type Config struct {
	ProjectName    string `default:"contacts"`
	ProjectVersion string `default:"v0.0.1"`
	Port           string `envconfig:"PORT" default:"8085" required:"true"`
	Database       struct {
		URL string `` /* 137-byte string literal not displayed */
	}
}

func NewConfig

func NewConfig() Config

type Dependencies

type Dependencies struct {
	ContactHandler controller.ContactHandler
	HandierPing    ping.HandierPing
	Config         Config
	Logger         *zap.Logger
	Conn           *pgxpool.Pool
}

func Build

func Build() Dependencies

func (Dependencies) CloseDatabase

func (d Dependencies) CloseDatabase()

type Error

type Error struct {
	Message    string `json:"message"`
	StatusCode int    `json:"status_code"`
	Type       string `json:"type"`
}

func NewError

func NewError(statusCode int, errType string, err error) Error

type Middleware

type Middleware func(*Server)

func WithErrorHandler

func WithErrorHandler() Middleware

func WithRecover

func WithRecover() Middleware

func WithRequestID

func WithRequestID() Middleware

type Server

type Server struct {
	Server *echo.Echo
	// contains filtered or unexported fields
}

func NewServer

func NewServer(dependencies Dependencies) *Server

func (*Server) GetDependencies

func (s *Server) GetDependencies() Dependencies

func (*Server) Middlewares

func (s *Server) Middlewares(middlewares ...Middleware)

Middlewares build the middlewares of the server

func (*Server) Routes

func (s *Server) Routes()

Routes build the routes of the server

func (*Server) Start

func (s *Server) Start()

Start run the server

Jump to

Keyboard shortcuts

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