fx build fix
This commit is contained in:
44
api/server/internal/mutil/param/helper.go
Normal file
44
api/server/internal/mutil/param/helper.go
Normal file
@@ -0,0 +1,44 @@
|
||||
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),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user