25 lines
416 B
Go
25 lines
416 B
Go
package form
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/go-playground/mold/v4"
|
|
"github.com/go-playground/mold/v4/scrubbers"
|
|
)
|
|
|
|
var (
|
|
scrub = NewScrubbers()
|
|
)
|
|
|
|
func NewScrubbers() *mold.Transformer {
|
|
return scrubbers.New()
|
|
}
|
|
|
|
func ScrubStruct(v interface{}) error {
|
|
return ScrubStructWithContext(context.TODO(), v)
|
|
}
|
|
|
|
func ScrubStructWithContext(ctx context.Context, v interface{}) error {
|
|
return scrub.Struct(ctx, v)
|
|
}
|