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") }