Files
sendico/api/server/internal/mutil/param/helper.go
Stephan D 49b86efecb
Some checks failed
ci/woodpecker/push/db Pipeline was successful
ci/woodpecker/push/fx/1 Pipeline failed
ci/woodpecker/push/nats Pipeline was successful
ci/woodpecker/push/fx/2 Pipeline failed
fx build fix
2025-11-08 00:30:29 +01:00

45 lines
882 B
Go

package mutil
import (
"net/http"
mutilimp "github.com/tech/sendico/server/internal/mutil/param/internal"
"go.mongodb.org/mongo-driver/bson/primitive"
)
type ParamHelper interface {
Name() string
RefName() string
GetID(r *http.Request) string
GetRef(r *http.Request) (primitive.ObjectID, error)
AddRef(base string) string
}
func CreatePH(resource string) ParamHelper {
return mutilimp.CreateImp(resource)
}
type DependentParamHelper struct {
p ParamHelper
c ParamHelper
}
func (ph *DependentParamHelper) Parent() ParamHelper {
return ph.p
}
func (ph *DependentParamHelper) Child() ParamHelper {
return ph.c
}
func (ph *DependentParamHelper) AddRef(base string) string {
return ph.Parent().AddRef(ph.Child().AddRef(base))
}
func CreateDPH(pRes, cRes string) *DependentParamHelper {
return &DependentParamHelper{
p: CreatePH(pRes),
c: CreatePH(cRes),
}
}