Пример #1
0
func GetEventsByUserId(db *sql.DB, offset int, userId int64) (events []Event, err error) {
	rows, err := db.Query("SELECT * FROM events WHERE event_user = $2 LIMIT 50 OFFSET $1", offset, userId)
	if err != nil {
		return
	}

	err = crud.ScanAll(rows, &events)

	return
}
Пример #2
0
func GetUsers(db *sql.DB, offset int) (users []User, err error) {
	rows, err := db.Query("SELECT * FROM users LIMIT 50 OFFSET $1", offset)
	if err != nil {
		return
	}

	err = crud.ScanAll(rows, &users)

	return
}
Пример #3
0
func GetAssets(db *sql.DB, offset int) (assets []Asset, err error) {
	rows, err := db.Query("SELECT * FROM assets LIMIT 50 OFFSET $1", offset)
	if err != nil {
		return
	}

	err = crud.ScanAll(rows, &assets)

	return
}