func (app *App) FindOneCM(ctx context.Context, id string) (*contactmethod.ContactMethod, error) {
	loader, ok := ctx.Value(dataLoaderKeyUser).(*dataloader.CMLoader)
	if !ok {
		return app.CMStore.FindOne(ctx, id)
	}
	return loader.FetchOne(ctx, id)
}
FindOneCM will return a single contact method for the given id, using the contexts dataloader if enabled.
package graphqlapp
import (
	context "context"
	"io"
	"github.com/target/goalert/alert"
	"github.com/target/goalert/dataloader"
	"github.com/target/goalert/escalation"
	"github.com/target/goalert/heartbeat"
	"github.com/target/goalert/notification"
	"github.com/target/goalert/schedule"
	"github.com/target/goalert/schedule/rotation"
	"github.com/target/goalert/service"
	"github.com/target/goalert/user"
	"github.com/target/goalert/user/contactmethod"
	"github.com/pkg/errors"
)
type dataLoaderKey int
const (
	dataLoaderKeyUnknown = dataLoaderKey(iota)
	dataLoaderKeyAlert
	dataLoaderKeyEP
	dataLoaderKeyRotation
	dataLoaderKeySchedule
	dataLoaderKeyService
	dataLoaderKeyUser
	dataLoaderKeyCM
	dataLoaderKeyHeartbeatMonitor
	dataLoaderKeyNotificationMessageStatus
	dataLoaderKeyLast  
)
func (a *App) registerLoaders(ctx context.Context) context.Context {
	ctx = context.WithValue(ctx, dataLoaderKeyAlert, dataloader.NewAlertLoader(ctx, a.AlertStore))
	ctx = context.WithValue(ctx, dataLoaderKeyEP, dataloader.NewPolicyLoader(ctx, a.PolicyStore))
	ctx = context.WithValue(ctx, dataLoaderKeyRotation, dataloader.NewRotationLoader(ctx, a.RotationStore))
	ctx = context.WithValue(ctx, dataLoaderKeySchedule, dataloader.NewScheduleLoader(ctx, a.ScheduleStore))
	ctx = context.WithValue(ctx, dataLoaderKeyService, dataloader.NewServiceLoader(ctx, a.ServiceStore))
	ctx = context.WithValue(ctx, dataLoaderKeyUser, dataloader.NewUserLoader(ctx, a.UserStore))
	ctx = context.WithValue(ctx, dataLoaderKeyCM, dataloader.NewCMLoader(ctx, a.CMStore))
	ctx = context.WithValue(ctx, dataLoaderKeyNotificationMessageStatus, dataloader.NewNotificationMessageStatusLoader(ctx, a.NotificationStore))
	ctx = context.WithValue(ctx, dataLoaderKeyHeartbeatMonitor, dataloader.NewHeartbeatMonitorLoader(ctx, a.HeartbeatStore))
	return ctx
}
func (a *App) closeLoaders(ctx context.Context) {
	for key := dataLoaderKeyUnknown; key < dataLoaderKeyLast; key++ {
		loader, ok := ctx.Value(key).(io.Closer)
		if !ok {
			continue
		}
		loader.Close()
	}
}
func (app *App) FindOneNotificationMessageStatus(ctx context.Context, id string) (*notification.SendResult, error) {
	loader, ok := ctx.Value(dataLoaderKeyNotificationMessageStatus).(*dataloader.NotificationMessageStatusLoader)
	if !ok {
		ms, err := app.NotificationStore.FindManyMessageStatuses(ctx, id)
		if err != nil {
			return nil, err
		}
		return &ms[0], nil
	}
	return loader.FetchOne(ctx, id)
}
func (app *App) FindOneRotation(ctx context.Context, id string) (*rotation.Rotation, error) {
	loader, ok := ctx.Value(dataLoaderKeyRotation).(*dataloader.RotationLoader)
	if !ok {
		return app.RotationStore.FindRotation(ctx, id)
	}
	return loader.FetchOne(ctx, id)
}
func (app *App) FindOneSchedule(ctx context.Context, id string) (*schedule.Schedule, error) {
	loader, ok := ctx.Value(dataLoaderKeySchedule).(*dataloader.ScheduleLoader)
	if !ok {
		return app.ScheduleStore.FindOne(ctx, id)
	}
	return loader.FetchOne(ctx, id)
}
func (app *App) FindOneUser(ctx context.Context, id string) (*user.User, error) {
	loader, ok := ctx.Value(dataLoaderKeyUser).(*dataloader.UserLoader)
	if !ok {
		return app.UserStore.FindOne(ctx, id)
	}
	return loader.FetchOne(ctx, id)
}