package main func getEvents() []event { db := dbConnect("root", "", "localhost", "3306", "ctdo") rows := dbQuerry(db, "SELECT * FROM events;") events := []event{} for rows.Next() { Event := new(event) err := rows.Scan(&Event.id, &Event.title, &Event.description, &Event.media, &Event.date) if err != nil { panic(err.Error()) } events = append(events, *Event) } return events }