```
func (store *MysqlStore) ObservationsAutour(db *sql.DB, x int, y int, z int, dist int, trollId int, amis []int, withTresors bool) ([]*Observation, error) {
sql := "select auteur, num, date, type, nom, x, y, z from observation where"
sql += " x>" + strconv.Itoa(x-dist-1) + " and x<" + strconv.Itoa(x+dist+1)
sql += " and y>" + strconv.Itoa(y-dist-1) + " and y<" + strconv.Itoa(y+dist+1)
sql += " and z>" + strconv.Itoa(z-dist/2-1) + " and z<" + strconv.Itoa(z+dist/2+1)
if !withTresors {
sql += " and type<>'tresor'"
}
sql += " and auteur in (" + strconv.Itoa(trollId)
for _, id := range amis {
sql += "," + strconv.Itoa(id)
}
sql += ") order by type, num, date desc"
rows, err := db.Query(sql)
observations := make([]*Observation, 0, 20)
for rows.Next() {
r := new(Observation)
err = rows.Scan(&r.Auteur, &r.Num, &r.Date, &r.Type, &r.Nom, &r.X, &r.Y, &r.Z)
if err != nil {
return nil, err
}
if len(observations) > 0 && r.Num == observations[len(observations)-1].Num { // dédoublonnage
continue
}
observations = append(observations, r)
}
rows.Close()
return observations, nil
}
```