Count method

This commit is contained in:
Eden Kirin
2024-06-25 01:52:50 +02:00
parent 4615d55309
commit 3dc8d0d79f
5 changed files with 122 additions and 7 deletions

View File

@ -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()