Skip to content

Instantly share code, notes, and snippets.

@gavinzhou
Last active November 9, 2018 12:28
Show Gist options
  • Save gavinzhou/bfd8c3863c8f670303a807b10c18f52b to your computer and use it in GitHub Desktop.
Save gavinzhou/bfd8c3863c8f670303a807b10c18f52b to your computer and use it in GitHub Desktop.
package models
type Tag struct {
Model
Name string `json:"name"`
CreatedBy string `json:"created_by"`
ModifiedBy string `json:"modified_by"`
State int `json:"state"`
}
func GetTags(pageNum int, pageSize int, maps interface{}) (tags []Tag) {
db.Where(maps).Offset(pageNum).Limit(pageSize).Find(&tags)
return
}
func GetTagTotal(maps interface{}) (count int) {
db.Model(&Tag{}).Where(maps).Count(&count)
return
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment