Skip to content

Instantly share code, notes, and snippets.

@KevinStrong
Created November 16, 2021 19:06
Show Gist options
  • Select an option

  • Save KevinStrong/1ada9a2fb58ad24da40dc090d8759bcb to your computer and use it in GitHub Desktop.

Select an option

Save KevinStrong/1ada9a2fb58ad24da40dc090d8759bcb to your computer and use it in GitHub Desktop.
A golang function to query for a kioskEvent's checkins using gorm
func getKioskEvent(kioskID, eventID uint, db *gorm.DB) (KioskEvent, error) {
kioskEvent := KioskEvent{}
result := db.Preload("Checkins").Where(&KioskEvent{KioskID: kioskID, EventID: eventID}).First(&kioskEvent)
return kioskEvent, result.Error
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment