holiday-api/holiday/year_searvice.go

15 lines
280 B
Go
Raw Normal View History

2023-08-05 19:49:33 +00:00
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")
}