Пример #1
0
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
}
Пример #2
0
func DeleteUser(q *qbs.Qbs, id int64) (affected int64, err error) {
	user := new(User)
	user.Id = id
	return q.Delete(user)
}