events

package
v0.0.0-...-90005dc Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EventNotFoundError = errors.New("event not found")
	EventInternalError = errors.New("event internal error")
)

Functions

func HandleError

func HandleError(ctx context.Context, eventID string, err error) *web.WebError

Types

type Event

type Event struct {
	//gorm.Model
	ID          uint   `json:"id" gorm:"primaryKey; not null; autoIncrement"`
	Title       string `json:"Title"`
	Date        string `json:"Date"`
	Status      bool   `json:"Status" gorm:"not null; default:true"`
	Description string `json:"Description"`
}

func (*Event) ValidateEvent

func (event *Event) ValidateEvent() bool

type EventsHandler

type EventsHandler struct {
	// contains filtered or unexported fields
}

func BuildEventsHandler

func BuildEventsHandler(eventsService IEventsService) *EventsHandler

func (*EventsHandler) GetAll

func (handler *EventsHandler) GetAll(w http.ResponseWriter, r *http.Request)

func (*EventsHandler) GetByEventID

func (handler *EventsHandler) GetByEventID(w http.ResponseWriter, r *http.Request)

type EventsRepository

type EventsRepository struct {
	DB *gorm.DB
}

func BuildEventsRepository

func BuildEventsRepository(dbConn *gorm.DB) *EventsRepository

func (*EventsRepository) CreateEvent

func (r *EventsRepository) CreateEvent(ctx context.Context, event *Event) (*Event, error)

func (*EventsRepository) GetAll

func (r *EventsRepository) GetAll(ctx context.Context) ([]Event, error)

func (*EventsRepository) GetByEventID

func (r *EventsRepository) GetByEventID(ctx context.Context, eventID uint) (*Event, error)

type EventsService

type EventsService struct {
	Repository IEventsRepository
}

func BuildEventsService

func BuildEventsService(eventsRepository IEventsRepository) *EventsService

func (*EventsService) GetAll

func (service *EventsService) GetAll(ctx context.Context) ([]Event, error)

func (*EventsService) GetByEventID

func (service *EventsService) GetByEventID(ctx context.Context, eventID uint) (*Event, error)

type IEventsHandler

type IEventsHandler interface {
	GetAll(w http.ResponseWriter, r *http.Request)
	GetByEventID(w http.ResponseWriter, r *http.Request)
}

type IEventsRepository

type IEventsRepository interface {
	GetAll(ctx context.Context) ([]Event, error)
	GetByEventID(ctx context.Context, eventID uint) (*Event, error)
}

type IEventsService

type IEventsService interface {
	GetAll(ctx context.Context) ([]Event, error)
	GetByEventID(ctx context.Context, eventID uint) (*Event, error)
}

Jump to

Keyboard shortcuts

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