其他分享
首页 > 其他分享> > go结构体引用区别

go结构体引用区别

作者:互联网

type SshFilterGroupQ struct {
PaginationQ
SshFilterGroup
}

//All
func (m SshFilterGroupQ) Search() (pagination PaginationQ, err error) {
pagination = m.PaginationQ
pagination.Data = &[]SshFilterGroup{}
tx := db.Model(m.SshFilterGroup) //.Where("ancestor_path like ?", m.qAncetorPath())
if m.Remark != "" {
tx = tx.Where("remark like ?", "%"+m.Remark+"%")
}
if m.Name != "" {
tx = tx.Where("name like ?", "%"+m.Name+"%")
}
err = pagination.Search(tx)
return
}

//SshFilterGroup
type SshFilterGroup struct {
BaseModel
Name string `gorm:"index" json:"name" form:"name"`
Remark string `gorm:"index" json:"remark" form:"remark"`
Filters JsonArraySshFilter `gorm:"type:json" json:"filters" form:"filters"`
}

func (m *SshFilterGroup) AfterFind() (err error) {
return
}

标签:pagination,Remark,tx,区别,PaginationQ,json,引用,go,SshFilterGroup
来源: https://www.cnblogs.com/cheyunhua/p/16129440.html