Пример #1
0
func (model DomainsModel) fetchRow(query db.Select, scanFunc db.ScanFunction) *Domain {

	sql, bind := query.Build()
	item, err := scanFunc(model.db.QueryRow(sql, bind...))
	webapp.Panic(err)

	result := Domain{}
	result = item.(Domain)

	return &result
}
Пример #2
0
func (model ServicesModel) fetchRow(query db.Select, scanFunc db.ScanFunction) *Service {

	sql, bind := query.Build()
	item, err := scanFunc(model.db.QueryRow(sql, bind...))
	webapp.Panic(err)

	result := Service{}
	result = item.(Service)

	return &result
}
Пример #3
0
func (model DomainsModel) fetchAll(query db.Select, scanFunc db.ScanFunction) []Domain {

	sql, bind := query.Build()
	rows, err := model.db.Query(sql, bind...)
	webapp.Panic(err)

	defer rows.Close()

	items := []Domain{}

	for rows.Next() {
		item, err := scanFunc(rows)
		webapp.Panic(err)
		items = append(items, item.(Domain))
	}

	return items
}