fixes on structuring

This commit is contained in:
Fran Jurmanović
2021-05-15 22:23:30 +02:00
parent e7a80796f7
commit cc98d0cf49
10 changed files with 125 additions and 60 deletions

17
pkg/utl/common/embeds.go Normal file
View File

@@ -0,0 +1,17 @@
package common
import (
"strings"
"github.com/go-pg/pg/v10/orm"
)
func GenerateEmbed(qr *orm.Query, embed string) *orm.Query{
if embed != "" {
rels := strings.Split(embed, ",")
for _, rel := range rels {
qr = qr.Relation(rel)
}
}
return qr
}