// Constructor func NewUser(name string, age int) *User { user := &User{ Name: name, Age: age, } db.Get().Create(user) return user }
func AllUsers() []*User { var users []*User db.Get().Find(&users) return users }
func GetUser(id int) *User { var user *User db.Get().Where("id = ?", id).First(user) return user }