🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Removed old runtime tagging code. Not used anymore
Deluanef79f6342f3d
diff --git a/persistence/storm/domain_tagging.go b/persistence/storm/domain_tagging.godeleted file mode 100644index ab38b95ab..000000000--- a/persistence/storm/domain_tagging.go+++ /dev/null@@ -1,42 +0,0 @@-package storm--import (- "reflect"-)--func tag(entity interface{}) interface{} {- st := reflect.TypeOf(entity).Elem()- var fs []reflect.StructField- for i := 0; i < st.NumField(); i++ {- f := st.Field(i)- f.Tag = mapTags(f.Tag)- fs = append(fs, f)- }-- st2 := reflect.StructOf(fs)- v := reflect.ValueOf(entity).Elem()- v2 := v.Convert(st2)- vp := reflect.New(st2)- vp.Elem().Set(reflect.ValueOf(v2.Interface()))- return vp.Interface()-}--func mapTags(tags reflect.StructTag) reflect.StructTag {- if tags == `db:"index"` {- return `storm:"index"`- }- return tags-}--func getTypeName(myVar interface{}) string {- if t := reflect.TypeOf(myVar); t.Kind() == reflect.Ptr {- return t.Elem().Name()- } else {- return t.Name()- }-}--func getStructTag(instance interface{}, fieldName string) string {- field, _ := reflect.TypeOf(instance).Elem().FieldByName(fieldName)- return string(field.Tag)-}diff --git a/persistence/storm/domain_tagging_test.go b/persistence/storm/domain_tagging_test.godeleted file mode 100644index 7617898a8..000000000--- a/persistence/storm/domain_tagging_test.go+++ /dev/null@@ -1,33 +0,0 @@-package storm--import (- . "github.com/onsi/ginkgo"- . "github.com/onsi/gomega"-)--type Empty struct {- ID string- Something int-}--type User struct {- ID string- Name string `db:"index"`-}--var _ = Describe("Domain Tagging", func() {-- It("does not change a struct that does not have any tag", func() {- empty := &Empty{}- tagged := tag(empty)- Expect(getStructTag(tagged, "ID")).To(BeEmpty())- Expect(getStructTag(tagged, "Something")).To(BeEmpty())- })-- It("adds index to indexed fields", func() {- user := &User{}- tagged := tag(user)- Expect(getStructTag(tagged, "ID")).To(BeEmpty())- Expect(getStructTag(tagged, "Name")).To(Equal(`storm:"index"`))- })-})