event

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidEventTypeOf = errors.New("not a valid EventTypeOf")

Functions

func Module

func Module() fx.Option

func Router

func Router(server *echo.Echo, handler *EventAPI)

Types

type Event

type Event struct {
	gorm.Model
	Title       string         `json:"title"`
	Banner      string         `json:"banner"`
	Description string         `json:"description"`
	Href        string         `json:"href"`
	TypeOf      pq.StringArray `json:"type_of" gorm:"type:text[]"`
	BeginDate   time.Time      `json:"begin"`
	EndDate     time.Time      `json:"end"`
	UserID      uint           `json:"user_id"`

	Attendees []attendee.Attendee `json:"attendees"`
	Tags      []tag.Tag           `json:"tags" gorm:"many2many:events_tags"`
	Venues    []venue.Venue       `json:"venues" gorm:"many2many:events_venues"`
	Cfp       cfp.Cfp             `json:"cfp"`
	User      user.User           `json:"user"`
}

type EventAPI

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

func NewEventAPI

func NewEventAPI(service Service) *EventAPI

func (*EventAPI) GetEvents

func (e *EventAPI) GetEvents(c echo.Context) (err error)

type EventDTO

type EventDTO struct {
	Title       string        `json:"title"`
	Banner      string        `json:"banner"`
	Description string        `json:"description"`
	Href        string        `json:"href"`
	TypeOf      []EventTypeOf `json:"type_of"`
	BeginDate   time.Time     `json:"begin"`
	EndDate     time.Time     `json:"end"`
}

type EventService

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

func (*EventService) Create

func (e *EventService) Create(ctx context.Context, user user.User, event EventDTO, tags []string) (result Event, err error)

func (*EventService) Get

func (e *EventService) Get(
	ctx context.Context,
	name, city string,
	tags []string,
	typeOf []EventTypeOf,
	available bool,
	page, limit int,
) (events []Event, err error)

type EventTypeOf

type EventTypeOf int

ENUM(online, in_person)

const (
	// EventTypeOfOnline is a EventTypeOf of type Online.
	EventTypeOfOnline EventTypeOf = iota
	// EventTypeOfInPerson is a EventTypeOf of type In_person.
	EventTypeOfInPerson
)

func ParseEventTypeOf

func ParseEventTypeOf(name string) (EventTypeOf, error)

ParseEventTypeOf attempts to convert a string to a EventTypeOf.

func (EventTypeOf) IsValid

func (x EventTypeOf) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (EventTypeOf) MarshalText

func (x EventTypeOf) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (*EventTypeOf) Scan

func (x *EventTypeOf) Scan(value interface{}) (err error)

Scan implements the Scanner interface.

func (EventTypeOf) String

func (x EventTypeOf) String() string

String implements the Stringer interface.

func (*EventTypeOf) UnmarshalText

func (x *EventTypeOf) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

func (EventTypeOf) Value

func (x EventTypeOf) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type QueryParams

type QueryParams struct {
	Name      string   `query:"name"`
	City      string   `query:"city"`
	Tags      []string `query:"tags"`
	TypeOf    string   `query:"type_of"`
	Available bool     `query:"available"`
	Page      int      `query:"page"`
	Limit     int      `query:"limit"`
}

type Service

type Service interface {
	Get(ctx context.Context, name, city string, tags []string, typeOf []EventTypeOf, available bool, page, limit int) (events []Event, err error)
	Create(ctx context.Context, user user.User, event EventDTO, tags []string) (result Event, err error)
}

func NewEventService

func NewEventService(db *gorm.DB) Service

Jump to

Keyboard shortcuts

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