示例#1
0
func GetEvents() (events []*models.Event) {
	store := storage.Orm()
	num, err := store.QueryTable("event").All(&events)
	if err == nil {
		log.Println(num, " events found")
		printEvents(events)
	}
	return
}
示例#2
0
func CreateEvent(name string) {
	store := storage.Orm()
	event := new(models.Event)
	event.Name = name
	id, err := store.Insert(event)
	if err == nil {
		log.Println("Id for the new event is", id)
		event.Id = id
	} else {
		log.Println(err)
	}
}