示例#1
0
func (r *TopicRepository) Update(topic *core.Topic) error {
	_, err := dat.Update(r, topic.ID(), topic)
	if err != nil {
		log.Printf("Error updating topic: %s", err)
	}

	return err
}
示例#2
0
func (r *TopicRepository) Save(topic *core.Topic) error {
	result, err := dat.Create(r, topic)
	if err != nil {
		log.Printf("Error creating new topic: %s", err)
		return err
	}

	topic.SetID(result.GeneratedKeys[0])

	return nil
}