package db import ( "log" ) func (address *Address) Save() error { if err := conn.Save(address).Error; err != nil { return err } return nil } func (address *Address) Delete() error { if err := conn.Delete(address).Error; err != nil { return err } return nil } func CountAddresss() int { var count int64 err := conn.Model(&Address{}).Count(&count) if err != nil { count = 0 log.Println("Error counting addresss: ") } return int(count) }