holiday-api/domain/holiday/year_service.go

15 lines
280 B
Go

package holiday
import (
"github.com/jmoiron/sqlx"
)
type YearService struct {
DB *sqlx.DB
}
func (s *YearService) Find() ([]int, error) {
var years []int
return years, s.DB.Select(&years, "SELECT distinct extract(year from date) as date FROM holiday order by date asc")
}