Added dynamic support for years
This commit is contained in:
1 parent
47b9939ead
commit
770fbd5b88
5 files changed
+32
-24
No files matched your search
@@ -0,0 +1,14 @@
|
||||
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")
|
||||
}
|
||||
Reference in new issue
Block a user