Пример #1
0
func GetAlertById(query *m.GetAlertByIdQuery) error {
	alert := m.Alert{}
	has, err := x.Id(query.Id).Get(&alert)
	if !has {
		return fmt.Errorf("could not find alert")
	}
	if err != nil {
		return err
	}

	query.Result = &alert
	return nil
}
Пример #2
0
func GetAlertById(query *m.GetAlertByIdQuery) error {
	var Alert m.Alert
	has, err := x.Id(query.Id).Get(&Alert)

	if err != nil {
		return err
	} else if has == false {
		return m.ErrInvalidAlert
	}

	query.Result = &Alert
	return nil
}