// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.16.0
// source: query.sql

package sqlc

import (
	"context"
)

const fetchStudents = `-- name: FetchStudents :many
SELECT id, fname, lname, date_of_birth, email, address, gender FROM students LIMIT ?
`

func (q *Queries) FetchStudents(ctx context.Context, limit int32) ([]Student, error) {
	rows, err := q.db.QueryContext(ctx, fetchStudents, limit)
	if err != nil {
		return nil, err
	}
	defer rows.Close()
	var items []Student
	for rows.Next() {
		var i Student
		if err := rows.Scan(
			&i.ID,
			&i.Fname,
			&i.Lname,
			&i.DateOfBirth,
			&i.Email,
			&i.Address,
			&i.Gender,
		); err != nil {
			return nil, err
		}
		items = append(items, i)
	}
	if err := rows.Close(); err != nil {
		return nil, err
	}
	if err := rows.Err(); err != nil {
		return nil, err
	}
	return items, nil
}
