Count method
This commit is contained in:
18
app/main.go
18
app/main.go
@ -89,6 +89,21 @@ func doList(db *gorm.DB) {
|
||||
}
|
||||
}
|
||||
|
||||
func doCount(db *gorm.DB) {
|
||||
repo := repository.RepoBase[models.Cert]{}
|
||||
repo.Init(db, nil)
|
||||
|
||||
filter := CertFilter{
|
||||
Alive: &TRUE,
|
||||
}
|
||||
|
||||
count, err := repo.Count(filter)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
fmt.Printf(">>> count: %d\n", count)
|
||||
}
|
||||
|
||||
func doGet(db *gorm.DB) {
|
||||
repo := repository.RepoBase[models.Cert]{}
|
||||
repo.Init(db, nil)
|
||||
@ -130,8 +145,9 @@ func main() {
|
||||
|
||||
db := db.InitDB()
|
||||
|
||||
doMagic(db)
|
||||
// doMagic(db)
|
||||
// doList(db)
|
||||
doCount(db)
|
||||
// doGet(db)
|
||||
// doExists(db)
|
||||
// inheritance.DoInheritanceTest()
|
||||
|
||||
Reference in New Issue
Block a user