weapp/internal/pkg/form/conform.go

23 lines
417 B
Go
Raw Normal View History

2021-12-28 01:49:22 +08:00
package form
import (
"context"
"github.com/go-playground/mold/v4"
"github.com/go-playground/mold/v4/modifiers"
)
var conform = NewConform()
func NewConform() *mold.Transformer {
return modifiers.New()
}
func ConformStruct(v interface{}) error {
return ConformStructWithContext(context.TODO(), v)
}
func ConformStructWithContext(ctx context.Context, v interface{}) error {
return conform.Struct(ctx, v)
}