Exemplo n.º 1
0
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()
}
Exemplo n.º 2
0
Arquivo: test.go Projeto: 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)
	}
}
Exemplo n.º 3
0
Arquivo: test.go Projeto: 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)
	}
}