server

package
v0.0.0-...-9156904 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleActivities

func HandleActivities(handler ActivityHandler) http.HandlerFunc

func HandleActivity

func HandleActivity(handler ActivityHandler) http.HandlerFunc

func HandleCreateActivity

func HandleCreateActivity(handler ActivityHandler) http.HandlerFunc

func HandleDeleteActivity

func HandleDeleteActivity(handler ActivityHandler) http.HandlerFunc

func HandlePatchActivity

func HandlePatchActivity(handler ActivityHandler) http.HandlerFunc

func HandleUpdateActivity

func HandleUpdateActivity(handler ActivityHandler) http.HandlerFunc

Types

type ActivityHandler

type ActivityHandler interface {
	Activities(ctx context.Context, req service.ActivitiesRequest) ([]service.Activity, error)
	Activity(ctx context.Context, id string) (*service.Activity, error)
	CreateActivity(ctx context.Context, activity service.Activity) error
	UpdateActivity(ctx context.Context, id string, activity service.Activity) error
	PatchActivity(ctx context.Context, id string, activity service.Activity) (*service.Activity, error)
	DeleteActivity(ctx context.Context, id string) (bool, error)
}

type Config

type Config struct {
	Port    int           `envconfig:"PORT" default:"8080"`
	Timeout time.Duration `envconfig:"TIMEOUT" default:"30s"`
}

type Server

type Server struct {
	*http.Server
}

func New

func New(cfg Config, activityService ActivityHandler) *Server

Jump to

Keyboard shortcuts

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