config 动态加载进来了的
This commit is contained in:
parent
594b8c07d9
commit
16dab0e528
2
Makefile
2
Makefile
|
@ -1,3 +1,5 @@
|
||||||
|
PROTO_FILES=$(shell find proto -name *.proto)
|
||||||
|
|
||||||
.PHONY: proto
|
.PHONY: proto
|
||||||
# generate proto
|
# generate proto
|
||||||
proto:
|
proto:
|
||||||
|
|
|
@ -11,7 +11,8 @@ func Order(ctx context.Context, tag string, request *proto.OrderRequest) (*proto
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return srv.Order(ctx, request)
|
request.Config = srv.Config
|
||||||
|
return srv.Impl.Order(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Query(ctx context.Context, tag string, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
func Query(ctx context.Context, tag string, request *proto.QueryRequest) (*proto.QueryResponse, error) {
|
||||||
|
@ -19,7 +20,8 @@ func Query(ctx context.Context, tag string, request *proto.QueryRequest) (*proto
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return srv.Query(ctx, request)
|
request.Config = srv.Config
|
||||||
|
return srv.Impl.Query(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Notify(ctx context.Context, tag string, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
|
func Notify(ctx context.Context, tag string, request *proto.NotifyRequest) (*proto.NotifyResponse, error) {
|
||||||
|
@ -27,5 +29,6 @@ func Notify(ctx context.Context, tag string, request *proto.NotifyRequest) (*pro
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return srv.Notify(ctx, request)
|
request.Config = srv.Config
|
||||||
|
return srv.Impl.Notify(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,10 @@
|
||||||
package manage
|
package manage
|
||||||
|
|
||||||
import (
|
|
||||||
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
|
|
||||||
)
|
|
||||||
|
|
||||||
var m *pluginManage
|
var m *pluginManage
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
m = &pluginManage{
|
m = &pluginManage{
|
||||||
plugins: make(map[string]*pluginInfo),
|
plugins: make(map[string]*PluginInfo),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +38,12 @@ func Update(c *Config) error {
|
||||||
return m.add(c)
|
return m.add(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func Get(tag string) (shared.PluginService, error) {
|
func Get(tag string) (*PluginInfo, error) {
|
||||||
p, err := m.get(tag)
|
p, err := m.get(tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return p.impl, nil
|
return p, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Remove(tag string) error {
|
func Remove(tag string) error {
|
||||||
|
|
|
@ -6,15 +6,15 @@ import (
|
||||||
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
|
"gitea.cdlsxd.cn/BaseSystem/plugin/shared"
|
||||||
)
|
)
|
||||||
|
|
||||||
type pluginInfo struct {
|
type PluginInfo struct {
|
||||||
tag string
|
Tag string
|
||||||
impl shared.PluginService
|
Impl shared.PluginService
|
||||||
config json.RawMessage
|
Config json.RawMessage
|
||||||
cleanup func()
|
cleanup func()
|
||||||
}
|
}
|
||||||
|
|
||||||
type pluginManage struct {
|
type pluginManage struct {
|
||||||
plugins map[string]*pluginInfo
|
plugins map[string]*PluginInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *pluginManage) exists(tag string) bool {
|
func (m *pluginManage) exists(tag string) bool {
|
||||||
|
@ -33,10 +33,10 @@ func (m *pluginManage) add(c *Config) error {
|
||||||
cleanup()
|
cleanup()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
m.plugins[c.Tag] = &pluginInfo{
|
m.plugins[c.Tag] = &PluginInfo{
|
||||||
tag: c.Tag,
|
Tag: c.Tag,
|
||||||
impl: impl,
|
Impl: impl,
|
||||||
config: c.Config,
|
Config: c.Config,
|
||||||
cleanup: cleanup,
|
cleanup: cleanup,
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -51,7 +51,7 @@ func (m *pluginManage) remove(tag string) error {
|
||||||
return fmt.Errorf("插件不存在[%s]", tag)
|
return fmt.Errorf("插件不存在[%s]", tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *pluginManage) get(tag string) (*pluginInfo, error) {
|
func (m *pluginManage) get(tag string) (*PluginInfo, error) {
|
||||||
if m.exists(tag) {
|
if m.exists(tag) {
|
||||||
return m.plugins[tag], nil
|
return m.plugins[tag], nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package proto
|
package proto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
_ "github.com/envoyproxy/protoc-gen-validate/validate"
|
|
||||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
reflect "reflect"
|
reflect "reflect"
|
||||||
|
@ -685,86 +684,84 @@ var File_proto_plugin_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_proto_plugin_proto_rawDesc = []byte{
|
var file_proto_plugin_proto_rawDesc = []byte{
|
||||||
0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70,
|
0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x76, 0x61, 0x6c,
|
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x70, 0x72, 0x6f,
|
||||||
0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2e, 0x70,
|
0x74, 0x6f, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x74, 0x61, 0x74,
|
0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x22, 0xa9, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x73,
|
||||||
0x75, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74,
|
0x75, 0x6c, 0x74, 0x12, 0x25, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20,
|
||||||
0x79, 0x22, 0xa9, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x25, 0x0a, 0x06,
|
0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74,
|
||||||
0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x70,
|
0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72,
|
||||||
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61,
|
0x64, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72,
|
||||||
0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x18,
|
0x64, 0x65, 0x72, 0x4e, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x6e,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x12, 0x19,
|
0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4e, 0x6f,
|
||||||
0x0a, 0x08, 0x74, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x6e, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||||
0x52, 0x07, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4e, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73,
|
0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61,
|
||||||
0x73, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73,
|
0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14,
|
||||||
0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x05, 0x20, 0x01, 0x28,
|
0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65,
|
||||||
0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61,
|
0x78, 0x74, 0x72, 0x61, 0x22, 0xd4, 0x02, 0x0a, 0x0c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65,
|
||||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0xdd, 0x02,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18,
|
||||||
0x0a, 0x0c, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f,
|
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2f, 0x0a,
|
||||||
0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x07,
|
0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70,
|
||||||
0xfa, 0x42, 0x04, 0x7a, 0x02, 0x10, 0x01, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12,
|
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||||
0x2f, 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
0x74, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x35,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75,
|
0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||||
0x65, 0x73, 0x74, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72,
|
0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71,
|
||||||
0x12, 0x35, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
|
0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x70, 0x72,
|
||||||
0x0b, 0x32, 0x1b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52,
|
0x6f, 0x64, 0x75, 0x63, 0x74, 0x1a, 0x6e, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x19,
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07,
|
0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||||
0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x1a, 0x6e, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72,
|
0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x63, 0x63,
|
||||||
0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01,
|
0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63, 0x63, 0x6f,
|
||||||
0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x61,
|
0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x18,
|
||||||
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x63,
|
0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x12,
|
||||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74,
|
0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05,
|
||||||
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x71, 0x75, 0x61, 0x6e, 0x74, 0x69, 0x74,
|
0x65, 0x78, 0x74, 0x72, 0x61, 0x1a, 0x54, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74,
|
||||||
0x79, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c,
|
0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x6f, 0x18, 0x01,
|
||||||
0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x1a, 0x54, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75,
|
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x6f, 0x12,
|
||||||
0x63, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x6e, 0x6f,
|
0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02, 0x52, 0x05,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e,
|
0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18, 0x03,
|
||||||
0x6f, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x02,
|
0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x36, 0x0a, 0x0d, 0x4f,
|
||||||
0x52, 0x05, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61,
|
0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x06,
|
||||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x36, 0x0a,
|
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70,
|
||||||
0x0d, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25,
|
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73,
|
||||||
0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d,
|
0x75, 0x6c, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71,
|
||||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72,
|
0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01,
|
||||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0xc6, 0x01, 0x0a, 0x0c, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52,
|
0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2f, 0x0a, 0x05,
|
||||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x70, 0x72,
|
||||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x2f,
|
0x6f, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||||
0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e,
|
0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x1a, 0x6d, 0x0a,
|
||||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65,
|
0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f,
|
||||||
0x73, 0x74, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x1a,
|
0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x4e,
|
||||||
0x6d, 0x0a, 0x05, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65,
|
0x6f, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x6e, 0x6f, 0x18, 0x02, 0x20,
|
||||||
0x72, 0x5f, 0x6e, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x64, 0x65,
|
0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4e, 0x6f, 0x12, 0x18, 0x0a, 0x07,
|
||||||
0x72, 0x4e, 0x6f, 0x12, 0x19, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x64, 0x65, 0x5f, 0x6e, 0x6f, 0x18,
|
0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61,
|
||||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74, 0x72, 0x61, 0x64, 0x65, 0x4e, 0x6f, 0x12, 0x18,
|
0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x18,
|
||||||
0x0a, 0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
|
0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x36, 0x0a, 0x0d,
|
||||||
0x07, 0x61, 0x63, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, 0x74, 0x72,
|
0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a,
|
||||||
0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, 0x22, 0x36,
|
0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
|
||||||
0x0a, 0x0d, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65,
|
||||||
0x25, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
0x73, 0x75, 0x6c, 0x74, 0x22, 0x6f, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65,
|
||||||
0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18,
|
||||||
0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0x6f, 0x0a, 0x0d, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79,
|
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x18, 0x0a,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69,
|
0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07,
|
||||||
0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12,
|
0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65,
|
||||||
0x18, 0x0a, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c,
|
0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72,
|
||||||
0x52, 0x07, 0x71, 0x75, 0x65, 0x72, 0x69, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x61,
|
0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52,
|
||||||
0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x68, 0x65, 0x61, 0x64,
|
0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x37, 0x0a, 0x0e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52,
|
||||||
0x65, 0x72, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
|
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c,
|
||||||
0x0c, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x22, 0x37, 0x0a, 0x0e, 0x4e, 0x6f, 0x74, 0x69, 0x66,
|
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||||
0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x73,
|
0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xad,
|
||||||
0x75, 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x01, 0x0a, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x34, 0x0a, 0x05, 0x4f, 0x72, 0x64,
|
||||||
0x6f, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74,
|
0x65, 0x72, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72,
|
||||||
0x32, 0xad, 0x01, 0x0a, 0x06, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x34, 0x0a, 0x05, 0x4f,
|
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
||||||
0x72, 0x64, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4f, 0x72, 0x64,
|
0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12,
|
||||||
0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
0x34, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
0x6f, 0x2e, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e,
|
||||||
0x00, 0x12, 0x34, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x13, 0x2e, 0x70, 0x72, 0x6f,
|
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||||
0x74, 0x6f, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x12,
|
||||||
0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73,
|
0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65,
|
||||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x4e, 0x6f, 0x74, 0x69, 0x66,
|
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f,
|
||||||
0x79, 0x12, 0x14, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79,
|
0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0f,
|
||||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
|
0x5a, 0x0d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||||
0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
0x42, 0x0f, 0x5a, 0x0d, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74,
|
|
||||||
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"net/mail"
|
"net/mail"
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
@ -31,18 +32,53 @@ var (
|
||||||
_ = (*url.URL)(nil)
|
_ = (*url.URL)(nil)
|
||||||
_ = (*mail.Address)(nil)
|
_ = (*mail.Address)(nil)
|
||||||
_ = anypb.Any{}
|
_ = anypb.Any{}
|
||||||
|
_ = sort.Sort
|
||||||
)
|
)
|
||||||
|
|
||||||
// Validate checks the field values on Empty with the rules defined in the
|
// Validate checks the field values on Empty with the rules defined in the
|
||||||
// proto definition for this message. If any rules are violated, an error is returned.
|
// proto definition for this message. If any rules are violated, the first
|
||||||
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *Empty) Validate() error {
|
func (m *Empty) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on Empty with the rules defined in the
|
||||||
|
// proto definition for this message. If any rules are violated, the result is
|
||||||
|
// a list of violation errors wrapped in EmptyMultiError, or nil if none found.
|
||||||
|
func (m *Empty) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Empty) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return EmptyMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EmptyMultiError is an error wrapping multiple validation errors returned by
|
||||||
|
// Empty.ValidateAll() if the designated constraints aren't met.
|
||||||
|
type EmptyMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m EmptyMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m EmptyMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// EmptyValidationError is the validation error returned by Empty.Validate if
|
// EmptyValidationError is the validation error returned by Empty.Validate if
|
||||||
// the designated constraints aren't met.
|
// the designated constraints aren't met.
|
||||||
type EmptyValidationError struct {
|
type EmptyValidationError struct {
|
||||||
|
@ -98,12 +134,26 @@ var _ interface {
|
||||||
} = EmptyValidationError{}
|
} = EmptyValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on Result with the rules defined in the
|
// Validate checks the field values on Result with the rules defined in the
|
||||||
// proto definition for this message. If any rules are violated, an error is returned.
|
// proto definition for this message. If any rules are violated, the first
|
||||||
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *Result) Validate() error {
|
func (m *Result) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on Result with the rules defined in the
|
||||||
|
// proto definition for this message. If any rules are violated, the result is
|
||||||
|
// a list of violation errors wrapped in ResultMultiError, or nil if none found.
|
||||||
|
func (m *Result) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *Result) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
// no validation rules for Status
|
// no validation rules for Status
|
||||||
|
|
||||||
// no validation rules for OrderNo
|
// no validation rules for OrderNo
|
||||||
|
@ -116,9 +166,29 @@ func (m *Result) Validate() error {
|
||||||
|
|
||||||
// no validation rules for Extra
|
// no validation rules for Extra
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return ResultMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ResultMultiError is an error wrapping multiple validation errors returned by
|
||||||
|
// Result.ValidateAll() if the designated constraints aren't met.
|
||||||
|
type ResultMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m ResultMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m ResultMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// ResultValidationError is the validation error returned by Result.Validate if
|
// ResultValidationError is the validation error returned by Result.Validate if
|
||||||
// the designated constraints aren't met.
|
// the designated constraints aren't met.
|
||||||
type ResultValidationError struct {
|
type ResultValidationError struct {
|
||||||
|
@ -174,21 +244,49 @@ var _ interface {
|
||||||
} = ResultValidationError{}
|
} = ResultValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on OrderRequest with the rules defined in
|
// Validate checks the field values on OrderRequest with the rules defined in
|
||||||
// the proto definition for this message. If any rules are violated, an error
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// is returned.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *OrderRequest) Validate() error {
|
func (m *OrderRequest) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on OrderRequest with the rules defined
|
||||||
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
|
// result is a list of violation errors wrapped in OrderRequestMultiError, or
|
||||||
|
// nil if none found.
|
||||||
|
func (m *OrderRequest) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderRequest) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(m.GetConfig()) < 1 {
|
var errors []error
|
||||||
return OrderRequestValidationError{
|
|
||||||
field: "Config",
|
|
||||||
reason: "value length must be at least 1 bytes",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if v, ok := interface{}(m.GetOrder()).(interface{ Validate() error }); ok {
|
// no validation rules for Config
|
||||||
|
|
||||||
|
if all {
|
||||||
|
switch v := interface{}(m.GetOrder()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, OrderRequestValidationError{
|
||||||
|
field: "Order",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, OrderRequestValidationError{
|
||||||
|
field: "Order",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetOrder()).(interface{ Validate() error }); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return OrderRequestValidationError{
|
return OrderRequestValidationError{
|
||||||
field: "Order",
|
field: "Order",
|
||||||
|
@ -198,7 +296,26 @@ func (m *OrderRequest) Validate() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := interface{}(m.GetProduct()).(interface{ Validate() error }); ok {
|
if all {
|
||||||
|
switch v := interface{}(m.GetProduct()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, OrderRequestValidationError{
|
||||||
|
field: "Product",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, OrderRequestValidationError{
|
||||||
|
field: "Product",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetProduct()).(interface{ Validate() error }); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return OrderRequestValidationError{
|
return OrderRequestValidationError{
|
||||||
field: "Product",
|
field: "Product",
|
||||||
|
@ -208,9 +325,29 @@ func (m *OrderRequest) Validate() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return OrderRequestMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OrderRequestMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by OrderRequest.ValidateAll() if the designated constraints aren't met.
|
||||||
|
type OrderRequestMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m OrderRequestMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m OrderRequestMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// OrderRequestValidationError is the validation error returned by
|
// OrderRequestValidationError is the validation error returned by
|
||||||
// OrderRequest.Validate if the designated constraints aren't met.
|
// OrderRequest.Validate if the designated constraints aren't met.
|
||||||
type OrderRequestValidationError struct {
|
type OrderRequestValidationError struct {
|
||||||
|
@ -266,14 +403,47 @@ var _ interface {
|
||||||
} = OrderRequestValidationError{}
|
} = OrderRequestValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on OrderResponse with the rules defined in
|
// Validate checks the field values on OrderResponse with the rules defined in
|
||||||
// the proto definition for this message. If any rules are violated, an error
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// is returned.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *OrderResponse) Validate() error {
|
func (m *OrderResponse) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on OrderResponse with the rules defined
|
||||||
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
|
// result is a list of violation errors wrapped in OrderResponseMultiError, or
|
||||||
|
// nil if none found.
|
||||||
|
func (m *OrderResponse) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderResponse) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok {
|
var errors []error
|
||||||
|
|
||||||
|
if all {
|
||||||
|
switch v := interface{}(m.GetResult()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, OrderResponseValidationError{
|
||||||
|
field: "Result",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, OrderResponseValidationError{
|
||||||
|
field: "Result",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return OrderResponseValidationError{
|
return OrderResponseValidationError{
|
||||||
field: "Result",
|
field: "Result",
|
||||||
|
@ -283,9 +453,30 @@ func (m *OrderResponse) Validate() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return OrderResponseMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OrderResponseMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by OrderResponse.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type OrderResponseMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m OrderResponseMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m OrderResponseMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// OrderResponseValidationError is the validation error returned by
|
// OrderResponseValidationError is the validation error returned by
|
||||||
// OrderResponse.Validate if the designated constraints aren't met.
|
// OrderResponse.Validate if the designated constraints aren't met.
|
||||||
type OrderResponseValidationError struct {
|
type OrderResponseValidationError struct {
|
||||||
|
@ -341,16 +532,49 @@ var _ interface {
|
||||||
} = OrderResponseValidationError{}
|
} = OrderResponseValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on QueryRequest with the rules defined in
|
// Validate checks the field values on QueryRequest with the rules defined in
|
||||||
// the proto definition for this message. If any rules are violated, an error
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// is returned.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *QueryRequest) Validate() error {
|
func (m *QueryRequest) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on QueryRequest with the rules defined
|
||||||
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
|
// result is a list of violation errors wrapped in QueryRequestMultiError, or
|
||||||
|
// nil if none found.
|
||||||
|
func (m *QueryRequest) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryRequest) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
// no validation rules for Config
|
// no validation rules for Config
|
||||||
|
|
||||||
if v, ok := interface{}(m.GetOrder()).(interface{ Validate() error }); ok {
|
if all {
|
||||||
|
switch v := interface{}(m.GetOrder()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, QueryRequestValidationError{
|
||||||
|
field: "Order",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, QueryRequestValidationError{
|
||||||
|
field: "Order",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetOrder()).(interface{ Validate() error }); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return QueryRequestValidationError{
|
return QueryRequestValidationError{
|
||||||
field: "Order",
|
field: "Order",
|
||||||
|
@ -360,9 +584,29 @@ func (m *QueryRequest) Validate() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return QueryRequestMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryRequestMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by QueryRequest.ValidateAll() if the designated constraints aren't met.
|
||||||
|
type QueryRequestMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m QueryRequestMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m QueryRequestMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// QueryRequestValidationError is the validation error returned by
|
// QueryRequestValidationError is the validation error returned by
|
||||||
// QueryRequest.Validate if the designated constraints aren't met.
|
// QueryRequest.Validate if the designated constraints aren't met.
|
||||||
type QueryRequestValidationError struct {
|
type QueryRequestValidationError struct {
|
||||||
|
@ -418,14 +662,47 @@ var _ interface {
|
||||||
} = QueryRequestValidationError{}
|
} = QueryRequestValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on QueryResponse with the rules defined in
|
// Validate checks the field values on QueryResponse with the rules defined in
|
||||||
// the proto definition for this message. If any rules are violated, an error
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// is returned.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *QueryResponse) Validate() error {
|
func (m *QueryResponse) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on QueryResponse with the rules defined
|
||||||
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
|
// result is a list of violation errors wrapped in QueryResponseMultiError, or
|
||||||
|
// nil if none found.
|
||||||
|
func (m *QueryResponse) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryResponse) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok {
|
var errors []error
|
||||||
|
|
||||||
|
if all {
|
||||||
|
switch v := interface{}(m.GetResult()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, QueryResponseValidationError{
|
||||||
|
field: "Result",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, QueryResponseValidationError{
|
||||||
|
field: "Result",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return QueryResponseValidationError{
|
return QueryResponseValidationError{
|
||||||
field: "Result",
|
field: "Result",
|
||||||
|
@ -435,9 +712,30 @@ func (m *QueryResponse) Validate() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return QueryResponseMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryResponseMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by QueryResponse.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type QueryResponseMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m QueryResponseMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m QueryResponseMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// QueryResponseValidationError is the validation error returned by
|
// QueryResponseValidationError is the validation error returned by
|
||||||
// QueryResponse.Validate if the designated constraints aren't met.
|
// QueryResponse.Validate if the designated constraints aren't met.
|
||||||
type QueryResponseValidationError struct {
|
type QueryResponseValidationError struct {
|
||||||
|
@ -493,13 +791,27 @@ var _ interface {
|
||||||
} = QueryResponseValidationError{}
|
} = QueryResponseValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on NotifyRequest with the rules defined in
|
// Validate checks the field values on NotifyRequest with the rules defined in
|
||||||
// the proto definition for this message. If any rules are violated, an error
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// is returned.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *NotifyRequest) Validate() error {
|
func (m *NotifyRequest) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on NotifyRequest with the rules defined
|
||||||
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
|
// result is a list of violation errors wrapped in NotifyRequestMultiError, or
|
||||||
|
// nil if none found.
|
||||||
|
func (m *NotifyRequest) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *NotifyRequest) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
// no validation rules for Config
|
// no validation rules for Config
|
||||||
|
|
||||||
// no validation rules for Queries
|
// no validation rules for Queries
|
||||||
|
@ -508,9 +820,30 @@ func (m *NotifyRequest) Validate() error {
|
||||||
|
|
||||||
// no validation rules for Body
|
// no validation rules for Body
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return NotifyRequestMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotifyRequestMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by NotifyRequest.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type NotifyRequestMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m NotifyRequestMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m NotifyRequestMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// NotifyRequestValidationError is the validation error returned by
|
// NotifyRequestValidationError is the validation error returned by
|
||||||
// NotifyRequest.Validate if the designated constraints aren't met.
|
// NotifyRequest.Validate if the designated constraints aren't met.
|
||||||
type NotifyRequestValidationError struct {
|
type NotifyRequestValidationError struct {
|
||||||
|
@ -566,14 +899,47 @@ var _ interface {
|
||||||
} = NotifyRequestValidationError{}
|
} = NotifyRequestValidationError{}
|
||||||
|
|
||||||
// Validate checks the field values on NotifyResponse with the rules defined in
|
// Validate checks the field values on NotifyResponse with the rules defined in
|
||||||
// the proto definition for this message. If any rules are violated, an error
|
// the proto definition for this message. If any rules are violated, the first
|
||||||
// is returned.
|
// error encountered is returned, or nil if there are no violations.
|
||||||
func (m *NotifyResponse) Validate() error {
|
func (m *NotifyResponse) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on NotifyResponse with the rules defined
|
||||||
|
// in the proto definition for this message. If any rules are violated, the
|
||||||
|
// result is a list of violation errors wrapped in NotifyResponseMultiError,
|
||||||
|
// or nil if none found.
|
||||||
|
func (m *NotifyResponse) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *NotifyResponse) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok {
|
var errors []error
|
||||||
|
|
||||||
|
if all {
|
||||||
|
switch v := interface{}(m.GetResult()).(type) {
|
||||||
|
case interface{ ValidateAll() error }:
|
||||||
|
if err := v.ValidateAll(); err != nil {
|
||||||
|
errors = append(errors, NotifyResponseValidationError{
|
||||||
|
field: "Result",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
case interface{ Validate() error }:
|
||||||
|
if err := v.Validate(); err != nil {
|
||||||
|
errors = append(errors, NotifyResponseValidationError{
|
||||||
|
field: "Result",
|
||||||
|
reason: "embedded message failed validation",
|
||||||
|
cause: err,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if v, ok := interface{}(m.GetResult()).(interface{ Validate() error }); ok {
|
||||||
if err := v.Validate(); err != nil {
|
if err := v.Validate(); err != nil {
|
||||||
return NotifyResponseValidationError{
|
return NotifyResponseValidationError{
|
||||||
field: "Result",
|
field: "Result",
|
||||||
|
@ -583,9 +949,30 @@ func (m *NotifyResponse) Validate() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return NotifyResponseMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotifyResponseMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by NotifyResponse.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type NotifyResponseMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m NotifyResponseMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m NotifyResponseMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// NotifyResponseValidationError is the validation error returned by
|
// NotifyResponseValidationError is the validation error returned by
|
||||||
// NotifyResponse.Validate if the designated constraints aren't met.
|
// NotifyResponse.Validate if the designated constraints aren't met.
|
||||||
type NotifyResponseValidationError struct {
|
type NotifyResponseValidationError struct {
|
||||||
|
@ -642,12 +1029,26 @@ var _ interface {
|
||||||
|
|
||||||
// Validate checks the field values on OrderRequest_Order with the rules
|
// Validate checks the field values on OrderRequest_Order with the rules
|
||||||
// defined in the proto definition for this message. If any rules are
|
// defined in the proto definition for this message. If any rules are
|
||||||
// violated, an error is returned.
|
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||||
func (m *OrderRequest_Order) Validate() error {
|
func (m *OrderRequest_Order) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on OrderRequest_Order with the rules
|
||||||
|
// defined in the proto definition for this message. If any rules are
|
||||||
|
// violated, the result is a list of violation errors wrapped in
|
||||||
|
// OrderRequest_OrderMultiError, or nil if none found.
|
||||||
|
func (m *OrderRequest_Order) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderRequest_Order) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
// no validation rules for OrderNo
|
// no validation rules for OrderNo
|
||||||
|
|
||||||
// no validation rules for Account
|
// no validation rules for Account
|
||||||
|
@ -656,9 +1057,30 @@ func (m *OrderRequest_Order) Validate() error {
|
||||||
|
|
||||||
// no validation rules for Extra
|
// no validation rules for Extra
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return OrderRequest_OrderMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OrderRequest_OrderMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by OrderRequest_Order.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type OrderRequest_OrderMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m OrderRequest_OrderMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m OrderRequest_OrderMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// OrderRequest_OrderValidationError is the validation error returned by
|
// OrderRequest_OrderValidationError is the validation error returned by
|
||||||
// OrderRequest_Order.Validate if the designated constraints aren't met.
|
// OrderRequest_Order.Validate if the designated constraints aren't met.
|
||||||
type OrderRequest_OrderValidationError struct {
|
type OrderRequest_OrderValidationError struct {
|
||||||
|
@ -717,21 +1139,56 @@ var _ interface {
|
||||||
|
|
||||||
// Validate checks the field values on OrderRequest_Product with the rules
|
// Validate checks the field values on OrderRequest_Product with the rules
|
||||||
// defined in the proto definition for this message. If any rules are
|
// defined in the proto definition for this message. If any rules are
|
||||||
// violated, an error is returned.
|
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||||
func (m *OrderRequest_Product) Validate() error {
|
func (m *OrderRequest_Product) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on OrderRequest_Product with the rules
|
||||||
|
// defined in the proto definition for this message. If any rules are
|
||||||
|
// violated, the result is a list of violation errors wrapped in
|
||||||
|
// OrderRequest_ProductMultiError, or nil if none found.
|
||||||
|
func (m *OrderRequest_Product) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *OrderRequest_Product) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
// no validation rules for ProductNo
|
// no validation rules for ProductNo
|
||||||
|
|
||||||
// no validation rules for Price
|
// no validation rules for Price
|
||||||
|
|
||||||
// no validation rules for Extra
|
// no validation rules for Extra
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return OrderRequest_ProductMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OrderRequest_ProductMultiError is an error wrapping multiple validation
|
||||||
|
// errors returned by OrderRequest_Product.ValidateAll() if the designated
|
||||||
|
// constraints aren't met.
|
||||||
|
type OrderRequest_ProductMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m OrderRequest_ProductMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m OrderRequest_ProductMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// OrderRequest_ProductValidationError is the validation error returned by
|
// OrderRequest_ProductValidationError is the validation error returned by
|
||||||
// OrderRequest_Product.Validate if the designated constraints aren't met.
|
// OrderRequest_Product.Validate if the designated constraints aren't met.
|
||||||
type OrderRequest_ProductValidationError struct {
|
type OrderRequest_ProductValidationError struct {
|
||||||
|
@ -790,12 +1247,26 @@ var _ interface {
|
||||||
|
|
||||||
// Validate checks the field values on QueryRequest_Order with the rules
|
// Validate checks the field values on QueryRequest_Order with the rules
|
||||||
// defined in the proto definition for this message. If any rules are
|
// defined in the proto definition for this message. If any rules are
|
||||||
// violated, an error is returned.
|
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||||
func (m *QueryRequest_Order) Validate() error {
|
func (m *QueryRequest_Order) Validate() error {
|
||||||
|
return m.validate(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
// ValidateAll checks the field values on QueryRequest_Order with the rules
|
||||||
|
// defined in the proto definition for this message. If any rules are
|
||||||
|
// violated, the result is a list of violation errors wrapped in
|
||||||
|
// QueryRequest_OrderMultiError, or nil if none found.
|
||||||
|
func (m *QueryRequest_Order) ValidateAll() error {
|
||||||
|
return m.validate(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (m *QueryRequest_Order) validate(all bool) error {
|
||||||
if m == nil {
|
if m == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var errors []error
|
||||||
|
|
||||||
// no validation rules for OrderNo
|
// no validation rules for OrderNo
|
||||||
|
|
||||||
// no validation rules for TradeNo
|
// no validation rules for TradeNo
|
||||||
|
@ -804,9 +1275,30 @@ func (m *QueryRequest_Order) Validate() error {
|
||||||
|
|
||||||
// no validation rules for Extra
|
// no validation rules for Extra
|
||||||
|
|
||||||
|
if len(errors) > 0 {
|
||||||
|
return QueryRequest_OrderMultiError(errors)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QueryRequest_OrderMultiError is an error wrapping multiple validation errors
|
||||||
|
// returned by QueryRequest_Order.ValidateAll() if the designated constraints
|
||||||
|
// aren't met.
|
||||||
|
type QueryRequest_OrderMultiError []error
|
||||||
|
|
||||||
|
// Error returns a concatenation of all the error messages it wraps.
|
||||||
|
func (m QueryRequest_OrderMultiError) Error() string {
|
||||||
|
var msgs []string
|
||||||
|
for _, err := range m {
|
||||||
|
msgs = append(msgs, err.Error())
|
||||||
|
}
|
||||||
|
return strings.Join(msgs, "; ")
|
||||||
|
}
|
||||||
|
|
||||||
|
// AllErrors returns a list of validation violation errors.
|
||||||
|
func (m QueryRequest_OrderMultiError) AllErrors() []error { return m }
|
||||||
|
|
||||||
// QueryRequest_OrderValidationError is the validation error returned by
|
// QueryRequest_OrderValidationError is the validation error returned by
|
||||||
// QueryRequest_Order.Validate if the designated constraints aren't met.
|
// QueryRequest_Order.Validate if the designated constraints aren't met.
|
||||||
type QueryRequest_OrderValidationError struct {
|
type QueryRequest_OrderValidationError struct {
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
option go_package = "plugins/proto";
|
option go_package = "plugins/proto";
|
||||||
|
|
||||||
import "validate/validate.proto";
|
|
||||||
import "proto/status.proto";
|
import "proto/status.proto";
|
||||||
|
|
||||||
package proto;
|
package proto;
|
||||||
|
@ -24,7 +23,7 @@ message Result {
|
||||||
}
|
}
|
||||||
|
|
||||||
message OrderRequest{
|
message OrderRequest{
|
||||||
bytes config = 1 [(validate.rules).bytes = {min_len: 1}];
|
bytes config = 1;
|
||||||
message Order {
|
message Order {
|
||||||
string order_no = 1;
|
string order_no = 1;
|
||||||
string account = 2;
|
string account = 2;
|
||||||
|
|
|
@ -11,6 +11,7 @@ import (
|
||||||
"net/mail"
|
"net/mail"
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode/utf8"
|
"unicode/utf8"
|
||||||
|
@ -31,4 +32,5 @@ var (
|
||||||
_ = (*url.URL)(nil)
|
_ = (*url.URL)(nil)
|
||||||
_ = (*mail.Address)(nil)
|
_ = (*mail.Address)(nil)
|
||||||
_ = anypb.Any{}
|
_ = anypb.Any{}
|
||||||
|
_ = sort.Sort
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue