14 Star 207 Fork 31

杰克 / elk-blog

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
link.go 899 Bytes
一键复制 编辑 原始数据 按行查看 历史
package service
import (
"gitee.com/jikey/elk-blog/app/model"
db "gitee.com/jikey/elk-blog/app/model"
)
type link struct {
}
var Link *link
func (l *link) List(PageNum int, PageSize int, maps interface{}) (link []*model.Link) {
db.Mysql.Where(maps).Offset((PageNum - 1) * PageSize).Limit(PageSize).Order("ord asc, id asc").Find(&link)
return
}
func (l *link) Create(model *model.Link) (err error) {
err = db.Mysql.Create(model).Error
return err
}
// Total 获取 blog 总记录数
func (l *link) Total(maps interface{}) (count int) {
db.Mysql.Model(&link{}).Where(maps).Count(&count)
return
}
// Update 修改
func (l *link) Update(id string, model *model.Link) (err error) {
err = db.Mysql.Model(&model).Where("id = ? ", id).Updates(model).Error
return err
}
// Delete 删除
func (l *link) Delete(id string) bool {
db.Mysql.Where("id = ?", id).Delete(&link{})
return true
}
Go
1
https://gitee.com/jikey/elk-blog.git
git@gitee.com:jikey/elk-blog.git
jikey
elk-blog
elk-blog
d402f94cccdf

搜索帮助