// MySQLUser is a helper func that builds a mysql user
MySQLUser is a helper func that builds a mysql user
// MySQLUser is a helper func that builds a mysql user
func MySQLUser(cluster *mysqlv1alpha1.MysqlCluster, opts ...MySQLUserOption) *mysqluser.MySQLUser {
	user := fmt.Sprintf("user-%d", rand.Int31())
	opts = append([]MySQLUserOption{WithUser(user)}, opts...)
	mu := mysqluser.Wrap(&mysqlv1alpha1.MysqlUser{
		ObjectMeta: metav1.ObjectMeta{
			Namespace: "default",
		},
		Spec: mysqlv1alpha1.MysqlUserSpec{
			ClusterRef: mysqlv1alpha1.ClusterReference{
				LocalObjectReference: corev1.LocalObjectReference{Name: cluster.Name},
				Namespace:            cluster.Namespace,
			},
			AllowedHosts: []string{"%"},
		},
	})
	for _, opt := range opts {
		Expect(opt(mu)).To(Succeed())
	}
	return mu
}
func MySQLUser ( cluster * mysqlv1alpha1 . MysqlCluster , opts ... MySQLUserOption ) * mysqluser . MySQLUser { user := fmt . Sprintf ( " " , rand . Int31 ( ) ) opts = append ( [ ] MySQLUserOption { WithUser ( user ) } , opts ... ) mu := mysqluser . Wrap ( & mysqlv1alpha1 . MysqlUser { ObjectMeta : metav1 . ObjectMeta { Namespace : " " , } , Spec : mysqlv1alpha1 . MysqlUserSpec { ClusterRef : mysqlv1alpha1 . ClusterReference { LocalObjectReference : corev1 . LocalObjectReference { Name : cluster . Name } , Namespace : cluster . Namespace , } , AllowedHosts : [ ] string { " " } , } , } ) for _ , opt := range opts { Expect ( opt ( mu ) ) . To ( Succeed ( ) ) } return mu }
MySQLUser is a helper func that builds a mysql user
MySQLUser is a helper func that builds a mysql user
// Set a default user and implicitly a resource name