func (mg *Grant) ResolveReferences(ctx context.Context, c client.Reader) error {
	r := reference.NewAPIResolver(c, mg)
	rsp, err := r.Resolve(ctx, reference.ResolutionRequest{
		CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Database),
		Reference:    mg.Spec.ForProvider.DatabaseRef,
		Selector:     mg.Spec.ForProvider.DatabaseSelector,
		To:           reference.To{Managed: &Database{}, List: &DatabaseList{}},
		Extract:      reference.ExternalName(),
	})
	if err != nil {
		return errors.Wrap(err, "spec.forProvider.database")
	}
	mg.Spec.ForProvider.Database = reference.ToPtrValue(rsp.ResolvedValue)
	mg.Spec.ForProvider.DatabaseRef = rsp.ResolvedReference
	rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
		CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.Role),
		Reference:    mg.Spec.ForProvider.RoleRef,
		Selector:     mg.Spec.ForProvider.RoleSelector,
		To:           reference.To{Managed: &Role{}, List: &RoleList{}},
		Extract:      reference.ExternalName(),
	})
	if err != nil {
		return errors.Wrap(err, "spec.forProvider.role")
	}
	mg.Spec.ForProvider.Role = reference.ToPtrValue(rsp.ResolvedValue)
	mg.Spec.ForProvider.RoleRef = rsp.ResolvedReference
	rsp, err = r.Resolve(ctx, reference.ResolutionRequest{
		CurrentValue: reference.FromPtrValue(mg.Spec.ForProvider.MemberOf),
		Reference:    mg.Spec.ForProvider.MemberOfRef,
		Selector:     mg.Spec.ForProvider.MemberOfSelector,
		To:           reference.To{Managed: &Role{}, List: &RoleList{}},
		Extract:      reference.ExternalName(),
	})
	if err != nil {
		return errors.Wrap(err, "spec.forProvider.memberOf")
	}
	mg.Spec.ForProvider.MemberOf = reference.ToPtrValue(rsp.ResolvedValue)
	mg.Spec.ForProvider.MemberOfRef = rsp.ResolvedReference
	return nil
}
ResolveReferences of this Grant
package v1alpha1
import (
	"context"
	"github.com/pkg/errors"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"sigs.k8s.io/controller-runtime/pkg/client"
	xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
	"github.com/crossplane/crossplane-runtime/pkg/reference"
)
type GrantSpec struct {
	xpv1.ResourceSpec `json:",inline"`
	ForProvider       GrantParameters `json:"forProvider"`
}
type GrantPrivilege string
type GrantPrivileges []GrantPrivilege
func (gp *GrantPrivileges) ToStringSlice() []string {
	if gp == nil {
		return []string{}
	}
	out := make([]string, len(*gp))
	for i, v := range *gp {
		out[i] = string(v)
	}
	return out
}
type GrantOption string
const (
	GrantOptionAdmin GrantOption = "ADMIN"
	GrantOptionGrant GrantOption = "GRANT"
)
type GrantParameters struct {
	Privileges GrantPrivileges `json:"privileges,omitempty"`
	WithOption *GrantOption `json:"withOption,omitempty"`
	Role *string `json:"role,omitempty"`
	RoleRef *xpv1.Reference `json:"roleRef,omitempty"`
	RoleSelector *xpv1.Selector `json:"roleSelector,omitempty"`
	Database *string `json:"database,omitempty"`
	DatabaseRef *xpv1.Reference `json:"databaseRef,omitempty"`
	DatabaseSelector *xpv1.Selector `json:"databaseSelector,omitempty"`
	MemberOf *string `json:"memberOf,omitempty"`
	MemberOfRef *xpv1.Reference `json:"memberOfRef,omitempty"`
	MemberOfSelector *xpv1.Selector `json:"memberOfSelector,omitempty"`
}
type GrantStatus struct {
	xpv1.ResourceStatus `json:",inline"`
}
type Grant struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec   GrantSpec   `json:"spec"`
	Status GrantStatus `json:"status,omitempty"`
}
type GrantList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Grant `json:"items"`
}