ctdo.de/events.go

23 lines
482 B
Go
Raw Normal View History

package main
func getEvents() []event {
dbValues := readDatabaseYML()
db := dbConnect(dbValues.username, dbValues.password, dbValues.address, dbValues.port, dbValues.database)
rows := dbQuerry(db, "SELECT * FROM events;")
events := []event{}
for rows.Next() {
Event := new(event)
2023-01-28 17:41:04 +00:00
err := rows.Scan(&Event.id, &Event.title, &Event.description, &Event.media, &Event.date)
if err != nil {
2023-01-28 17:44:11 +00:00
panic(err.Error())
}
events = append(events, *Event)
}
return events
}