events

package
v0.0.0-...-7341660 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	ID          string        `json:"id"`
	Source      string        `json:"source"`
	Title       string        `json:"title"`
	Description string        `json:"description"`
	Location    EventLocation `json:"location"`
	StartTime   string        `json:"start_date_time"`
	EndTime     string        `json:"end_date_time"`
	Organizer   string        `json:"organizer"`
	Pricing     string        `json:"pricing"`
	Url         string        `json:"url"`
	Interests   []string      `json:"interests"`
}

type EventHandler

type EventHandler struct {
	Config *configuration.Config
	Store  *EventStore
}

func NewEventHandler

func NewEventHandler(config *configuration.Config, store *EventStore) *EventHandler

func (*EventHandler) GetAllEvents

func (h *EventHandler) GetAllEvents(w http.ResponseWriter, r *http.Request)

func (*EventHandler) GetEvent

func (h *EventHandler) GetEvent(w http.ResponseWriter, r *http.Request)

func (*EventHandler) PostEvent

func (h *EventHandler) PostEvent(w http.ResponseWriter, r *http.Request)

type EventInsertError

type EventInsertError string
var (
	ErrEventAlreadyExists EventInsertError = "Event already exists"
	ErrGeneralInsertError EventInsertError = "General insert error"
)

type EventLocation

type EventLocation struct {
	City      string `json:"city"`
	Country   string `json:"country"`
	Street    string `json:"street"`
	Email     string `json:"email"`
	Name      string `json:"name"`
	Telephone string `json:"telephone"`
	Zip       string `json:"zip"`
}

type EventMatches

type EventMatches struct {
	Event      Event
	MatchCount int
}

type EventStore

type EventStore struct {
	Config *configuration.Config
	Events []Event `json:"events"`
}

func NewEventStore

func NewEventStore(config *configuration.Config) (*EventStore, error)

func (*EventStore) InsertEvent

func (s *EventStore) InsertEvent(event Event) (*Event, *EventInsertError)

func (*EventStore) ReadAllEvents

func (s *EventStore) ReadAllEvents() ([]Event, error)

func (*EventStore) ReadEvent

func (s *EventStore) ReadEvent(id string) (*Event, error)

func (*EventStore) SaveDataToJsonFile

func (s *EventStore) SaveDataToJsonFile() error

Jump to

Keyboard shortcuts

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