func main() {
	var (
		q    *qbs.Qbs
		user *User
	)

	q = SetupDb()
	defer q.Close()

	//START CODE OMIT
	q.Save(&User{Id: 1, FirstName: "John", LastName: "Doe", Age: 25})
	PrintTable(q)

	user = &User{Id: 1}
	q.Find(user)

	user.FirstName = "James"
	q.Save(user)
	PrintTable(q)

	q.Delete(user)
	PrintTable(q)
	//END CODE OMIT
}
Example #2
0
func DeleteUser(q *qbs.Qbs, id int64) (affected int64, err error) {
	user := new(User)
	user.Id = id
	return q.Delete(user)
}