func (s *Server) validate() grpc.UnaryServerInterceptor {
	return func(ctx context.Context, req interface{}, args *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error) {
		if err = validate.Struct(req); err != nil {
			err = ecode.Error(ecode.RequestErr, err.Error())
			return
		}
		resp, err = handler(ctx, req)
		return
	}
}
Validate return a client interceptor validate incoming request per RPC call.
package warden
import (
	"context"
	"github.com/mapgoo-lab/atreus/pkg/ecode"
	"google.golang.org/grpc"
	"gopkg.in/go-playground/validator.v9"
)
var validate = validator.New()