mirror of
https://github.com/quarkcloudio/quark-go.git
synced 2025-09-26 20:11:11 +08:00
26 lines
494 B
Go
26 lines
494 B
Go
package searches
|
|
|
|
import (
|
|
"github.com/quarkcms/quark-go/pkg/builder"
|
|
"github.com/quarkcms/quark-go/pkg/builder/searches"
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type Input struct {
|
|
searches.Search
|
|
}
|
|
|
|
// 初始化
|
|
func (p *Input) Init(column string, name string) *Input {
|
|
p.ParentInit()
|
|
p.Column = column
|
|
p.Name = name
|
|
|
|
return p
|
|
}
|
|
|
|
// 执行查询
|
|
func (p *Input) Apply(request *builder.Request, query *gorm.DB, value interface{}) *gorm.DB {
|
|
return query.Where(p.Column+" LIKE ?", "%"+value.(string)+"%")
|
|
}
|