Files
wallet-go-api/pkg/utl/common/embeds.go
Fran Jurmanović cc98d0cf49 fixes on structuring
2021-05-15 22:23:30 +02:00

18 lines
259 B
Go

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
}