http

package
v0.0.0-...-2d46e94 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var OpenAPISpec []byte

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Errors []string `json:"errors"`
}

type Response

type Response[T any] struct {
	Data T `json:"data"`
}

type Server

type Server struct {
	UserService UserService
	Port        int
}

func (*Server) HandleCreateUser

func (s *Server) HandleCreateUser() http.HandlerFunc

func (*Server) HandleGetUser

func (s *Server) HandleGetUser() http.HandlerFunc

func (*Server) HandleGetUsers

func (s *Server) HandleGetUsers() http.HandlerFunc

func (*Server) ListenAndServe

func (s *Server) ListenAndServe() error

func (*Server) Routes

func (s *Server) Routes() *http.ServeMux

type UserService

type UserService interface {
	CreateUser(ctx context.Context, user *app.CreateUserReq) (*app.User, error)
	FindUserByID(ctx context.Context, id int64) (*app.User, error)
	FindUsers(ctx context.Context) ([]app.User, error)
}

Jump to

Keyboard shortcuts

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