func (graph *Module) GetDBAlias(ctx context.Context, field *ast.Field, token string, store utils.M) (string, error) {
	if len(field.Directives) == 0 {
		return "", errors.New("database / service directive not provided")
	}
	dbAlias, err := graph.getDirectiveName(ctx, field.Directives[0], token, store)
	if err != nil {
		return "", err
	}
	if _, err := graph.crud.GetDBType(dbAlias); err == nil {
		return dbAlias, nil
	}
	return "", helpers.Logger.LogError(helpers.GetRequestID(ctx), fmt.Sprintf("Provided db alias (@%s) does not exists. Ensure you are using the alias provided while db setup", dbAlias), nil, nil)
}
GetDBAlias returns the dbAlias of the request
package graphql
import (
	"context"
	"errors"
	"fmt"
	"reflect"
	"strings"
	"sync"
	"text/template"
	"github.com/graphql-go/graphql/language/ast"
	"github.com/spaceuptech/helpers"
	"github.com/spaceuptech/space-cloud/gateway/model"
	"github.com/spaceuptech/space-cloud/gateway/utils"
	tmpl2 "github.com/spaceuptech/space-cloud/gateway/utils/tmpl"
)
func shallowClone(obj utils.M) utils.M {
	temp := utils.M{}
	for k, v := range obj {
		temp[k] = v
	}
	return temp
}
func (graph *Module) getDirectiveName(ctx context.Context, directive *ast.Directive, token string, store utils.M) (string, error) {
	if directive.Name.Value == "template" {
		return graph.processTemplateDirective(ctx, directive, token, store)
	}
	return directive.Name.Value, nil
}
func (graph *Module) processTemplateDirective(ctx context.Context, directive *ast.Directive, token string, store utils.M) (string, error) {
	goTmpl := "none"
	for _, args := range directive.Arguments {
		if args.Name.Value == "value" {
			goTmplTemp, err := utils.ParseGraphqlValue(args.Value, store)
			if err != nil {
				return "", err
			}
			var ok bool
			goTmpl, ok = goTmplTemp.(string)
			if !ok {
				return "", helpers.Logger.LogError(helpers.GetRequestID(ctx), fmt.Sprintf("Invalid template type (%s) provided for directive", reflect.TypeOf(goTmplTemp)), nil, nil)
			}
			break
		}
	}
	if goTmpl == "none" {
		return "", helpers.Logger.LogError(helpers.GetRequestID(ctx), "The `@template` directive cannot be used without a `value` argument", nil, nil)
	}
	var claims map[string]interface{}
	claimsTemp, p := store["auth-claims"]
	if p {
		claims, _ = claimsTemp.(map[string]interface{})
	}
	var err error
	if claims == nil {
		claims, err = graph.auth.ParseToken(ctx, token)
		if err != nil {
			return "", err
		}
		store["auth-claims"] = claims
	}
	t := template.New("template-directive")
	t = t.Funcs(tmpl2.CreateGoFuncMaps(nil))
	t, err = t.Parse(goTmpl)
	if err != nil {
		return "", helpers.Logger.LogError(helpers.GetRequestID(ctx), "Unable to parse provided template in security rule (Webhook)", err, nil)
	}
	return tmpl2.ExecTemplate(ctx, t, map[string]interface{}{"auth": claims})
}
func getFieldName(field *ast.Field) string {
	if field.Alias != nil {
		return field.Alias.Value
	}
	return field.Name.Value
}