func PrintTable(orm beedb.Model) {
	var users []User

	if err := orm.FindAll(&users); err != nil {
		panic(err)
	}

	fmt.Printf("%+v,", users)
	for _, user := range users {
		fmt.Printf("%+v,", user)
	}
	fmt.Println()
}
Esempio n. 2
0
File: test.go Progetto: roca/GO
func QueryRows2(db *sql.DB) {

	var orm beedb.Model

	var allCommands []Command

	beedb.PluralizeTableNames = true

	orm = beedb.New(db, "pg")
	beedb.OnDebug = true

	err := orm.FindAll(&allCommands)
	if err != nil {
		panic(err)
	}

	for i, command := range allCommands {
		fmt.Printf("row %d : %s %s\n", i, command.Path, command.Dir)
	}
}
Esempio n. 3
0
File: test.go Progetto: roca/GO
func QueryRows2(db *sql.DB) {

	var orm beedb.Model

	var allclones []Clone

	beedb.PluralizeTableNames = true

	orm = beedb.New(db, "pg")
	beedb.OnDebug = true

	err := orm.FindAll(&allclones)
	if err != nil {
		panic(err)
	}

	for i, clone := range allclones {
		fmt.Printf("row %d : %s %s\n", i, clone.Name, clone.Seq)
	}
}