func (this *CCUserHandler) DeleteUser(c *gin.Context) { fmt.Println("Deleting events - ") filter := util.ExtractEventFilter(c) err := dbObj.Remove(filter) if err != nil { fmt.Println("Unable to remove data - ", err.Error()) } }
func (this *CCEventHandler) FetchAllEvent(c *gin.Context) models.Event_List { this.Load() fmt.Println("Fetching all events - ") filter := util.ExtractEventFilter(c) results := []models.CCEvent{} err := dbObj.Find(filter).All(&results) if err != nil { fmt.Println("Unable to fetch data - ", err.Error()) } var event []models.Event for i := 0; i < len(results); i++ { eventModel := this.LoadModel(results[i]) event = append(event, eventModel) } events := models.Event_List{Events: event} return events }