order.go 257 B

123456789101112
  1. package dto
  2. import (
  3. "gorm.io/gorm"
  4. "gorm.io/gorm/clause"
  5. )
  6. func OrderDest(sort string, bl bool) func(db *gorm.DB) *gorm.DB {
  7. return func(db *gorm.DB) *gorm.DB {
  8. return db.Order(clause.OrderByColumn{Column: clause.Column{Name: sort}, Desc: bl})
  9. }
  10. }