Avoid Atoi to avoid int convertion

This commit is contained in:
nemunaire 2018-12-01 16:15:28 +01:00
commit 0f48b27a04
11 changed files with 32 additions and 39 deletions

View file

@ -59,13 +59,9 @@ func GetEvents() ([]Event, error) {
}
// GetEvent retrieves the event with the given id
func GetEvent(id int) (Event, error) {
var e Event
if err := DBQueryRow("SELECT id_event, txt, kind, time FROM events WHERE id_event=?", id).Scan(&e.Id, &e.Text, &e.Kind, &e.Time); err != nil {
return e, err
}
return e, nil
func GetEvent(id int64) (e Event, err error) {
err = DBQueryRow("SELECT id_event, txt, kind, time FROM events WHERE id_event=?", id).Scan(&e.Id, &e.Text, &e.Kind, &e.Time)
return
}
// NewEvent creates a new event in the database and returns the corresponding structure