package holiday import ( "github.com/google/uuid" "time" ) type Holiday struct { Id uuid.UUID `db:"id"` Country string `db:"country"` Date time.Time `db:"date"` Name string `db:"name"` Description string `db:"description"` IsStateHoliday bool `db:"is_state"` IsReligiousHoliday bool `db:"is_religious"` } type Country struct { Id uuid.UUID `db:"id"` IsoName string `db:"iso_name"` Name string `db:"name"` } type Paging struct { PageSize int `form:"page_size" binging:"min=0"` Page int `form:"page" binging:"min=0"` } type Search struct { Country string `form:"country" binding:"len=2"` Year *int `form:"year" binding:"omitempty,min=0"` Date *time.Time `form:"date" time_format:"2006-01-02"` RangeStart *time.Time `form:"range_start" time_format:"2006-01-02"` RangeEnd *time.Time `form:"range_end" time_format:"2006-01-02"` StateHoliday string `form:"state_holiday,omitempty" binding:"omitempty"` ReligiousHoliday string `form:"religious_holiday,omitempty" binding:"omitempty"` Type *string `form:"type,omitempty" binding:"omitempty"` } func (s Search) IsStateHoliday() *bool { var value bool if s.StateHoliday == "true" { value = true } else if s.StateHoliday == "false" { value = false } else { return nil } return &value } func (s Search) IsReligiousHoliday() *bool { var value bool if s.ReligiousHoliday == "true" { value = true } else if s.ReligiousHoliday == "false" { value = false } else { return nil } return &value }