本文整理汇总了Golang中github.com/coocood/qbs.Qbs.Close方法的典型用法代码示例。如果您正苦于以下问题:Golang Qbs.Close方法的具体用法?Golang Qbs.Close怎么用?Golang Qbs.Close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/coocood/qbs.Qbs
的用法示例。
在下文中一共展示了Qbs.Close方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: main
func main() {
var (
q *qbs.Qbs
)
q = SetupDb()
defer q.Close()
//START SETUP OMIT
q.Save(&User{
Id: 1,
FirstName: "John",
LastName: "Doe",
Age: 24,
})
q.Save(&User{
Id: 2,
FirstName: "Jane",
LastName: "Doe",
Age: 52,
})
q.Save(&User{
Id: 3,
FirstName: "Joe",
LastName: "Shmoe",
Age: 10,
})
//END SETUP OMIT
//START CODE OMIT
var users []*User
q.Condition(qbs.NewCondition("last_name = ?", "Doe").Or("age < ?", 12)).Limit(2).OrderByDesc("age").FindAll(&users)
for _, user := range users {
fmt.Printf("%+v,", user)
}
fmt.Println()
//END CODE OMIT
}
示例2: main
func main() {
var (
q *qbs.Qbs
user *User
)
q = SetupDb()
defer q.Close()
profile := &Profile{Homepage: "www.example.com", Interests: "Golang", Id: 1}
q.Save(profile)
q.Save(&User{Id: 1, FirstName: "John", LastName: "Doe", Age: 25, ProfileId: 1})
//START CODE OMIT
user = &User{Id: 1}
q.Find(user)
fmt.Printf("%+v\n", user)
fmt.Printf("%+v\n", user.Profile)
//END CODE OMIT
}
示例3: main
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
}