mirror of
https://github.com/grafana/grafana.git
synced 2024-11-27 11:20:27 -06:00
21 lines
421 B
Go
21 lines
421 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"errors"
|
||
|
"fmt"
|
||
|
|
||
|
"github.com/grafana/grafana/pkg/bus"
|
||
|
"github.com/grafana/grafana/pkg/models"
|
||
|
)
|
||
|
|
||
|
func CheckOrgExists(orgID int64) error {
|
||
|
query := models.GetOrgByIdQuery{Id: orgID}
|
||
|
if err := bus.Dispatch(&query); err != nil {
|
||
|
if errors.Is(err, models.ErrOrgNotFound) {
|
||
|
return err
|
||
|
}
|
||
|
return fmt.Errorf("failed to check whether org. with the given ID exists: %w", err)
|
||
|
}
|
||
|
return nil
|
||
|
}
|