[feat] 新增 GetOrmJoinsByResRelations 方法

This commit is contained in:
what-00 2023-04-13 14:47:03 +08:00
parent 9426da7d6b
commit e095ca8bc0

View File

@ -1,5 +1,9 @@
package base package base
import (
"git.fsdpf.net/go/contracts"
)
type ResRelation struct { type ResRelation struct {
Uuid string `db:"uuid"` Uuid string `db:"uuid"`
CategoryUuid string `db:"category_uuid"` // 所属 UUID CategoryUuid string `db:"category_uuid"` // 所属 UUID
@ -16,9 +20,11 @@ type ResRelation struct {
type GetResRelations func(categoryUuid string) []ResRelation type GetResRelations func(categoryUuid string) []ResRelation
type GetOrmJoinsByResRelations func(root string, items []ResRelation) []contracts.Join
// 资源关联依赖 // 资源关联依赖
func GetJoinResDependencies(code string, items []ResRelation) (dependencies []string) { func GetJoinResDependencies(root string, items []ResRelation) (dependencies []string) {
dependencies = []string{code} dependencies = []string{root}
for { for {
done := true done := true