func (p *postgres) GetLaptopByID(id int) (models.Laptop, error) {
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
	defer cancel()

	var laptop models.Laptop

	query := `SELECT id, laptop_name, created_at, updated_at FROM laptops
			 WHERE id = $1`
	row := p.DB.QueryRowContext(ctx, query, id)
	err := row.Scan(
		&laptop.ID,
		&laptop.LaptopName,
		&laptop.CreatedAt,
		&laptop.UpdatedAt,
	)

	if err != nil {
		return laptop, err
	}

	return laptop, nil
}
// GetLaptopByID gets a laptop by id
GetLaptopByID gets a laptop by id
// GetLaptopByID gets a laptop by id
func (p *postgres) GetLaptopByID(id int) (models.Laptop, error) {
	ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
	defer cancel()
	var laptop models.Laptop
	query := `SELECT id, laptop_name, created_at, updated_at FROM laptops
			 WHERE id = $1`
	row := p.DB.QueryRowContext(ctx, query, id)
	err := row.Scan(
		&laptop.ID,
		&laptop.LaptopName,
		&laptop.CreatedAt,
		&laptop.UpdatedAt,
	)
	if err != nil {
		return laptop, err
	}
	return laptop, nil
}
func ( p * postgres ) GetLaptopByID ( id int ) ( models . Laptop , error ) { ctx , cancel := context . WithTimeout ( context . Background ( ) , 3 * time . Second ) defer cancel ( ) var laptop models . Laptop query := `SELECT id, laptop_name, created_at, updated_at FROM laptops
			 WHERE id = $1` row := p . DB . QueryRowContext ( ctx , query , id ) err := row . Scan ( & laptop . ID , & laptop . LaptopName , & laptop . CreatedAt , & laptop . UpdatedAt , ) if err != nil { return laptop , err } return laptop , nil }
GetLaptopByID gets a laptop by id
GetLaptopByID gets a laptop by id