func (s SqlAuditStore) Save(audit *model.Audit) StoreChannel { storeChannel := make(StoreChannel, 1) go func() { result := StoreResult{} audit.Id = model.NewId() audit.CreateAt = model.GetMillis() if err := s.GetMaster().Insert(audit); err != nil { result.Err = model.NewLocAppError("SqlAuditStore.Save", "store.sql_audit.save.saving.app_error", nil, "user_id="+ audit.UserId+" action="+audit.Action) } storeChannel <- result close(storeChannel) }() return storeChannel }
func (s SqlAuditStore) Save(audit *model.Audit) StoreChannel { storeChannel := make(StoreChannel) go func() { result := StoreResult{} audit.Id = model.NewId() audit.CreateAt = model.GetMillis() if err := s.GetMaster().Insert(audit); err != nil { result.Err = model.NewAppError("SqlAuditStore.Save", "We encounted an error saving the audit", "user_id="+ audit.UserId+" action="+audit.Action) } storeChannel <- result close(storeChannel) }() return storeChannel }