23 lines
417 B
Go
23 lines
417 B
Go
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)
|
|
}
|