<commit_before>package v1alpha1

import (
	crdutils "github.com/appscode/kutil/apiextensions/v1beta1"
	apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
)

func (d DormantDatabase) OffshootName() string {
	return d.Name
}

func (d DormantDatabase) ResourceShortCode() string {
	return ResourceCodeDormantDatabase<commit_msg>Add OffshootSelectors to DormantDatabase (#294)<commit_after>package v1alpha1

import (
	crdutils "github.com/appscode/kutil/apiextensions/v1beta1"
	meta_util "github.com/appscode/kutil/meta"
	apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
)

func (d DormantDatabase) OffshootSelectors() map[string]string {
	selector := map[string]string{
		LabelDatabaseName: d.Name,
	}
	switch {
	case d.Spec.Origin.Spec.Etcd != nil:
		selector[LabelDatabaseKind] = ResourceKindEtcd
	case d.Spec.Origin.Spec.Elasticsearch != nil:
		selector[LabelDatabaseKind] = ResourceKindElasticsearch
	case d.Spec.Origin.Spec.Memcached != nil:
		selector[LabelDatabaseKind] = ResourceKindMemcached
	case d.Spec.Origin.Spec.MongoDB != nil:
		selector[LabelDatabaseKind] = ResourceKindMongoDB
	case d.Spec.Origin.Spec.MySQL != nil:
		selector[LabelDatabaseKind] = ResourceKindMySQL
	case d.Spec.Origin.Spec.Postgres != nil:
		selector[LabelDatabaseKind] = ResourceKindPostgres
	case d.Spec.Origin.Spec.Redis != nil:
		selector[LabelDatabaseKind] = ResourceKindRedis
	}
	return selector
}

func (d DormantDatabase) OffshootLabels() map[string]string {
	return meta_util.FilterKeys(GenericKey, d.OffshootSelectors(), d.Spec.Origin.Labels)
}

func (d DormantDatabase) OffshootName() string {
	return d.Name
}

func (d DormantDatabase) ResourceShortCode() string {
	return ResourceCodeDormantDatabase
{'fraction_non_alphanumeric': 0.10457142857142857, 'fraction_numerical': 0.009714285714285713, 'mean_word_length': 6.146938775510204, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '407463', 'n_tokens_mistral': 625, 'n_tokens_neox': 606, 'n_words': 103}