Beispiel #1
0
func main() {
	//logger
	simplify.Debug = true

	sim, err := simplify.Open("postgres", "user=basego dbname=basego password=basego sslmode=disable")
	checkErr(err)
	defer sim.Close()

	//query
	var users []User
	err = sim.Query(&users, "SELECT * FROM \"user\" ORDER BY name ASC")
	fmt.Println("users: ", users)
	checkErr(err)

}
Beispiel #2
0
func main() {
	//logger
	simplify.Debug = true

	sim, err := simplify.Open("postgres", "user=basego dbname=basego password=basego sslmode=disable")
	checkErr(err)
	defer sim.Close()

	//query
	var users []User
	err = sim.All(&users)
	checkErr(err)

	for i, user := range users {
		fmt.Println("user: "******"", "")
	checkErr(err)
	fmt.Println("json users: ", string(jsonUsers))
}