update the file structure update Initialise function , update interface and update code and write table test cases
This commit is contained in:
31
shared/plugin/implementations/validator/cmd/plugin.go
Normal file
31
shared/plugin/implementations/validator/cmd/plugin.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"beckn-onix/shared/plugin/definition"
|
||||
"beckn-onix/shared/plugin/implementations/validator"
|
||||
)
|
||||
|
||||
// ValidatorProvider provides instances of Validator.
|
||||
type ValidatorProvider struct{}
|
||||
|
||||
// New initializes a new Verifier instance.
|
||||
func (vp ValidatorProvider) New(ctx context.Context, config map[string]string) (map[string]definition.Validator, error) {
|
||||
// Create a new Validator instance with the provided configuration
|
||||
validators, err := validator.New(ctx, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Convert the map to the expected type
|
||||
result := make(map[string]definition.Validator)
|
||||
for key, val := range validators {
|
||||
result[key] = val
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Provider is the exported symbol that the plugin manager will look for.
|
||||
var Provider definition.ValidatorProvider = ValidatorProvider{}
|
||||
Reference in New Issue
Block a user