當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Qbs.Close方法代碼示例

本文整理匯總了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
}
開發者ID:GoSteelProgrammers,項目名稱:talk-review-orms,代碼行數:42,代碼來源:query.go

示例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
}
開發者ID:GoSteelProgrammers,項目名稱:talk-review-orms,代碼行數:21,代碼來源:relationship.go

示例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
}
開發者ID:GoSteelProgrammers,項目名稱:talk-review-orms,代碼行數:24,代碼來源:crud.go


注:本文中的github.com/coocood/qbs.Qbs.Close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。