Compare commits
17 Commits
api/v0.0.2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c2726db8a1 | |||
|
|
47c72651db | ||
|
|
f267c19c73 | ||
|
|
8c017a34e0 | ||
|
|
ac6f0d1987 | ||
|
|
29a8782662 | ||
|
|
d0e55cf372 | ||
|
|
45d364280b | ||
|
|
fcd2a5ee43 | ||
|
|
989f5da01f | ||
|
|
d31ab9cdf3 | ||
|
|
735ca567bf | ||
|
|
2aeb7b823e | ||
|
|
569df2b7bd | ||
|
|
b7f9fa5807 | ||
|
|
bda9c5e6bb | ||
|
|
c88687b033 |
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_authn.proto
|
||||
|
||||
@@ -24,8 +24,11 @@ const (
|
||||
|
||||
// 认证
|
||||
type Authentication struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Jwt *Authentication_Jwt `protobuf:"bytes,1,opt,name=jwt,proto3,oneof" json:"jwt,omitempty"`
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Jwt *Authentication_Jwt `protobuf:"bytes,2,opt,name=jwt,proto3,oneof" json:"jwt,omitempty"` // JWT 认证
|
||||
Oidc *Authentication_OIDC `protobuf:"bytes,3,opt,name=oidc,proto3,oneof" json:"oidc,omitempty"` // OIDC
|
||||
PresharedKey *Authentication_PresharedKey `protobuf:"bytes,4,opt,name=preshared_key,json=presharedKey,proto3,oneof" json:"preshared_key,omitempty"` // 预共享密钥
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -60,6 +63,13 @@ func (*Authentication) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authn_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Authentication) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authentication) GetJwt() *Authentication_Jwt {
|
||||
if x != nil {
|
||||
return x.Jwt
|
||||
@@ -67,6 +77,20 @@ func (x *Authentication) GetJwt() *Authentication_Jwt {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Authentication) GetOidc() *Authentication_OIDC {
|
||||
if x != nil {
|
||||
return x.Oidc
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Authentication) GetPresharedKey() *Authentication_PresharedKey {
|
||||
if x != nil {
|
||||
return x.PresharedKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// JWT
|
||||
type Authentication_Jwt struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
@@ -120,32 +144,135 @@ func (x *Authentication_Jwt) GetKey() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
type Authentication_OIDC struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
IssuerUrl string `protobuf:"bytes,1,opt,name=issuer_url,json=issuerUrl,proto3" json:"issuer_url,omitempty"`
|
||||
Audience string `protobuf:"bytes,2,opt,name=audience,proto3" json:"audience,omitempty"`
|
||||
Method string `protobuf:"bytes,3,opt,name=method,proto3" json:"method,omitempty"` // JWT签名的算法,支持算法:HS256
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authentication_OIDC) Reset() {
|
||||
*x = Authentication_OIDC{}
|
||||
mi := &file_conf_v1_kratos_conf_authn_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authentication_OIDC) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authentication_OIDC) ProtoMessage() {}
|
||||
|
||||
func (x *Authentication_OIDC) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authn_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authentication_OIDC.ProtoReflect.Descriptor instead.
|
||||
func (*Authentication_OIDC) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authn_proto_rawDescGZIP(), []int{0, 1}
|
||||
}
|
||||
|
||||
func (x *Authentication_OIDC) GetIssuerUrl() string {
|
||||
if x != nil {
|
||||
return x.IssuerUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authentication_OIDC) GetAudience() string {
|
||||
if x != nil {
|
||||
return x.Audience
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authentication_OIDC) GetMethod() string {
|
||||
if x != nil {
|
||||
return x.Method
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Authentication_PresharedKey struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ValidKeys []string `protobuf:"bytes,1,rep,name=valid_keys,json=validKeys,proto3" json:"valid_keys,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authentication_PresharedKey) Reset() {
|
||||
*x = Authentication_PresharedKey{}
|
||||
mi := &file_conf_v1_kratos_conf_authn_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authentication_PresharedKey) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authentication_PresharedKey) ProtoMessage() {}
|
||||
|
||||
func (x *Authentication_PresharedKey) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authn_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authentication_PresharedKey.ProtoReflect.Descriptor instead.
|
||||
func (*Authentication_PresharedKey) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authn_proto_rawDescGZIP(), []int{0, 2}
|
||||
}
|
||||
|
||||
func (x *Authentication_PresharedKey) GetValidKeys() []string {
|
||||
if x != nil {
|
||||
return x.ValidKeys
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_conf_v1_kratos_conf_authn_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_authn_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x1f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7a, 0x0a, 0x0e, 0x41, 0x75, 0x74, 0x68, 0x65,
|
||||
0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2f, 0x0a, 0x03, 0x6a, 0x77, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75,
|
||||
0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x4a, 0x77, 0x74,
|
||||
0x48, 0x00, 0x52, 0x03, 0x6a, 0x77, 0x74, 0x88, 0x01, 0x01, 0x1a, 0x2f, 0x0a, 0x03, 0x4a, 0x77,
|
||||
0x74, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x42, 0x06, 0x0a, 0x04, 0x5f,
|
||||
0x6a, 0x77, 0x74, 0x42, 0x86, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x42, 0x14, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x41, 0x75, 0x74, 0x68,
|
||||
0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f,
|
||||
0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f,
|
||||
0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02,
|
||||
0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f,
|
||||
0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
|
||||
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_authn_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1fconf/v1/kratos_conf_authn.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\"\xb4\x03\n" +
|
||||
"\x0eAuthentication\x12\x12\n" +
|
||||
"\x04type\x18\x01 \x01(\tR\x04type\x12/\n" +
|
||||
"\x03jwt\x18\x02 \x01(\v2\x18.conf.Authentication.JwtH\x00R\x03jwt\x88\x01\x01\x122\n" +
|
||||
"\x04oidc\x18\x03 \x01(\v2\x19.conf.Authentication.OIDCH\x01R\x04oidc\x88\x01\x01\x12K\n" +
|
||||
"\rpreshared_key\x18\x04 \x01(\v2!.conf.Authentication.PresharedKeyH\x02R\fpresharedKey\x88\x01\x01\x1a/\n" +
|
||||
"\x03Jwt\x12\x16\n" +
|
||||
"\x06method\x18\x01 \x01(\tR\x06method\x12\x10\n" +
|
||||
"\x03key\x18\x02 \x01(\tR\x03key\x1aY\n" +
|
||||
"\x04OIDC\x12\x1d\n" +
|
||||
"\n" +
|
||||
"issuer_url\x18\x01 \x01(\tR\tissuerUrl\x12\x1a\n" +
|
||||
"\baudience\x18\x02 \x01(\tR\baudience\x12\x16\n" +
|
||||
"\x06method\x18\x03 \x01(\tR\x06method\x1a-\n" +
|
||||
"\fPresharedKey\x12\x1d\n" +
|
||||
"\n" +
|
||||
"valid_keys\x18\x01 \x03(\tR\tvalidKeysB\x06\n" +
|
||||
"\x04_jwtB\a\n" +
|
||||
"\x05_oidcB\x10\n" +
|
||||
"\x0e_preshared_keyB\x86\x01\n" +
|
||||
"\bcom.confB\x14KratosConfAuthnProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_authn_proto_rawDescOnce sync.Once
|
||||
@@ -159,18 +286,22 @@ func file_conf_v1_kratos_conf_authn_proto_rawDescGZIP() []byte {
|
||||
return file_conf_v1_kratos_conf_authn_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_conf_v1_kratos_conf_authn_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_conf_v1_kratos_conf_authn_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_conf_v1_kratos_conf_authn_proto_goTypes = []any{
|
||||
(*Authentication)(nil), // 0: conf.Authentication
|
||||
(*Authentication_Jwt)(nil), // 1: conf.Authentication.Jwt
|
||||
(*Authentication)(nil), // 0: conf.Authentication
|
||||
(*Authentication_Jwt)(nil), // 1: conf.Authentication.Jwt
|
||||
(*Authentication_OIDC)(nil), // 2: conf.Authentication.OIDC
|
||||
(*Authentication_PresharedKey)(nil), // 3: conf.Authentication.PresharedKey
|
||||
}
|
||||
var file_conf_v1_kratos_conf_authn_proto_depIdxs = []int32{
|
||||
1, // 0: conf.Authentication.jwt:type_name -> conf.Authentication.Jwt
|
||||
1, // [1:1] is the sub-list for method output_type
|
||||
1, // [1:1] is the sub-list for method input_type
|
||||
1, // [1:1] is the sub-list for extension type_name
|
||||
1, // [1:1] is the sub-list for extension extendee
|
||||
0, // [0:1] is the sub-list for field type_name
|
||||
2, // 1: conf.Authentication.oidc:type_name -> conf.Authentication.OIDC
|
||||
3, // 2: conf.Authentication.preshared_key:type_name -> conf.Authentication.PresharedKey
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_conf_v1_kratos_conf_authn_proto_init() }
|
||||
@@ -185,7 +316,7 @@ func file_conf_v1_kratos_conf_authn_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_conf_v1_kratos_conf_authn_proto_rawDesc), len(file_conf_v1_kratos_conf_authn_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_authz.proto
|
||||
|
||||
@@ -24,7 +24,11 @@ const (
|
||||
|
||||
// 授权
|
||||
type Authorization struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"`
|
||||
Casbin *Authorization_Casbin `protobuf:"bytes,2,opt,name=casbin,proto3" json:"casbin,omitempty"` // casbin
|
||||
Opa *Authorization_OPA `protobuf:"bytes,3,opt,name=opa,proto3" json:"opa,omitempty"` // OPA
|
||||
Zanzibar *Authorization_Zanzibar `protobuf:"bytes,4,opt,name=zanzibar,proto3" json:"zanzibar,omitempty"` // zanzibar
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -59,25 +63,435 @@ func (*Authorization) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *Authorization) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization) GetCasbin() *Authorization_Casbin {
|
||||
if x != nil {
|
||||
return x.Casbin
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Authorization) GetOpa() *Authorization_OPA {
|
||||
if x != nil {
|
||||
return x.Opa
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Authorization) GetZanzibar() *Authorization_Zanzibar {
|
||||
if x != nil {
|
||||
return x.Zanzibar
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Authorization_Casbin struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ModelPath *string `protobuf:"bytes,1,opt,name=model_path,json=modelPath,proto3,oneof" json:"model_path,omitempty"` // casbin 模型文件路径
|
||||
PolicyPath *string `protobuf:"bytes,2,opt,name=policy_path,json=policyPath,proto3,oneof" json:"policy_path,omitempty"` // casbin 策略文件路径
|
||||
Policies []string `protobuf:"bytes,10,rep,name=policies,proto3" json:"policies,omitempty"` // 策略列表
|
||||
Model *string `protobuf:"bytes,11,opt,name=model,proto3,oneof" json:"model,omitempty"` // 模型内容
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authorization_Casbin) Reset() {
|
||||
*x = Authorization_Casbin{}
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authorization_Casbin) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authorization_Casbin) ProtoMessage() {}
|
||||
|
||||
func (x *Authorization_Casbin) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authorization_Casbin.ProtoReflect.Descriptor instead.
|
||||
func (*Authorization_Casbin) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 0}
|
||||
}
|
||||
|
||||
func (x *Authorization_Casbin) GetModelPath() string {
|
||||
if x != nil && x.ModelPath != nil {
|
||||
return *x.ModelPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Casbin) GetPolicyPath() string {
|
||||
if x != nil && x.PolicyPath != nil {
|
||||
return *x.PolicyPath
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Casbin) GetPolicies() []string {
|
||||
if x != nil {
|
||||
return x.Policies
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Authorization_Casbin) GetModel() string {
|
||||
if x != nil && x.Model != nil {
|
||||
return *x.Model
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type Authorization_OPA struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Policies map[string]string `protobuf:"bytes,1,rep,name=policies,proto3" json:"policies,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` // OPA 策略列表
|
||||
Roles map[string]*Authorization_OPA_RoleActions `protobuf:"bytes,2,rep,name=roles,proto3" json:"roles,omitempty" protobuf_key:"bytes,1,opt,name=key" protobuf_val:"bytes,2,opt,name=value"` //
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authorization_OPA) Reset() {
|
||||
*x = Authorization_OPA{}
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authorization_OPA) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authorization_OPA) ProtoMessage() {}
|
||||
|
||||
func (x *Authorization_OPA) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authorization_OPA.ProtoReflect.Descriptor instead.
|
||||
func (*Authorization_OPA) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 1}
|
||||
}
|
||||
|
||||
func (x *Authorization_OPA) GetPolicies() map[string]string {
|
||||
if x != nil {
|
||||
return x.Policies
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Authorization_OPA) GetRoles() map[string]*Authorization_OPA_RoleActions {
|
||||
if x != nil {
|
||||
return x.Roles
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Authorization_Zanzibar struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // zanzibar 类型
|
||||
Keto *Authorization_Zanzibar_Keto `protobuf:"bytes,2,opt,name=keto,proto3,oneof" json:"keto,omitempty"` // Keto 配置
|
||||
OpenFga *Authorization_Zanzibar_OpenFga `protobuf:"bytes,3,opt,name=open_fga,json=openFga,proto3,oneof" json:"open_fga,omitempty"` // OpenFGA 配置
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar) Reset() {
|
||||
*x = Authorization_Zanzibar{}
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authorization_Zanzibar) ProtoMessage() {}
|
||||
|
||||
func (x *Authorization_Zanzibar) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authorization_Zanzibar.ProtoReflect.Descriptor instead.
|
||||
func (*Authorization_Zanzibar) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 2}
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar) GetType() string {
|
||||
if x != nil {
|
||||
return x.Type
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar) GetKeto() *Authorization_Zanzibar_Keto {
|
||||
if x != nil {
|
||||
return x.Keto
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar) GetOpenFga() *Authorization_Zanzibar_OpenFga {
|
||||
if x != nil {
|
||||
return x.OpenFga
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Authorization_OPA_RoleActions struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Actions []string `protobuf:"bytes,1,rep,name=actions,proto3" json:"actions,omitempty"` // 角色对应的操作列表 {
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authorization_OPA_RoleActions) Reset() {
|
||||
*x = Authorization_OPA_RoleActions{}
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authorization_OPA_RoleActions) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authorization_OPA_RoleActions) ProtoMessage() {}
|
||||
|
||||
func (x *Authorization_OPA_RoleActions) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authorization_OPA_RoleActions.ProtoReflect.Descriptor instead.
|
||||
func (*Authorization_OPA_RoleActions) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 1, 0}
|
||||
}
|
||||
|
||||
func (x *Authorization_OPA_RoleActions) GetActions() []string {
|
||||
if x != nil {
|
||||
return x.Actions
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Authorization_Zanzibar_Keto struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
WriteUrl string `protobuf:"bytes,1,opt,name=write_url,json=writeUrl,proto3" json:"write_url,omitempty"` // 写入 URL
|
||||
ReadUrl string `protobuf:"bytes,2,opt,name=read_url,json=readUrl,proto3" json:"read_url,omitempty"` // 读取 URL
|
||||
UseGrpc bool `protobuf:"varint,3,opt,name=use_grpc,json=useGrpc,proto3" json:"use_grpc,omitempty"` // 是否使用 gRPC
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_Keto) Reset() {
|
||||
*x = Authorization_Zanzibar_Keto{}
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_Keto) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authorization_Zanzibar_Keto) ProtoMessage() {}
|
||||
|
||||
func (x *Authorization_Zanzibar_Keto) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authorization_Zanzibar_Keto.ProtoReflect.Descriptor instead.
|
||||
func (*Authorization_Zanzibar_Keto) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 2, 0}
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_Keto) GetWriteUrl() string {
|
||||
if x != nil {
|
||||
return x.WriteUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_Keto) GetReadUrl() string {
|
||||
if x != nil {
|
||||
return x.ReadUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_Keto) GetUseGrpc() bool {
|
||||
if x != nil {
|
||||
return x.UseGrpc
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type Authorization_Zanzibar_OpenFga struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ApiUrl string `protobuf:"bytes,1,opt,name=api_url,json=apiUrl,proto3" json:"api_url,omitempty"` // OpenFGA API URL
|
||||
StoreId string `protobuf:"bytes,2,opt,name=store_id,json=storeId,proto3" json:"store_id,omitempty"` // OpenFGA 存储 ID
|
||||
Token string `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"` // OpenFGA 访问令牌
|
||||
ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id,omitempty"` // OpenFGA 客户端 ID
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_OpenFga) Reset() {
|
||||
*x = Authorization_Zanzibar_OpenFga{}
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_OpenFga) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*Authorization_Zanzibar_OpenFga) ProtoMessage() {}
|
||||
|
||||
func (x *Authorization_Zanzibar_OpenFga) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_conf_v1_kratos_conf_authz_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use Authorization_Zanzibar_OpenFga.ProtoReflect.Descriptor instead.
|
||||
func (*Authorization_Zanzibar_OpenFga) Descriptor() ([]byte, []int) {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescGZIP(), []int{0, 2, 1}
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_OpenFga) GetApiUrl() string {
|
||||
if x != nil {
|
||||
return x.ApiUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_OpenFga) GetStoreId() string {
|
||||
if x != nil {
|
||||
return x.StoreId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_OpenFga) GetToken() string {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *Authorization_Zanzibar_OpenFga) GetClientId() string {
|
||||
if x != nil {
|
||||
return x.ClientId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_conf_v1_kratos_conf_authz_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_authz_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x1f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x0f, 0x0a, 0x0d, 0x41, 0x75, 0x74, 0x68, 0x6f,
|
||||
0x72, 0x69, 0x7a, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x86, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x14, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0x41, 0x75, 0x74, 0x68, 0x7a, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67,
|
||||
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f,
|
||||
0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70,
|
||||
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47,
|
||||
0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_authz_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1fconf/v1/kratos_conf_authz.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\"\xc1\b\n" +
|
||||
"\rAuthorization\x12\x12\n" +
|
||||
"\x04type\x18\x01 \x01(\tR\x04type\x122\n" +
|
||||
"\x06casbin\x18\x02 \x01(\v2\x1a.conf.Authorization.CasbinR\x06casbin\x12)\n" +
|
||||
"\x03opa\x18\x03 \x01(\v2\x17.conf.Authorization.OPAR\x03opa\x128\n" +
|
||||
"\bzanzibar\x18\x04 \x01(\v2\x1c.conf.Authorization.ZanzibarR\bzanzibar\x1a\xb2\x01\n" +
|
||||
"\x06Casbin\x12\"\n" +
|
||||
"\n" +
|
||||
"model_path\x18\x01 \x01(\tH\x00R\tmodelPath\x88\x01\x01\x12$\n" +
|
||||
"\vpolicy_path\x18\x02 \x01(\tH\x01R\n" +
|
||||
"policyPath\x88\x01\x01\x12\x1a\n" +
|
||||
"\bpolicies\x18\n" +
|
||||
" \x03(\tR\bpolicies\x12\x19\n" +
|
||||
"\x05model\x18\v \x01(\tH\x02R\x05model\x88\x01\x01B\r\n" +
|
||||
"\v_model_pathB\x0e\n" +
|
||||
"\f_policy_pathB\b\n" +
|
||||
"\x06_model\x1a\xc7\x02\n" +
|
||||
"\x03OPA\x12A\n" +
|
||||
"\bpolicies\x18\x01 \x03(\v2%.conf.Authorization.OPA.PoliciesEntryR\bpolicies\x128\n" +
|
||||
"\x05roles\x18\x02 \x03(\v2\".conf.Authorization.OPA.RolesEntryR\x05roles\x1a'\n" +
|
||||
"\vRoleActions\x12\x18\n" +
|
||||
"\aactions\x18\x01 \x03(\tR\aactions\x1a;\n" +
|
||||
"\rPoliciesEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a]\n" +
|
||||
"\n" +
|
||||
"RolesEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x129\n" +
|
||||
"\x05value\x18\x02 \x01(\v2#.conf.Authorization.OPA.RoleActionsR\x05value:\x028\x01\x1a\x83\x03\n" +
|
||||
"\bZanzibar\x12\x12\n" +
|
||||
"\x04type\x18\x01 \x01(\tR\x04type\x12:\n" +
|
||||
"\x04keto\x18\x02 \x01(\v2!.conf.Authorization.Zanzibar.KetoH\x00R\x04keto\x88\x01\x01\x12D\n" +
|
||||
"\bopen_fga\x18\x03 \x01(\v2$.conf.Authorization.Zanzibar.OpenFgaH\x01R\aopenFga\x88\x01\x01\x1aY\n" +
|
||||
"\x04Keto\x12\x1b\n" +
|
||||
"\twrite_url\x18\x01 \x01(\tR\bwriteUrl\x12\x19\n" +
|
||||
"\bread_url\x18\x02 \x01(\tR\areadUrl\x12\x19\n" +
|
||||
"\buse_grpc\x18\x03 \x01(\bR\auseGrpc\x1ap\n" +
|
||||
"\aOpenFga\x12\x17\n" +
|
||||
"\aapi_url\x18\x01 \x01(\tR\x06apiUrl\x12\x19\n" +
|
||||
"\bstore_id\x18\x02 \x01(\tR\astoreId\x12\x14\n" +
|
||||
"\x05token\x18\x03 \x01(\tR\x05token\x12\x1b\n" +
|
||||
"\tclient_id\x18\x04 \x01(\tR\bclientIdB\a\n" +
|
||||
"\x05_ketoB\v\n" +
|
||||
"\t_open_fgaB\x86\x01\n" +
|
||||
"\bcom.confB\x14KratosConfAuthzProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_authz_proto_rawDescOnce sync.Once
|
||||
@@ -91,16 +505,32 @@ func file_conf_v1_kratos_conf_authz_proto_rawDescGZIP() []byte {
|
||||
return file_conf_v1_kratos_conf_authz_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_conf_v1_kratos_conf_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||
var file_conf_v1_kratos_conf_authz_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
|
||||
var file_conf_v1_kratos_conf_authz_proto_goTypes = []any{
|
||||
(*Authorization)(nil), // 0: conf.Authorization
|
||||
(*Authorization)(nil), // 0: conf.Authorization
|
||||
(*Authorization_Casbin)(nil), // 1: conf.Authorization.Casbin
|
||||
(*Authorization_OPA)(nil), // 2: conf.Authorization.OPA
|
||||
(*Authorization_Zanzibar)(nil), // 3: conf.Authorization.Zanzibar
|
||||
(*Authorization_OPA_RoleActions)(nil), // 4: conf.Authorization.OPA.RoleActions
|
||||
nil, // 5: conf.Authorization.OPA.PoliciesEntry
|
||||
nil, // 6: conf.Authorization.OPA.RolesEntry
|
||||
(*Authorization_Zanzibar_Keto)(nil), // 7: conf.Authorization.Zanzibar.Keto
|
||||
(*Authorization_Zanzibar_OpenFga)(nil), // 8: conf.Authorization.Zanzibar.OpenFga
|
||||
}
|
||||
var file_conf_v1_kratos_conf_authz_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
1, // 0: conf.Authorization.casbin:type_name -> conf.Authorization.Casbin
|
||||
2, // 1: conf.Authorization.opa:type_name -> conf.Authorization.OPA
|
||||
3, // 2: conf.Authorization.zanzibar:type_name -> conf.Authorization.Zanzibar
|
||||
5, // 3: conf.Authorization.OPA.policies:type_name -> conf.Authorization.OPA.PoliciesEntry
|
||||
6, // 4: conf.Authorization.OPA.roles:type_name -> conf.Authorization.OPA.RolesEntry
|
||||
7, // 5: conf.Authorization.Zanzibar.keto:type_name -> conf.Authorization.Zanzibar.Keto
|
||||
8, // 6: conf.Authorization.Zanzibar.open_fga:type_name -> conf.Authorization.Zanzibar.OpenFga
|
||||
4, // 7: conf.Authorization.OPA.RolesEntry.value:type_name -> conf.Authorization.OPA.RoleActions
|
||||
8, // [8:8] is the sub-list for method output_type
|
||||
8, // [8:8] is the sub-list for method input_type
|
||||
8, // [8:8] is the sub-list for extension type_name
|
||||
8, // [8:8] is the sub-list for extension extendee
|
||||
0, // [0:8] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_conf_v1_kratos_conf_authz_proto_init() }
|
||||
@@ -108,13 +538,15 @@ func file_conf_v1_kratos_conf_authz_proto_init() {
|
||||
if File_conf_v1_kratos_conf_authz_proto != nil {
|
||||
return
|
||||
}
|
||||
file_conf_v1_kratos_conf_authz_proto_msgTypes[1].OneofWrappers = []any{}
|
||||
file_conf_v1_kratos_conf_authz_proto_msgTypes[3].OneofWrappers = []any{}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_conf_v1_kratos_conf_authz_proto_rawDesc), len(file_conf_v1_kratos_conf_authz_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 1,
|
||||
NumMessages: 9,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_bootstrap.proto
|
||||
|
||||
@@ -148,82 +148,36 @@ func (x *Bootstrap) GetAuthz() *Authorization {
|
||||
|
||||
var File_conf_v1_kratos_conf_bootstrap_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_bootstrap_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x23, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x20, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
|
||||
0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x1a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f,
|
||||
0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x1a, 0x22, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61,
|
||||
0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72,
|
||||
0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31,
|
||||
0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6f, 0x73, 0x73,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f,
|
||||
0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6e, 0x6f,
|
||||
0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f,
|
||||
0x61, 0x75, 0x74, 0x68, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x5f, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe3, 0x04, 0x0a,
|
||||
0x09, 0x42, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x12, 0x29, 0x0a, 0x06, 0x73, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x48, 0x00, 0x52, 0x06, 0x73, 0x65, 0x72, 0x76,
|
||||
0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x29, 0x0a, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x43, 0x6c, 0x69,
|
||||
0x65, 0x6e, 0x74, 0x48, 0x01, 0x52, 0x06, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01,
|
||||
0x12, 0x23, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x48, 0x02, 0x52, 0x04, 0x64, 0x61,
|
||||
0x74, 0x61, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x18, 0x04,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x72, 0x61, 0x63,
|
||||
0x65, 0x72, 0x48, 0x03, 0x52, 0x05, 0x74, 0x72, 0x61, 0x63, 0x65, 0x88, 0x01, 0x01, 0x12, 0x29,
|
||||
0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x48, 0x04, 0x52, 0x06,
|
||||
0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2f, 0x0a, 0x08, 0x72, 0x65, 0x67,
|
||||
0x69, 0x73, 0x74, 0x72, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x48, 0x05, 0x52, 0x08, 0x72,
|
||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x88, 0x01, 0x01, 0x12, 0x2f, 0x0a, 0x06, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x06,
|
||||
0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x88, 0x01, 0x01, 0x12, 0x20, 0x0a, 0x03, 0x6f,
|
||||
0x73, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x4f, 0x53, 0x53, 0x48, 0x07, 0x52, 0x03, 0x6f, 0x73, 0x73, 0x88, 0x01, 0x01, 0x12, 0x2f, 0x0a,
|
||||
0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x48, 0x08, 0x52, 0x06, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x88, 0x01, 0x01, 0x12, 0x2f,
|
||||
0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x65, 0x6e, 0x74, 0x69, 0x63, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x48, 0x09, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x88, 0x01, 0x01, 0x12,
|
||||
0x2e, 0x0a, 0x05, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x7a, 0x61, 0x74,
|
||||
0x69, 0x6f, 0x6e, 0x48, 0x0a, 0x52, 0x05, 0x61, 0x75, 0x74, 0x68, 0x7a, 0x88, 0x01, 0x01, 0x42,
|
||||
0x09, 0x0a, 0x07, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63,
|
||||
0x6c, 0x69, 0x65, 0x6e, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x42, 0x08,
|
||||
0x0a, 0x06, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x6f, 0x67,
|
||||
0x67, 0x65, 0x72, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79,
|
||||
0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x06, 0x0a, 0x04, 0x5f,
|
||||
0x6f, 0x73, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x42, 0x08,
|
||||
0x0a, 0x06, 0x5f, 0x61, 0x75, 0x74, 0x68, 0x6e, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x61, 0x75, 0x74,
|
||||
0x68, 0x7a, 0x42, 0x8a, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42,
|
||||
0x18, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x42, 0x6f, 0x6f, 0x74, 0x73,
|
||||
0x74, 0x72, 0x61, 0x70, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72,
|
||||
0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02,
|
||||
0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_bootstrap_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"#conf/v1/kratos_conf_bootstrap.proto\x12\x04conf\x1a conf/v1/kratos_conf_tracer.proto\x1a\x1econf/v1/kratos_conf_data.proto\x1a conf/v1/kratos_conf_server.proto\x1a conf/v1/kratos_conf_client.proto\x1a conf/v1/kratos_conf_logger.proto\x1a\"conf/v1/kratos_conf_registry.proto\x1a\x1dconf/v1/kratos_conf_oss.proto\x1a conf/v1/kratos_conf_config.proto\x1a conf/v1/kratos_conf_notify.proto\x1a\x1fconf/v1/kratos_conf_authn.proto\x1a\x1fconf/v1/kratos_conf_authz.proto\"\xe3\x04\n" +
|
||||
"\tBootstrap\x12)\n" +
|
||||
"\x06server\x18\x01 \x01(\v2\f.conf.ServerH\x00R\x06server\x88\x01\x01\x12)\n" +
|
||||
"\x06client\x18\x02 \x01(\v2\f.conf.ClientH\x01R\x06client\x88\x01\x01\x12#\n" +
|
||||
"\x04data\x18\x03 \x01(\v2\n" +
|
||||
".conf.DataH\x02R\x04data\x88\x01\x01\x12'\n" +
|
||||
"\x05trace\x18\x04 \x01(\v2\f.conf.TracerH\x03R\x05trace\x88\x01\x01\x12)\n" +
|
||||
"\x06logger\x18\x05 \x01(\v2\f.conf.LoggerH\x04R\x06logger\x88\x01\x01\x12/\n" +
|
||||
"\bregistry\x18\x06 \x01(\v2\x0e.conf.RegistryH\x05R\bregistry\x88\x01\x01\x12/\n" +
|
||||
"\x06config\x18\a \x01(\v2\x12.conf.RemoteConfigH\x06R\x06config\x88\x01\x01\x12 \n" +
|
||||
"\x03oss\x18\b \x01(\v2\t.conf.OSSH\aR\x03oss\x88\x01\x01\x12/\n" +
|
||||
"\x06notify\x18\t \x01(\v2\x12.conf.NotificationH\bR\x06notify\x88\x01\x01\x12/\n" +
|
||||
"\x05authn\x18\n" +
|
||||
" \x01(\v2\x14.conf.AuthenticationH\tR\x05authn\x88\x01\x01\x12.\n" +
|
||||
"\x05authz\x18\v \x01(\v2\x13.conf.AuthorizationH\n" +
|
||||
"R\x05authz\x88\x01\x01B\t\n" +
|
||||
"\a_serverB\t\n" +
|
||||
"\a_clientB\a\n" +
|
||||
"\x05_dataB\b\n" +
|
||||
"\x06_traceB\t\n" +
|
||||
"\a_loggerB\v\n" +
|
||||
"\t_registryB\t\n" +
|
||||
"\a_configB\x06\n" +
|
||||
"\x04_ossB\t\n" +
|
||||
"\a_notifyB\b\n" +
|
||||
"\x06_authnB\b\n" +
|
||||
"\x06_authzB\x8a\x01\n" +
|
||||
"\bcom.confB\x18KratosConfBootstrapProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_bootstrap_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_client.proto
|
||||
|
||||
@@ -199,51 +199,27 @@ func (x *Client_GRPC) GetTls() *TLS {
|
||||
|
||||
var File_conf_v1_kratos_conf_client_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_client_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6d, 0x69,
|
||||
0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x8c, 0x03,
|
||||
0x0a, 0x06, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x72, 0x65, 0x73, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x43, 0x6c,
|
||||
0x69, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x45, 0x53, 0x54, 0x48, 0x00, 0x52, 0x04, 0x72, 0x65, 0x73,
|
||||
0x74, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x2e, 0x47, 0x52, 0x50, 0x43, 0x48, 0x01, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x88, 0x01, 0x01,
|
||||
0x1a, 0x8a, 0x01, 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x30,
|
||||
0x0a, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65,
|
||||
0x77, 0x61, 0x72, 0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65,
|
||||
0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0x8a, 0x01,
|
||||
0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75,
|
||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x6d,
|
||||
0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72,
|
||||
0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x12, 0x1b, 0x0a,
|
||||
0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x72,
|
||||
0x65, 0x73, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x42, 0x87, 0x01, 0x0a,
|
||||
0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b, 0x72, 0x61, 0x74, 0x6f,
|
||||
0x73, 0x43, 0x6f, 0x6e, 0x66, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74,
|
||||
0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74,
|
||||
0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02,
|
||||
0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43,
|
||||
0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
|
||||
0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_client_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" conf/v1/kratos_conf_client.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\x1a$conf/v1/kratos_conf_middleware.proto\x1a\x1dconf/v1/kratos_conf_tls.proto\"\x8c\x03\n" +
|
||||
"\x06Client\x12*\n" +
|
||||
"\x04rest\x18\x01 \x01(\v2\x11.conf.Client.RESTH\x00R\x04rest\x88\x01\x01\x12*\n" +
|
||||
"\x04grpc\x18\x02 \x01(\v2\x11.conf.Client.GRPCH\x01R\x04grpc\x88\x01\x01\x1a\x8a\x01\n" +
|
||||
"\x04REST\x123\n" +
|
||||
"\atimeout\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x120\n" +
|
||||
"\n" +
|
||||
"middleware\x18\x02 \x01(\v2\x10.conf.MiddlewareR\n" +
|
||||
"middleware\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1a\x8a\x01\n" +
|
||||
"\x04GRPC\x123\n" +
|
||||
"\atimeout\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x120\n" +
|
||||
"\n" +
|
||||
"middleware\x18\x02 \x01(\v2\x10.conf.MiddlewareR\n" +
|
||||
"middleware\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tlsB\a\n" +
|
||||
"\x05_restB\a\n" +
|
||||
"\x05_grpcB\x87\x01\n" +
|
||||
"\bcom.confB\x15KratosConfClientProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_client_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_config.proto
|
||||
|
||||
@@ -117,9 +117,12 @@ func (x *RemoteConfig) GetPolaris() *RemoteConfig_Polaris {
|
||||
|
||||
type RemoteConfig_Nacos struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 服务端地址
|
||||
Port uint64 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // 服务端端口
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 配置键
|
||||
Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` // 服务端地址
|
||||
Port uint64 `protobuf:"varint,2,opt,name=port,proto3" json:"port,omitempty"` // 服务端端口
|
||||
Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` // 配置键
|
||||
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"` // 用户名
|
||||
Password string `protobuf:"bytes,5,opt,name=password,proto3" json:"password,omitempty"` // 密码
|
||||
NamespaceId string `protobuf:"bytes,6,opt,name=namespace_id,json=namespaceId,proto3" json:"namespace_id,omitempty"` // 命名空间ID
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -175,6 +178,27 @@ func (x *RemoteConfig_Nacos) GetKey() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Nacos) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Nacos) GetPassword() string {
|
||||
if x != nil {
|
||||
return x.Password
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *RemoteConfig_Nacos) GetNamespaceId() string {
|
||||
if x != nil {
|
||||
return x.NamespaceId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RemoteConfig_Etcd struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Endpoints []string `protobuf:"bytes,1,rep,name=endpoints,proto3" json:"endpoints,omitempty"` // 服务端地址
|
||||
@@ -453,79 +477,52 @@ func (*RemoteConfig_Polaris) Descriptor() ([]byte, []int) {
|
||||
|
||||
var File_conf_v1_kratos_conf_config_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_config_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x07, 0x0a, 0x0c, 0x52, 0x65, 0x6d,
|
||||
0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x30, 0x0a,
|
||||
0x04, 0x65, 0x74, 0x63, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e,
|
||||
0x45, 0x74, 0x63, 0x64, 0x48, 0x00, 0x52, 0x04, 0x65, 0x74, 0x63, 0x64, 0x88, 0x01, 0x01, 0x12,
|
||||
0x36, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0x69, 0x67, 0x2e, 0x43, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x48, 0x01, 0x52, 0x06, 0x63, 0x6f,
|
||||
0x6e, 0x73, 0x75, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x05, 0x6e, 0x61, 0x63, 0x6f, 0x73,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65,
|
||||
0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4e, 0x61, 0x63, 0x6f, 0x73,
|
||||
0x48, 0x02, 0x52, 0x05, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x06,
|
||||
0x61, 0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
||||
0x2e, 0x41, 0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x48, 0x03, 0x52, 0x06, 0x61, 0x70, 0x6f, 0x6c, 0x6c,
|
||||
0x6f, 0x88, 0x01, 0x01, 0x12, 0x42, 0x0a, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74,
|
||||
0x65, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x4b, 0x75, 0x62,
|
||||
0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x48, 0x04, 0x52, 0x0a, 0x6b, 0x75, 0x62, 0x65, 0x72,
|
||||
0x6e, 0x65, 0x74, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x07, 0x70, 0x6f, 0x6c, 0x61,
|
||||
0x72, 0x69, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x74, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, 0x50, 0x6f,
|
||||
0x6c, 0x61, 0x72, 0x69, 0x73, 0x48, 0x05, 0x52, 0x07, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73,
|
||||
0x88, 0x01, 0x01, 0x1a, 0x47, 0x0a, 0x05, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65,
|
||||
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x6b, 0x0a, 0x04,
|
||||
0x45, 0x74, 0x63, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07,
|
||||
0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x4c, 0x0a, 0x06, 0x43, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x1a, 0x8b, 0x01, 0x0a, 0x06, 0x41, 0x70, 0x6f, 0x6c,
|
||||
0x6c, 0x6f, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x15,
|
||||
0x0a, 0x06, 0x61, 0x70, 0x70, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6c, 0x75, 0x73, 0x74, 0x65, 0x72, 0x12,
|
||||
0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x16, 0x0a,
|
||||
0x06, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73,
|
||||
0x65, 0x63, 0x72, 0x65, 0x74, 0x1a, 0x2a, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65,
|
||||
0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63,
|
||||
0x65, 0x1a, 0x09, 0x0a, 0x07, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x42, 0x07, 0x0a, 0x05,
|
||||
0x5f, 0x65, 0x74, 0x63, 0x64, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c,
|
||||
0x42, 0x08, 0x0a, 0x06, 0x5f, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61,
|
||||
0x70, 0x6f, 0x6c, 0x6c, 0x6f, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72, 0x6e,
|
||||
0x65, 0x74, 0x65, 0x73, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73,
|
||||
0x42, 0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b,
|
||||
0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x50,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63,
|
||||
0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d,
|
||||
0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65,
|
||||
0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43,
|
||||
0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64,
|
||||
0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_config_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" conf/v1/kratos_conf_config.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\"\xe1\a\n" +
|
||||
"\fRemoteConfig\x12\x12\n" +
|
||||
"\x04type\x18\x01 \x01(\tR\x04type\x120\n" +
|
||||
"\x04etcd\x18\x02 \x01(\v2\x17.conf.RemoteConfig.EtcdH\x00R\x04etcd\x88\x01\x01\x126\n" +
|
||||
"\x06consul\x18\x03 \x01(\v2\x19.conf.RemoteConfig.ConsulH\x01R\x06consul\x88\x01\x01\x123\n" +
|
||||
"\x05nacos\x18\x04 \x01(\v2\x18.conf.RemoteConfig.NacosH\x02R\x05nacos\x88\x01\x01\x126\n" +
|
||||
"\x06apollo\x18\x06 \x01(\v2\x19.conf.RemoteConfig.ApolloH\x03R\x06apollo\x88\x01\x01\x12B\n" +
|
||||
"\n" +
|
||||
"kubernetes\x18\a \x01(\v2\x1d.conf.RemoteConfig.KubernetesH\x04R\n" +
|
||||
"kubernetes\x88\x01\x01\x129\n" +
|
||||
"\apolaris\x18\b \x01(\v2\x1a.conf.RemoteConfig.PolarisH\x05R\apolaris\x88\x01\x01\x1a\xa2\x01\n" +
|
||||
"\x05Nacos\x12\x18\n" +
|
||||
"\aaddress\x18\x01 \x01(\tR\aaddress\x12\x12\n" +
|
||||
"\x04port\x18\x02 \x01(\x04R\x04port\x12\x10\n" +
|
||||
"\x03key\x18\x03 \x01(\tR\x03key\x12\x1a\n" +
|
||||
"\busername\x18\x04 \x01(\tR\busername\x12\x1a\n" +
|
||||
"\bpassword\x18\x05 \x01(\tR\bpassword\x12!\n" +
|
||||
"\fnamespace_id\x18\x06 \x01(\tR\vnamespaceId\x1ak\n" +
|
||||
"\x04Etcd\x12\x1c\n" +
|
||||
"\tendpoints\x18\x01 \x03(\tR\tendpoints\x123\n" +
|
||||
"\atimeout\x18\x02 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12\x10\n" +
|
||||
"\x03key\x18\x03 \x01(\tR\x03key\x1aL\n" +
|
||||
"\x06Consul\x12\x16\n" +
|
||||
"\x06scheme\x18\x01 \x01(\tR\x06scheme\x12\x18\n" +
|
||||
"\aaddress\x18\x02 \x01(\tR\aaddress\x12\x10\n" +
|
||||
"\x03key\x18\x03 \x01(\tR\x03key\x1a\x8b\x01\n" +
|
||||
"\x06Apollo\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x15\n" +
|
||||
"\x06app_id\x18\x02 \x01(\tR\x05appId\x12\x18\n" +
|
||||
"\acluster\x18\x03 \x01(\tR\acluster\x12\x1c\n" +
|
||||
"\tnamespace\x18\x04 \x01(\tR\tnamespace\x12\x16\n" +
|
||||
"\x06secret\x18\x05 \x01(\tR\x06secret\x1a*\n" +
|
||||
"\n" +
|
||||
"Kubernetes\x12\x1c\n" +
|
||||
"\tnamespace\x18\x01 \x01(\tR\tnamespace\x1a\t\n" +
|
||||
"\aPolarisB\a\n" +
|
||||
"\x05_etcdB\t\n" +
|
||||
"\a_consulB\b\n" +
|
||||
"\x06_nacosB\t\n" +
|
||||
"\a_apolloB\r\n" +
|
||||
"\v_kubernetesB\n" +
|
||||
"\n" +
|
||||
"\b_polarisB\x87\x01\n" +
|
||||
"\bcom.confB\x15KratosConfConfigProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_config_proto_rawDescOnce sync.Once
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_logger.proto
|
||||
|
||||
@@ -191,6 +191,7 @@ type Logger_Logrus struct {
|
||||
TimestampFormat string `protobuf:"bytes,3,opt,name=timestamp_format,json=timestampFormat,proto3" json:"timestamp_format,omitempty"` // 定义时间戳格式,例如:"2006-01-02 15:04:05"
|
||||
DisableColors bool `protobuf:"varint,4,opt,name=disable_colors,json=disableColors,proto3" json:"disable_colors,omitempty"` // 不需要彩色日志
|
||||
DisableTimestamp bool `protobuf:"varint,5,opt,name=disable_timestamp,json=disableTimestamp,proto3" json:"disable_timestamp,omitempty"` // 不需要时间戳
|
||||
ForceColors bool `protobuf:"varint,6,opt,name=force_colors,json=forceColors,proto3" json:"force_colors,omitempty"` // 是否开启彩色日志
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
@@ -260,6 +261,13 @@ func (x *Logger_Logrus) GetDisableTimestamp() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *Logger_Logrus) GetForceColors() bool {
|
||||
if x != nil {
|
||||
return x.ForceColors
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Fluent
|
||||
type Logger_Fluent struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
@@ -445,81 +453,51 @@ func (x *Logger_Tencent) GetAccessSecret() string {
|
||||
|
||||
var File_conf_v1_kratos_conf_logger_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_logger_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0xc4, 0x07, 0x0a, 0x06, 0x4c, 0x6f, 0x67,
|
||||
0x67, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x27, 0x0a, 0x03, 0x7a, 0x61, 0x70, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67,
|
||||
0x65, 0x72, 0x2e, 0x5a, 0x61, 0x70, 0x48, 0x00, 0x52, 0x03, 0x7a, 0x61, 0x70, 0x88, 0x01, 0x01,
|
||||
0x12, 0x30, 0x0a, 0x06, 0x6c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x4c,
|
||||
0x6f, 0x67, 0x72, 0x75, 0x73, 0x48, 0x01, 0x52, 0x06, 0x6c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x88,
|
||||
0x01, 0x01, 0x12, 0x30, 0x0a, 0x06, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72,
|
||||
0x2e, 0x46, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x48, 0x02, 0x52, 0x06, 0x66, 0x6c, 0x75, 0x65, 0x6e,
|
||||
0x74, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x06, 0x61, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c, 0x6f, 0x67, 0x67,
|
||||
0x65, 0x72, 0x2e, 0x41, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x48, 0x03, 0x52, 0x06, 0x61, 0x6c, 0x69,
|
||||
0x79, 0x75, 0x6e, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x6e,
|
||||
0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4c,
|
||||
0x6f, 0x67, 0x67, 0x65, 0x72, 0x2e, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x48, 0x04, 0x52,
|
||||
0x07, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x88, 0x01, 0x01, 0x1a, 0x8c, 0x01, 0x0a, 0x03,
|
||||
0x5a, 0x61, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x73, 0x69, 0x7a,
|
||||
0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65,
|
||||
0x12, 0x17, 0x0a, 0x07, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x05, 0x52, 0x06, 0x6d, 0x61, 0x78, 0x41, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78,
|
||||
0x5f, 0x62, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a,
|
||||
0x6d, 0x61, 0x78, 0x42, 0x61, 0x63, 0x6b, 0x75, 0x70, 0x73, 0x1a, 0xbb, 0x01, 0x0a, 0x06, 0x4c,
|
||||
0x6f, 0x67, 0x72, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x66,
|
||||
0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
|
||||
0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x72, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x46, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f,
|
||||
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x64, 0x69,
|
||||
0x73, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x73, 0x12, 0x2b, 0x0a, 0x11, 0x64,
|
||||
0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10, 0x64, 0x69, 0x73, 0x61, 0x62, 0x6c, 0x65, 0x54,
|
||||
0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x1a, 0x24, 0x0a, 0x06, 0x46, 0x6c, 0x75, 0x65,
|
||||
0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x1a, 0x82,
|
||||
0x01, 0x0a, 0x06, 0x41, 0x6c, 0x69, 0x79, 0x75, 0x6e, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x23,
|
||||
0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x63,
|
||||
0x72, 0x65, 0x74, 0x1a, 0x84, 0x01, 0x0a, 0x07, 0x54, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x12,
|
||||
0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x74,
|
||||
0x6f, 0x70, 0x69, 0x63, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x74,
|
||||
0x6f, 0x70, 0x69, 0x63, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f,
|
||||
0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x7a,
|
||||
0x61, 0x70, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x6c, 0x6f, 0x67, 0x72, 0x75, 0x73, 0x42, 0x09, 0x0a,
|
||||
0x07, 0x5f, 0x66, 0x6c, 0x75, 0x65, 0x6e, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x61, 0x6c, 0x69,
|
||||
0x79, 0x75, 0x6e, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x74, 0x65, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x42,
|
||||
0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b, 0x72,
|
||||
0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x4c, 0x6f, 0x67, 0x67, 0x65, 0x72, 0x50, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62,
|
||||
0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e,
|
||||
0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58,
|
||||
0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2,
|
||||
0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
|
||||
0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_logger_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" conf/v1/kratos_conf_logger.proto\x12\x04conf\"\xe7\a\n" +
|
||||
"\x06Logger\x12\x12\n" +
|
||||
"\x04type\x18\x01 \x01(\tR\x04type\x12'\n" +
|
||||
"\x03zap\x18\x02 \x01(\v2\x10.conf.Logger.ZapH\x00R\x03zap\x88\x01\x01\x120\n" +
|
||||
"\x06logrus\x18\x03 \x01(\v2\x13.conf.Logger.LogrusH\x01R\x06logrus\x88\x01\x01\x120\n" +
|
||||
"\x06fluent\x18\x04 \x01(\v2\x13.conf.Logger.FluentH\x02R\x06fluent\x88\x01\x01\x120\n" +
|
||||
"\x06aliyun\x18\x05 \x01(\v2\x13.conf.Logger.AliyunH\x03R\x06aliyun\x88\x01\x01\x123\n" +
|
||||
"\atencent\x18\x06 \x01(\v2\x14.conf.Logger.TencentH\x04R\atencent\x88\x01\x01\x1a\x8c\x01\n" +
|
||||
"\x03Zap\x12\x1a\n" +
|
||||
"\bfilename\x18\x01 \x01(\tR\bfilename\x12\x14\n" +
|
||||
"\x05level\x18\x02 \x01(\tR\x05level\x12\x19\n" +
|
||||
"\bmax_size\x18\x03 \x01(\x05R\amaxSize\x12\x17\n" +
|
||||
"\amax_age\x18\x04 \x01(\x05R\x06maxAge\x12\x1f\n" +
|
||||
"\vmax_backups\x18\x05 \x01(\x05R\n" +
|
||||
"maxBackups\x1a\xde\x01\n" +
|
||||
"\x06Logrus\x12\x14\n" +
|
||||
"\x05level\x18\x01 \x01(\tR\x05level\x12\x1c\n" +
|
||||
"\tformatter\x18\x02 \x01(\tR\tformatter\x12)\n" +
|
||||
"\x10timestamp_format\x18\x03 \x01(\tR\x0ftimestampFormat\x12%\n" +
|
||||
"\x0edisable_colors\x18\x04 \x01(\bR\rdisableColors\x12+\n" +
|
||||
"\x11disable_timestamp\x18\x05 \x01(\bR\x10disableTimestamp\x12!\n" +
|
||||
"\fforce_colors\x18\x06 \x01(\bR\vforceColors\x1a$\n" +
|
||||
"\x06Fluent\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x1a\x82\x01\n" +
|
||||
"\x06Aliyun\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x18\n" +
|
||||
"\aproject\x18\x02 \x01(\tR\aproject\x12\x1d\n" +
|
||||
"\n" +
|
||||
"access_key\x18\x03 \x01(\tR\taccessKey\x12#\n" +
|
||||
"\raccess_secret\x18\x04 \x01(\tR\faccessSecret\x1a\x84\x01\n" +
|
||||
"\aTencent\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x19\n" +
|
||||
"\btopic_id\x18\x02 \x01(\tR\atopicId\x12\x1d\n" +
|
||||
"\n" +
|
||||
"access_key\x18\x03 \x01(\tR\taccessKey\x12#\n" +
|
||||
"\raccess_secret\x18\x04 \x01(\tR\faccessSecretB\x06\n" +
|
||||
"\x04_zapB\t\n" +
|
||||
"\a_logrusB\t\n" +
|
||||
"\a_fluentB\t\n" +
|
||||
"\a_aliyunB\n" +
|
||||
"\n" +
|
||||
"\b_tencentB\x87\x01\n" +
|
||||
"\bcom.confB\x15KratosConfLoggerProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_logger_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_middleware.proto
|
||||
|
||||
@@ -332,86 +332,40 @@ func (x *Middleware_Metrics) GetSummary() bool {
|
||||
|
||||
var File_conf_v1_kratos_conf_middleware_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_middleware_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x24, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xf7, 0x07, 0x0a,
|
||||
0x0a, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x12, 0x36, 0x0a, 0x07, 0x6c,
|
||||
0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x52,
|
||||
0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x52, 0x07, 0x6c, 0x69, 0x6d, 0x69,
|
||||
0x74, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64,
|
||||
0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x52, 0x07,
|
||||
0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x29, 0x0a, 0x04, 0x61, 0x75, 0x74, 0x68, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64,
|
||||
0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x41, 0x75, 0x74, 0x68, 0x52, 0x04, 0x61, 0x75,
|
||||
0x74, 0x68, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6c, 0x6f, 0x67,
|
||||
0x67, 0x69, 0x6e, 0x67, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x4c, 0x6f, 0x67, 0x67, 0x69, 0x6e, 0x67, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x18, 0x0b, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65,
|
||||
0x72, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x72, 0x61,
|
||||
0x63, 0x69, 0x6e, 0x67, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x54, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x5f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x18, 0x0d, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61,
|
||||
0x74, 0x65, 0x12, 0x34, 0x0a, 0x16, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x63, 0x69, 0x72,
|
||||
0x63, 0x75, 0x69, 0x74, 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x18, 0x0e, 0x20, 0x01,
|
||||
0x28, 0x08, 0x52, 0x14, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x69, 0x72, 0x63, 0x75, 0x69,
|
||||
0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x65, 0x72, 0x12, 0x27, 0x0a, 0x0f, 0x65, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0x1a, 0xbc, 0x03, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65,
|
||||
0x74, 0x68, 0x6f, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68,
|
||||
0x6f, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x03, 0x6b, 0x65, 0x79, 0x12, 0x50, 0x0a, 0x14, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74,
|
||||
0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x00, 0x52,
|
||||
0x12, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x45, 0x78, 0x70, 0x69,
|
||||
0x72, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x52, 0x0a, 0x15, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
|
||||
0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x48, 0x01, 0x52, 0x13, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x45, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x3a, 0x0a, 0x17, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70,
|
||||
0x72, 0x65, 0x66, 0x69, 0x78, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x14, 0x61,
|
||||
0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x65,
|
||||
0x66, 0x69, 0x78, 0x88, 0x01, 0x01, 0x12, 0x3c, 0x0a, 0x18, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73,
|
||||
0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x72, 0x65, 0x66,
|
||||
0x69, 0x78, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x48, 0x03, 0x52, 0x15, 0x72, 0x65, 0x66, 0x72,
|
||||
0x65, 0x73, 0x68, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x4b, 0x65, 0x79, 0x50, 0x72, 0x65, 0x66, 0x69,
|
||||
0x78, 0x88, 0x01, 0x01, 0x42, 0x17, 0x0a, 0x15, 0x5f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f,
|
||||
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x42, 0x18, 0x0a,
|
||||
0x16, 0x5f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f,
|
||||
0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x73, 0x42, 0x1a, 0x0a, 0x18, 0x5f, 0x61, 0x63, 0x63, 0x65,
|
||||
0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x72, 0x65,
|
||||
0x66, 0x69, 0x78, 0x42, 0x1b, 0x0a, 0x19, 0x5f, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f,
|
||||
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78,
|
||||
0x1a, 0x21, 0x0a, 0x0b, 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x65, 0x72, 0x12,
|
||||
0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e,
|
||||
0x61, 0x6d, 0x65, 0x1a, 0x71, 0x0a, 0x07, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x1c,
|
||||
0x0a, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x08, 0x52, 0x09, 0x68, 0x69, 0x73, 0x74, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x63, 0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x63,
|
||||
0x6f, 0x75, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x67, 0x61, 0x75, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07,
|
||||
0x73, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x73,
|
||||
0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x42, 0x8b, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x42, 0x19, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x4d,
|
||||
0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37,
|
||||
0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74,
|
||||
0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43,
|
||||
0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04,
|
||||
0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_middleware_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"$conf/v1/kratos_conf_middleware.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\"\xf7\a\n" +
|
||||
"\n" +
|
||||
"Middleware\x126\n" +
|
||||
"\alimiter\x18\x01 \x01(\v2\x1c.conf.Middleware.RateLimiterR\alimiter\x122\n" +
|
||||
"\ametrics\x18\x02 \x01(\v2\x18.conf.Middleware.MetricsR\ametrics\x12)\n" +
|
||||
"\x04auth\x18\x03 \x01(\v2\x15.conf.Middleware.AuthR\x04auth\x12%\n" +
|
||||
"\x0eenable_logging\x18\n" +
|
||||
" \x01(\bR\renableLogging\x12'\n" +
|
||||
"\x0fenable_recovery\x18\v \x01(\bR\x0eenableRecovery\x12%\n" +
|
||||
"\x0eenable_tracing\x18\f \x01(\bR\renableTracing\x12'\n" +
|
||||
"\x0fenable_validate\x18\r \x01(\bR\x0eenableValidate\x124\n" +
|
||||
"\x16enable_circuit_breaker\x18\x0e \x01(\bR\x14enableCircuitBreaker\x12'\n" +
|
||||
"\x0fenable_metadata\x18\x0f \x01(\bR\x0eenableMetadata\x1a\xbc\x03\n" +
|
||||
"\x04Auth\x12\x16\n" +
|
||||
"\x06method\x18\x01 \x01(\tR\x06method\x12\x10\n" +
|
||||
"\x03key\x18\x02 \x01(\tR\x03key\x12P\n" +
|
||||
"\x14access_token_expires\x18\x03 \x01(\v2\x19.google.protobuf.DurationH\x00R\x12accessTokenExpires\x88\x01\x01\x12R\n" +
|
||||
"\x15refresh_token_expires\x18\x04 \x01(\v2\x19.google.protobuf.DurationH\x01R\x13refreshTokenExpires\x88\x01\x01\x12:\n" +
|
||||
"\x17access_token_key_prefix\x18\x05 \x01(\tH\x02R\x14accessTokenKeyPrefix\x88\x01\x01\x12<\n" +
|
||||
"\x18refresh_token_key_prefix\x18\x06 \x01(\tH\x03R\x15refreshTokenKeyPrefix\x88\x01\x01B\x17\n" +
|
||||
"\x15_access_token_expiresB\x18\n" +
|
||||
"\x16_refresh_token_expiresB\x1a\n" +
|
||||
"\x18_access_token_key_prefixB\x1b\n" +
|
||||
"\x19_refresh_token_key_prefix\x1a!\n" +
|
||||
"\vRateLimiter\x12\x12\n" +
|
||||
"\x04name\x18\x01 \x01(\tR\x04name\x1aq\n" +
|
||||
"\aMetrics\x12\x1c\n" +
|
||||
"\thistogram\x18\x01 \x01(\bR\thistogram\x12\x18\n" +
|
||||
"\acounter\x18\x02 \x01(\bR\acounter\x12\x14\n" +
|
||||
"\x05gauge\x18\x03 \x01(\bR\x05gauge\x12\x18\n" +
|
||||
"\asummary\x18\x04 \x01(\bR\asummaryB\x8b\x01\n" +
|
||||
"\bcom.confB\x19KratosConfMiddlewareProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_middleware_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_notify.proto
|
||||
|
||||
@@ -137,34 +137,18 @@ func (x *Notification_SMS) GetAccessKeySecret() string {
|
||||
|
||||
var File_conf_v1_kratos_conf_notify_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_notify_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x79, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0xd6, 0x01, 0x0a, 0x0c, 0x4e, 0x6f, 0x74,
|
||||
0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x03, 0x73, 0x6d, 0x73,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4e, 0x6f,
|
||||
0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x53, 0x4d, 0x53, 0x48, 0x00,
|
||||
0x52, 0x03, 0x73, 0x6d, 0x73, 0x88, 0x01, 0x01, 0x1a, 0x8e, 0x01, 0x0a, 0x03, 0x53, 0x4d, 0x53,
|
||||
0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09,
|
||||
0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x72, 0x65, 0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0d, 0x61, 0x63, 0x63,
|
||||
0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x12, 0x2a, 0x0a,
|
||||
0x11, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x73, 0x65, 0x63, 0x72,
|
||||
0x65, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73,
|
||||
0x4b, 0x65, 0x79, 0x53, 0x65, 0x63, 0x72, 0x65, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x73, 0x6d,
|
||||
0x73, 0x42, 0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15,
|
||||
0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x79,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67,
|
||||
0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03,
|
||||
0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_notify_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" conf/v1/kratos_conf_notify.proto\x12\x04conf\"\xd6\x01\n" +
|
||||
"\fNotification\x12-\n" +
|
||||
"\x03sms\x18\x01 \x01(\v2\x16.conf.Notification.SMSH\x00R\x03sms\x88\x01\x01\x1a\x8e\x01\n" +
|
||||
"\x03SMS\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x1b\n" +
|
||||
"\tregion_id\x18\x02 \x01(\tR\bregionId\x12\"\n" +
|
||||
"\raccess_key_id\x18\x03 \x01(\tR\vaccessKeyId\x12*\n" +
|
||||
"\x11access_key_secret\x18\x04 \x01(\tR\x0faccessKeySecretB\x06\n" +
|
||||
"\x04_smsB\x87\x01\n" +
|
||||
"\bcom.confB\x15KratosConfNotifyProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_notify_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_oss.proto
|
||||
|
||||
@@ -169,41 +169,26 @@ func (x *OSS_MinIO) GetDownloadHost() string {
|
||||
|
||||
var File_conf_v1_kratos_conf_oss_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_oss_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6f, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b,
|
||||
0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x6c, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb1, 0x02, 0x0a, 0x03, 0x4f, 0x53, 0x53, 0x12, 0x2a, 0x0a, 0x05,
|
||||
0x6d, 0x69, 0x6e, 0x69, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x4f, 0x53, 0x53, 0x2e, 0x4d, 0x69, 0x6e, 0x49, 0x4f, 0x48, 0x00, 0x52, 0x05,
|
||||
0x6d, 0x69, 0x6e, 0x69, 0x6f, 0x88, 0x01, 0x01, 0x1a, 0xf3, 0x01, 0x0a, 0x05, 0x4d, 0x69, 0x6e,
|
||||
0x49, 0x4f, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1d,
|
||||
0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b,
|
||||
0x65, 0x6e, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x5f, 0x73, 0x73, 0x6c, 0x18, 0x0a, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x73, 0x65, 0x53, 0x73, 0x6c, 0x12, 0x1b, 0x0a, 0x03, 0x74,
|
||||
0x6c, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x70, 0x6c, 0x6f,
|
||||
0x61, 0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x75,
|
||||
0x70, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x6f, 0x77,
|
||||
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x5f, 0x68, 0x6f, 0x73, 0x74, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x0c, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x6f, 0x73, 0x74, 0x42, 0x08,
|
||||
0x0a, 0x06, 0x5f, 0x6d, 0x69, 0x6e, 0x69, 0x6f, 0x42, 0x84, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x12, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0x4f, 0x73, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74,
|
||||
0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72,
|
||||
0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02,
|
||||
0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42,
|
||||
0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_oss_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1dconf/v1/kratos_conf_oss.proto\x12\x04conf\x1a\x1dconf/v1/kratos_conf_tls.proto\"\xb1\x02\n" +
|
||||
"\x03OSS\x12*\n" +
|
||||
"\x05minio\x18\x01 \x01(\v2\x0f.conf.OSS.MinIOH\x00R\x05minio\x88\x01\x01\x1a\xf3\x01\n" +
|
||||
"\x05MinIO\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x1d\n" +
|
||||
"\n" +
|
||||
"access_key\x18\x02 \x01(\tR\taccessKey\x12\x1d\n" +
|
||||
"\n" +
|
||||
"secret_key\x18\x03 \x01(\tR\tsecretKey\x12\x14\n" +
|
||||
"\x05token\x18\x04 \x01(\tR\x05token\x12\x17\n" +
|
||||
"\ause_ssl\x18\n" +
|
||||
" \x01(\bR\x06useSsl\x12\x1b\n" +
|
||||
"\x03tls\x18\v \x01(\v2\t.conf.TLSR\x03tls\x12\x1f\n" +
|
||||
"\vupload_host\x18\x14 \x01(\tR\n" +
|
||||
"uploadHost\x12#\n" +
|
||||
"\rdownload_host\x18\x15 \x01(\tR\fdownloadHostB\b\n" +
|
||||
"\x06_minioB\x84\x01\n" +
|
||||
"\bcom.confB\x12KratosConfOssProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_oss_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_registry.proto
|
||||
|
||||
@@ -733,148 +733,82 @@ func (x *Registry_Servicecomb) GetEndpoints() []string {
|
||||
|
||||
var File_conf_v1_kratos_conf_registry_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_registry_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x22, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67,
|
||||
0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61,
|
||||
0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xdf, 0x0f, 0x0a, 0x08, 0x52,
|
||||
0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a, 0x06, 0x63,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x43, 0x6f, 0x6e, 0x73,
|
||||
0x75, 0x6c, 0x48, 0x00, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x88, 0x01, 0x01, 0x12,
|
||||
0x2c, 0x0a, 0x04, 0x65, 0x74, 0x63, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x45, 0x74,
|
||||
0x63, 0x64, 0x48, 0x01, 0x52, 0x04, 0x65, 0x74, 0x63, 0x64, 0x88, 0x01, 0x01, 0x12, 0x3b, 0x0a,
|
||||
0x09, 0x7a, 0x6f, 0x6f, 0x6b, 0x65, 0x65, 0x70, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x18, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79,
|
||||
0x2e, 0x5a, 0x6f, 0x6f, 0x4b, 0x65, 0x65, 0x70, 0x65, 0x72, 0x48, 0x02, 0x52, 0x09, 0x7a, 0x6f,
|
||||
0x6f, 0x6b, 0x65, 0x65, 0x70, 0x65, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2f, 0x0a, 0x05, 0x6e, 0x61,
|
||||
0x63, 0x6f, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x48,
|
||||
0x03, 0x52, 0x05, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x88, 0x01, 0x01, 0x12, 0x3e, 0x0a, 0x0a, 0x6b,
|
||||
0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e,
|
||||
0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x48, 0x04, 0x52, 0x0a, 0x6b, 0x75,
|
||||
0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65, 0x73, 0x88, 0x01, 0x01, 0x12, 0x32, 0x0a, 0x06, 0x65,
|
||||
0x75, 0x72, 0x65, 0x6b, 0x61, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x45, 0x75, 0x72, 0x65,
|
||||
0x6b, 0x61, 0x48, 0x05, 0x52, 0x06, 0x65, 0x75, 0x72, 0x65, 0x6b, 0x61, 0x88, 0x01, 0x01, 0x12,
|
||||
0x35, 0x0a, 0x07, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79,
|
||||
0x2e, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x48, 0x06, 0x52, 0x07, 0x70, 0x6f, 0x6c, 0x61,
|
||||
0x72, 0x69, 0x73, 0x88, 0x01, 0x01, 0x12, 0x41, 0x0a, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x63, 0x6f, 0x6d, 0x62, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x2e, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x63, 0x6f, 0x6d, 0x62, 0x48, 0x07, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x63, 0x6f, 0x6d, 0x62, 0x88, 0x01, 0x01, 0x1a, 0x5d, 0x0a, 0x06, 0x43, 0x6f, 0x6e,
|
||||
0x73, 0x75, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x61,
|
||||
0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x5f,
|
||||
0x63, 0x68, 0x65, 0x63, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x68, 0x65, 0x61,
|
||||
0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x1a, 0x24, 0x0a, 0x04, 0x45, 0x74, 0x63, 0x64,
|
||||
0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20,
|
||||
0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x1a, 0x5e,
|
||||
0x0a, 0x09, 0x5a, 0x6f, 0x6f, 0x4b, 0x65, 0x65, 0x70, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x65,
|
||||
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x6f, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72,
|
||||
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x1a, 0x82,
|
||||
0x06, 0x0a, 0x05, 0x4e, 0x61, 0x63, 0x6f, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72,
|
||||
0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65,
|
||||
0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04,
|
||||
0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
|
||||
0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x72, 0x65, 0x67,
|
||||
0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65,
|
||||
0x67, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x70, 0x70, 0x5f, 0x6e, 0x61,
|
||||
0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x70, 0x70, 0x4e, 0x61, 0x6d,
|
||||
0x65, 0x12, 0x17, 0x0a, 0x07, 0x61, 0x70, 0x70, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x06, 0x61, 0x70, 0x70, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63,
|
||||
0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09,
|
||||
0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63,
|
||||
0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73,
|
||||
0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x62, 0x65, 0x61, 0x74, 0x5f, 0x69, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x15, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44,
|
||||
0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x62, 0x65, 0x61, 0x74, 0x49, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x42, 0x0a, 0x0f, 0x6c, 0x69, 0x73, 0x74, 0x65, 0x6e, 0x5f,
|
||||
0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x16, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x6c, 0x69, 0x73, 0x74, 0x65,
|
||||
0x6e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x2a, 0x0a, 0x11, 0x75, 0x70, 0x64,
|
||||
0x61, 0x74, 0x65, 0x5f, 0x74, 0x68, 0x72, 0x65, 0x61, 0x64, 0x5f, 0x6e, 0x75, 0x6d, 0x18, 0x1e,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x68, 0x72, 0x65,
|
||||
0x61, 0x64, 0x4e, 0x75, 0x6d, 0x12, 0x34, 0x0a, 0x17, 0x6e, 0x6f, 0x74, 0x5f, 0x6c, 0x6f, 0x61,
|
||||
0x64, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x61, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74,
|
||||
0x18, 0x28, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x6e, 0x6f, 0x74, 0x4c, 0x6f, 0x61, 0x64, 0x43,
|
||||
0x61, 0x63, 0x68, 0x65, 0x41, 0x74, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x35, 0x0a, 0x17, 0x75,
|
||||
0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x77, 0x68, 0x65, 0x6e,
|
||||
0x5f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x18, 0x29, 0x20, 0x01, 0x28, 0x08, 0x52, 0x14, 0x75, 0x70,
|
||||
0x64, 0x61, 0x74, 0x65, 0x43, 0x61, 0x63, 0x68, 0x65, 0x57, 0x68, 0x65, 0x6e, 0x45, 0x6d, 0x70,
|
||||
0x74, 0x79, 0x12, 0x19, 0x0a, 0x08, 0x6f, 0x70, 0x65, 0x6e, 0x5f, 0x6b, 0x6d, 0x73, 0x18, 0x2a,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x6f, 0x70, 0x65, 0x6e, 0x4b, 0x6d, 0x73, 0x12, 0x1b, 0x0a,
|
||||
0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x32, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x6c, 0x6f,
|
||||
0x67, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x33, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x6f, 0x67,
|
||||
0x44, 0x69, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x64, 0x69, 0x72,
|
||||
0x18, 0x34, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x61, 0x63, 0x68, 0x65, 0x44, 0x69, 0x72,
|
||||
0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68,
|
||||
0x18, 0x35, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x50,
|
||||
0x61, 0x74, 0x68, 0x1a, 0x0c, 0x0a, 0x0a, 0x4b, 0x75, 0x62, 0x65, 0x72, 0x6e, 0x65, 0x74, 0x65,
|
||||
0x73, 0x1a, 0xca, 0x01, 0x0a, 0x06, 0x45, 0x75, 0x72, 0x65, 0x6b, 0x61, 0x12, 0x1c, 0x0a, 0x09,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x48, 0x0a, 0x12, 0x68, 0x65,
|
||||
0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x52, 0x11, 0x68, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x49, 0x6e, 0x74, 0x65,
|
||||
0x72, 0x76, 0x61, 0x6c, 0x12, 0x44, 0x0a, 0x10, 0x72, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x5f,
|
||||
0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x72, 0x65, 0x66, 0x72, 0x65,
|
||||
0x73, 0x68, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61,
|
||||
0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x1a, 0xac,
|
||||
0x01, 0x0a, 0x07, 0x50, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64,
|
||||
0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64,
|
||||
0x72, 0x65, 0x73, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x05, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x25, 0x0a, 0x0e, 0x69, 0x6e, 0x73, 0x74,
|
||||
0x61, 0x6e, 0x63, 0x65, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12,
|
||||
0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61, 0x63, 0x65, 0x12, 0x18, 0x0a,
|
||||
0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x1a, 0x2b, 0x0a,
|
||||
0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x63, 0x6f, 0x6d, 0x62, 0x12, 0x1c, 0x0a, 0x09,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52,
|
||||
0x09, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6c, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x65, 0x74, 0x63, 0x64, 0x42, 0x0c,
|
||||
0x0a, 0x0a, 0x5f, 0x7a, 0x6f, 0x6f, 0x6b, 0x65, 0x65, 0x70, 0x65, 0x72, 0x42, 0x08, 0x0a, 0x06,
|
||||
0x5f, 0x6e, 0x61, 0x63, 0x6f, 0x73, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x6b, 0x75, 0x62, 0x65, 0x72,
|
||||
0x6e, 0x65, 0x74, 0x65, 0x73, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x65, 0x75, 0x72, 0x65, 0x6b, 0x61,
|
||||
0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x70, 0x6f, 0x6c, 0x61, 0x72, 0x69, 0x73, 0x42, 0x0e, 0x0a, 0x0c,
|
||||
0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x63, 0x6f, 0x6d, 0x62, 0x42, 0x89, 0x01, 0x0a,
|
||||
0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x17, 0x4b, 0x72, 0x61, 0x74, 0x6f,
|
||||
0x73, 0x43, 0x6f, 0x6e, 0x66, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x79, 0x50, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d,
|
||||
0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f,
|
||||
0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f,
|
||||
0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58,
|
||||
0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02,
|
||||
0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74,
|
||||
0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_registry_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\"conf/v1/kratos_conf_registry.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\"\xdf\x0f\n" +
|
||||
"\bRegistry\x12\x12\n" +
|
||||
"\x04type\x18\x01 \x01(\tR\x04type\x122\n" +
|
||||
"\x06consul\x18\x02 \x01(\v2\x15.conf.Registry.ConsulH\x00R\x06consul\x88\x01\x01\x12,\n" +
|
||||
"\x04etcd\x18\x03 \x01(\v2\x13.conf.Registry.EtcdH\x01R\x04etcd\x88\x01\x01\x12;\n" +
|
||||
"\tzookeeper\x18\x04 \x01(\v2\x18.conf.Registry.ZooKeeperH\x02R\tzookeeper\x88\x01\x01\x12/\n" +
|
||||
"\x05nacos\x18\x05 \x01(\v2\x14.conf.Registry.NacosH\x03R\x05nacos\x88\x01\x01\x12>\n" +
|
||||
"\n" +
|
||||
"kubernetes\x18\x06 \x01(\v2\x19.conf.Registry.KubernetesH\x04R\n" +
|
||||
"kubernetes\x88\x01\x01\x122\n" +
|
||||
"\x06eureka\x18\a \x01(\v2\x15.conf.Registry.EurekaH\x05R\x06eureka\x88\x01\x01\x125\n" +
|
||||
"\apolaris\x18\b \x01(\v2\x16.conf.Registry.PolarisH\x06R\apolaris\x88\x01\x01\x12A\n" +
|
||||
"\vservicecomb\x18\t \x01(\v2\x1a.conf.Registry.ServicecombH\aR\vservicecomb\x88\x01\x01\x1a]\n" +
|
||||
"\x06Consul\x12\x16\n" +
|
||||
"\x06scheme\x18\x01 \x01(\tR\x06scheme\x12\x18\n" +
|
||||
"\aaddress\x18\x02 \x01(\tR\aaddress\x12!\n" +
|
||||
"\fhealth_check\x18\x03 \x01(\bR\vhealthCheck\x1a$\n" +
|
||||
"\x04Etcd\x12\x1c\n" +
|
||||
"\tendpoints\x18\x01 \x03(\tR\tendpoints\x1a^\n" +
|
||||
"\tZooKeeper\x12\x1c\n" +
|
||||
"\tendpoints\x18\x01 \x03(\tR\tendpoints\x123\n" +
|
||||
"\atimeout\x18\x02 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x1a\x82\x06\n" +
|
||||
"\x05Nacos\x12\x18\n" +
|
||||
"\aaddress\x18\x01 \x01(\tR\aaddress\x12\x12\n" +
|
||||
"\x04port\x18\x02 \x01(\x04R\x04port\x12!\n" +
|
||||
"\fnamespace_id\x18\x03 \x01(\tR\vnamespaceId\x12\x1b\n" +
|
||||
"\tregion_id\x18\x04 \x01(\tR\bregionId\x12\x19\n" +
|
||||
"\bapp_name\x18\x05 \x01(\tR\aappName\x12\x17\n" +
|
||||
"\aapp_key\x18\x06 \x01(\tR\x06appKey\x12\x1d\n" +
|
||||
"\n" +
|
||||
"access_key\x18\a \x01(\tR\taccessKey\x12\x1d\n" +
|
||||
"\n" +
|
||||
"secret_key\x18\b \x01(\tR\tsecretKey\x12\x1a\n" +
|
||||
"\busername\x18\t \x01(\tR\busername\x12\x1a\n" +
|
||||
"\bpassword\x18\n" +
|
||||
" \x01(\tR\bpassword\x123\n" +
|
||||
"\atimeout\x18\x14 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12>\n" +
|
||||
"\rbeat_interval\x18\x15 \x01(\v2\x19.google.protobuf.DurationR\fbeatInterval\x12B\n" +
|
||||
"\x0flisten_interval\x18\x16 \x01(\v2\x19.google.protobuf.DurationR\x0elistenInterval\x12*\n" +
|
||||
"\x11update_thread_num\x18\x1e \x01(\x05R\x0fupdateThreadNum\x124\n" +
|
||||
"\x17not_load_cache_at_start\x18( \x01(\bR\x13notLoadCacheAtStart\x125\n" +
|
||||
"\x17update_cache_when_empty\x18) \x01(\bR\x14updateCacheWhenEmpty\x12\x19\n" +
|
||||
"\bopen_kms\x18* \x01(\bR\aopenKms\x12\x1b\n" +
|
||||
"\tlog_level\x182 \x01(\tR\blogLevel\x12\x17\n" +
|
||||
"\alog_dir\x183 \x01(\tR\x06logDir\x12\x1b\n" +
|
||||
"\tcache_dir\x184 \x01(\tR\bcacheDir\x12!\n" +
|
||||
"\fcontext_path\x185 \x01(\tR\vcontextPath\x1a\f\n" +
|
||||
"\n" +
|
||||
"Kubernetes\x1a\xca\x01\n" +
|
||||
"\x06Eureka\x12\x1c\n" +
|
||||
"\tendpoints\x18\x01 \x03(\tR\tendpoints\x12H\n" +
|
||||
"\x12heartbeat_interval\x18\x02 \x01(\v2\x19.google.protobuf.DurationR\x11heartbeatInterval\x12D\n" +
|
||||
"\x10refresh_interval\x18\x03 \x01(\v2\x19.google.protobuf.DurationR\x0frefreshInterval\x12\x12\n" +
|
||||
"\x04path\x18\x04 \x01(\tR\x04path\x1a\xac\x01\n" +
|
||||
"\aPolaris\x12\x18\n" +
|
||||
"\aaddress\x18\x01 \x01(\tR\aaddress\x12\x12\n" +
|
||||
"\x04port\x18\x02 \x01(\x05R\x04port\x12%\n" +
|
||||
"\x0einstance_count\x18\x03 \x01(\x05R\rinstanceCount\x12\x1c\n" +
|
||||
"\tnamespace\x18\x04 \x01(\tR\tnamespace\x12\x18\n" +
|
||||
"\aservice\x18\x05 \x01(\tR\aservice\x12\x14\n" +
|
||||
"\x05token\x18\x06 \x01(\tR\x05token\x1a+\n" +
|
||||
"\vServicecomb\x12\x1c\n" +
|
||||
"\tendpoints\x18\x01 \x03(\tR\tendpointsB\t\n" +
|
||||
"\a_consulB\a\n" +
|
||||
"\x05_etcdB\f\n" +
|
||||
"\n" +
|
||||
"_zookeeperB\b\n" +
|
||||
"\x06_nacosB\r\n" +
|
||||
"\v_kubernetesB\t\n" +
|
||||
"\a_eurekaB\n" +
|
||||
"\n" +
|
||||
"\b_polarisB\x0e\n" +
|
||||
"\f_servicecombB\x89\x01\n" +
|
||||
"\bcom.confB\x17KratosConfRegistryProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_registry_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_server.proto
|
||||
|
||||
@@ -2582,521 +2582,292 @@ func (x *Server_Machinery_DynamoDB) GetGroupMetasTable() string {
|
||||
|
||||
var File_conf_v1_kratos_conf_server_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_server_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76,
|
||||
0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x6d, 0x69,
|
||||
0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1d,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x5f, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xec, 0x3d,
|
||||
0x0a, 0x06, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x04, 0x72, 0x65, 0x73, 0x74,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, 0x45, 0x53, 0x54, 0x48, 0x00, 0x52, 0x04, 0x72, 0x65, 0x73,
|
||||
0x74, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a, 0x04, 0x67, 0x72, 0x70, 0x63, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x2e, 0x47, 0x52, 0x50, 0x43, 0x48, 0x01, 0x52, 0x04, 0x67, 0x72, 0x70, 0x63, 0x88, 0x01, 0x01,
|
||||
0x12, 0x33, 0x0a, 0x07, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
|
||||
0x47, 0x72, 0x61, 0x70, 0x68, 0x51, 0x4c, 0x48, 0x02, 0x52, 0x07, 0x67, 0x72, 0x61, 0x70, 0x68,
|
||||
0x71, 0x6c, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x06, 0x74, 0x68, 0x72, 0x69, 0x66, 0x74, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x2e, 0x54, 0x68, 0x72, 0x69, 0x66, 0x74, 0x48, 0x03, 0x52, 0x06, 0x74, 0x68,
|
||||
0x72, 0x69, 0x66, 0x74, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x61,
|
||||
0x6c, 0x69, 0x76, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c, 0x69,
|
||||
0x76, 0x65, 0x48, 0x04, 0x52, 0x09, 0x6b, 0x65, 0x65, 0x70, 0x61, 0x6c, 0x69, 0x76, 0x65, 0x88,
|
||||
0x01, 0x01, 0x12, 0x2a, 0x0a, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d,
|
||||
0x71, 0x74, 0x74, 0x48, 0x05, 0x52, 0x04, 0x6d, 0x71, 0x74, 0x74, 0x88, 0x01, 0x01, 0x12, 0x2d,
|
||||
0x0a, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4b, 0x61, 0x66, 0x6b,
|
||||
0x61, 0x48, 0x06, 0x52, 0x05, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a,
|
||||
0x08, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74, 0x6d, 0x71, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52, 0x61,
|
||||
0x62, 0x62, 0x69, 0x74, 0x4d, 0x51, 0x48, 0x07, 0x52, 0x08, 0x72, 0x61, 0x62, 0x62, 0x69, 0x74,
|
||||
0x6d, 0x71, 0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d,
|
||||
0x71, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53,
|
||||
0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x4d, 0x51, 0x48, 0x08,
|
||||
0x52, 0x08, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x6d, 0x71, 0x88, 0x01, 0x01, 0x12, 0x2a, 0x0a,
|
||||
0x04, 0x6e, 0x61, 0x74, 0x73, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4e, 0x41, 0x54, 0x53, 0x48, 0x09,
|
||||
0x52, 0x04, 0x6e, 0x61, 0x74, 0x73, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x03, 0x6e, 0x73, 0x71,
|
||||
0x18, 0x0f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65,
|
||||
0x72, 0x76, 0x65, 0x72, 0x2e, 0x4e, 0x53, 0x51, 0x48, 0x0a, 0x52, 0x03, 0x6e, 0x73, 0x71, 0x88,
|
||||
0x01, 0x01, 0x12, 0x30, 0x0a, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x18, 0x10, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x2e, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x48, 0x0b, 0x52, 0x06, 0x70, 0x75, 0x6c, 0x73, 0x61,
|
||||
0x72, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x05, 0x72, 0x65, 0x64, 0x69, 0x73, 0x18, 0x11, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x48, 0x0c, 0x52, 0x05, 0x72, 0x65, 0x64, 0x69, 0x73,
|
||||
0x88, 0x01, 0x01, 0x12, 0x36, 0x0a, 0x08, 0x72, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x6d, 0x71, 0x18,
|
||||
0x12, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72,
|
||||
0x76, 0x65, 0x72, 0x2e, 0x52, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4d, 0x51, 0x48, 0x0d, 0x52, 0x08,
|
||||
0x72, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x6d, 0x71, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x09, 0x77,
|
||||
0x65, 0x62, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x18, 0x14, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x57, 0x65, 0x62,
|
||||
0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x48, 0x0e, 0x52, 0x09, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63,
|
||||
0x6b, 0x65, 0x74, 0x88, 0x01, 0x01, 0x12, 0x27, 0x0a, 0x03, 0x73, 0x73, 0x65, 0x18, 0x15, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x2e, 0x53, 0x53, 0x45, 0x48, 0x0f, 0x52, 0x03, 0x73, 0x73, 0x65, 0x88, 0x01, 0x01, 0x12,
|
||||
0x36, 0x0a, 0x08, 0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x69, 0x6f, 0x18, 0x16, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
|
||||
0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x4f, 0x48, 0x10, 0x52, 0x08, 0x73, 0x6f, 0x63, 0x6b,
|
||||
0x65, 0x74, 0x69, 0x6f, 0x88, 0x01, 0x01, 0x12, 0x33, 0x0a, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x6c, 0x72, 0x18, 0x17, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x52, 0x48, 0x11,
|
||||
0x52, 0x07, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x72, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x05,
|
||||
0x61, 0x73, 0x79, 0x6e, 0x71, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x73, 0x79, 0x6e, 0x71, 0x48,
|
||||
0x12, 0x52, 0x05, 0x61, 0x73, 0x79, 0x6e, 0x71, 0x88, 0x01, 0x01, 0x12, 0x39, 0x0a, 0x09, 0x6d,
|
||||
0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x63,
|
||||
0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x48, 0x13, 0x52, 0x09, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e,
|
||||
0x65, 0x72, 0x79, 0x88, 0x01, 0x01, 0x1a, 0x84, 0x03, 0x0a, 0x04, 0x52, 0x45, 0x53, 0x54, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64,
|
||||
0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x33, 0x0a,
|
||||
0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f,
|
||||
0x75, 0x74, 0x12, 0x2a, 0x0a, 0x04, 0x63, 0x6f, 0x72, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x16, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x52,
|
||||
0x45, 0x53, 0x54, 0x2e, 0x43, 0x4f, 0x52, 0x53, 0x52, 0x04, 0x63, 0x6f, 0x72, 0x73, 0x12, 0x30,
|
||||
0x0a, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x0b, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65,
|
||||
0x77, 0x61, 0x72, 0x65, 0x52, 0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65,
|
||||
0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x12, 0x25, 0x0a,
|
||||
0x0e, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x77, 0x61, 0x67, 0x67, 0x65, 0x72, 0x18,
|
||||
0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x77, 0x61,
|
||||
0x67, 0x67, 0x65, 0x72, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x70,
|
||||
0x70, 0x72, 0x6f, 0x66, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x50, 0x70, 0x72, 0x6f, 0x66, 0x1a, 0x54, 0x0a, 0x04, 0x43, 0x4f, 0x52, 0x53, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
|
||||
0x52, 0x07, 0x68, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x74,
|
||||
0x68, 0x6f, 0x64, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x74, 0x68,
|
||||
0x6f, 0x64, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x18, 0x03,
|
||||
0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x73, 0x1a, 0xb8, 0x01,
|
||||
0x0a, 0x04, 0x47, 0x52, 0x50, 0x43, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72,
|
||||
0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x61, 0x64, 0x64, 0x72, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x0a, 0x6d, 0x69, 0x64,
|
||||
0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x4d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x52,
|
||||
0x0a, 0x6d, 0x69, 0x64, 0x64, 0x6c, 0x65, 0x77, 0x61, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x74,
|
||||
0x6c, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0xb5, 0x01, 0x0a, 0x09, 0x57, 0x65, 0x62,
|
||||
0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72,
|
||||
0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65,
|
||||
0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x33,
|
||||
0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65,
|
||||
0x6f, 0x75, 0x74, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73,
|
||||
0x1a, 0xcf, 0x01, 0x0a, 0x04, 0x4d, 0x71, 0x74, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03, 0x74,
|
||||
0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e,
|
||||
0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x75, 0x73, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64,
|
||||
0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x23, 0x0a,
|
||||
0x0d, 0x63, 0x6c, 0x65, 0x61, 0x6e, 0x5f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x07,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x63, 0x6c, 0x65, 0x61, 0x6e, 0x53, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x1a, 0x58, 0x0a, 0x05, 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x12, 0x1c, 0x0a, 0x09, 0x65,
|
||||
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64,
|
||||
0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12,
|
||||
0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0x5b, 0x0a, 0x08,
|
||||
0x52, 0x61, 0x62, 0x62, 0x69, 0x74, 0x4d, 0x51, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x70,
|
||||
0x6f, 0x69, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x09, 0x65, 0x6e, 0x64,
|
||||
0x70, 0x6f, 0x69, 0x6e, 0x74, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03,
|
||||
0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0x59, 0x0a, 0x08, 0x41, 0x63, 0x74,
|
||||
0x69, 0x76, 0x65, 0x4d, 0x51, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e,
|
||||
0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52,
|
||||
0x03, 0x74, 0x6c, 0x73, 0x1a, 0x55, 0x0a, 0x04, 0x4e, 0x41, 0x54, 0x53, 0x12, 0x1a, 0x0a, 0x08,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
|
||||
0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65,
|
||||
0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b,
|
||||
0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0x54, 0x0a, 0x03, 0x4e,
|
||||
0x53, 0x51, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63,
|
||||
0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c,
|
||||
0x73, 0x1a, 0x57, 0x0a, 0x06, 0x50, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x65,
|
||||
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65,
|
||||
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a,
|
||||
0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0x56, 0x0a, 0x05, 0x52, 0x65,
|
||||
0x64, 0x69, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18,
|
||||
0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74,
|
||||
0x6c, 0x73, 0x1a, 0x92, 0x03, 0x0a, 0x08, 0x52, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x4d, 0x51, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64,
|
||||
0x65, 0x63, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12,
|
||||
0x21, 0x0a, 0x0c, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x73, 0x18,
|
||||
0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x6e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x65,
|
||||
0x72, 0x5f, 0x64, 0x6f, 0x6d, 0x61, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x44, 0x6f, 0x6d, 0x61, 0x69, 0x6e,
|
||||
0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x4b, 0x65, 0x79, 0x12,
|
||||
0x1d, 0x0a, 0x0a, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x06, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x65, 0x63, 0x72, 0x65, 0x74, 0x4b, 0x65, 0x79, 0x12, 0x25,
|
||||
0x0a, 0x0e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x73, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79,
|
||||
0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70, 0x61,
|
||||
0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
|
||||
0x61, 0x63, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x73, 0x74,
|
||||
0x61, 0x6e, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x67, 0x72, 0x6f, 0x75,
|
||||
0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x67, 0x72,
|
||||
0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x0b,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52,
|
||||
0x03, 0x74, 0x6c, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74,
|
||||
0x72, 0x61, 0x63, 0x65, 0x18, 0x64, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x65, 0x6e, 0x61, 0x62,
|
||||
0x6c, 0x65, 0x54, 0x72, 0x61, 0x63, 0x65, 0x1a, 0xcd, 0x08, 0x0a, 0x05, 0x41, 0x73, 0x79, 0x6e,
|
||||
0x71, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x1a, 0x0a, 0x08, 0x65,
|
||||
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65,
|
||||
0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 0x73, 0x73, 0x77,
|
||||
0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x64, 0x62, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x02, 0x64, 0x62, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x73, 0x69,
|
||||
0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6f, 0x6f, 0x6c, 0x53, 0x69,
|
||||
0x7a, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79,
|
||||
0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65,
|
||||
0x6e, 0x63, 0x79, 0x12, 0x24, 0x0a, 0x0e, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6d, 0x61, 0x78,
|
||||
0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x67, 0x72, 0x6f,
|
||||
0x75, 0x70, 0x4d, 0x61, 0x78, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x71, 0x75, 0x65,
|
||||
0x75, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x41, 0x73, 0x79, 0x6e, 0x71, 0x2e, 0x51, 0x75,
|
||||
0x65, 0x75, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x71, 0x75, 0x65, 0x75, 0x65,
|
||||
0x73, 0x12, 0x3c, 0x0a, 0x1a, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x67, 0x72, 0x61, 0x63,
|
||||
0x65, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x5f, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x18,
|
||||
0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x18, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x47, 0x72, 0x61,
|
||||
0x63, 0x65, 0x66, 0x75, 0x6c, 0x6c, 0x79, 0x53, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77, 0x6e, 0x12,
|
||||
0x34, 0x0a, 0x16, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74,
|
||||
0x5f, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x15, 0x20, 0x01, 0x28, 0x08, 0x52,
|
||||
0x14, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x72, 0x69, 0x63, 0x74, 0x50, 0x72, 0x69,
|
||||
0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x44, 0x0a, 0x10, 0x73, 0x68, 0x75, 0x74, 0x64, 0x6f, 0x77,
|
||||
0x6e, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x73, 0x68, 0x75, 0x74,
|
||||
0x64, 0x6f, 0x77, 0x6e, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3c, 0x0a, 0x0c, 0x64,
|
||||
0x69, 0x61, 0x6c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x1f, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x64, 0x69,
|
||||
0x61, 0x6c, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3c, 0x0a, 0x0c, 0x72, 0x65, 0x61,
|
||||
0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x20, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0b, 0x72, 0x65, 0x61, 0x64,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x3e, 0x0a, 0x0d, 0x77, 0x72, 0x69, 0x74, 0x65,
|
||||
0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x21, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19,
|
||||
0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
|
||||
0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65,
|
||||
0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x4d, 0x0a, 0x15, 0x68, 0x65, 0x61, 0x6c, 0x74,
|
||||
0x68, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c,
|
||||
0x18, 0x22, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f,
|
||||
0x6e, 0x52, 0x13, 0x68, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e,
|
||||
0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x58, 0x0a, 0x1b, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65,
|
||||
0x64, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x74,
|
||||
0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x23, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x18, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c,
|
||||
0x12, 0x47, 0x0a, 0x12, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x67, 0x72, 0x61, 0x63, 0x65, 0x5f,
|
||||
0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x24, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67,
|
||||
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44,
|
||||
0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x10, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x47, 0x72,
|
||||
0x61, 0x63, 0x65, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x41, 0x0a, 0x0f, 0x67, 0x72, 0x6f,
|
||||
0x75, 0x70, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x18, 0x25, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0d, 0x67,
|
||||
0x72, 0x6f, 0x75, 0x70, 0x4d, 0x61, 0x78, 0x44, 0x65, 0x6c, 0x61, 0x79, 0x1a, 0x39, 0x0a, 0x0b,
|
||||
0x51, 0x75, 0x65, 0x75, 0x65, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61,
|
||||
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0xbc, 0x11, 0x0a, 0x09, 0x4d, 0x61, 0x63, 0x68,
|
||||
0x69, 0x6e, 0x65, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72, 0x5f,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x72, 0x6f, 0x6b,
|
||||
0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x72, 0x6f, 0x6b, 0x65, 0x72,
|
||||
0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x72, 0x6f,
|
||||
0x6b, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x62, 0x72, 0x6f, 0x6b, 0x65,
|
||||
0x72, 0x5f, 0x64, 0x62, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x62, 0x72, 0x6f, 0x6b,
|
||||
0x65, 0x72, 0x44, 0x62, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f,
|
||||
0x74, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b,
|
||||
0x65, 0x6e, 0x64, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x61, 0x63, 0x6b, 0x65,
|
||||
0x6e, 0x64, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62,
|
||||
0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x61,
|
||||
0x63, 0x6b, 0x65, 0x6e, 0x64, 0x5f, 0x64, 0x62, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09,
|
||||
0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x44, 0x62, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63,
|
||||
0x6b, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x61,
|
||||
0x64, 0x64, 0x72, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x63, 0x6b, 0x41,
|
||||
0x64, 0x64, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x64, 0x62, 0x18, 0x16,
|
||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x6c, 0x6f, 0x63, 0x6b, 0x44, 0x62, 0x12, 0x21, 0x0a, 0x0c,
|
||||
0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x67, 0x18, 0x1e, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x54, 0x61, 0x67, 0x12,
|
||||
0x31, 0x0a, 0x14, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x63,
|
||||
0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x18, 0x1f, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x63,
|
||||
0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e,
|
||||
0x63, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x65, 0x72, 0x5f, 0x71,
|
||||
0x75, 0x65, 0x75, 0x65, 0x18, 0x20, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x73,
|
||||
0x75, 0x6d, 0x65, 0x72, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73,
|
||||
0x18, 0x32, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c,
|
||||
0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c,
|
||||
0x74, 0x5f, 0x71, 0x75, 0x65, 0x75, 0x65, 0x18, 0x33, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64,
|
||||
0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x51, 0x75, 0x65, 0x75, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x72,
|
||||
0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x5f, 0x65, 0x78, 0x70, 0x69, 0x72, 0x65, 0x5f, 0x69, 0x6e,
|
||||
0x18, 0x34, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x45,
|
||||
0x78, 0x70, 0x69, 0x72, 0x65, 0x49, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x6e, 0x6f, 0x5f, 0x75, 0x6e,
|
||||
0x69, 0x78, 0x5f, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x73, 0x18, 0x35, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x0d, 0x6e, 0x6f, 0x55, 0x6e, 0x69, 0x78, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c, 0x73, 0x12,
|
||||
0x32, 0x0a, 0x05, 0x72, 0x65, 0x64, 0x69, 0x73, 0x18, 0x64, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1c,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x63,
|
||||
0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2e, 0x52, 0x65, 0x64, 0x69, 0x73, 0x52, 0x05, 0x72, 0x65,
|
||||
0x64, 0x69, 0x73, 0x12, 0x2f, 0x0a, 0x04, 0x61, 0x6d, 0x71, 0x70, 0x18, 0x65, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
|
||||
0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x4d, 0x51, 0x50, 0x52, 0x04,
|
||||
0x61, 0x6d, 0x71, 0x70, 0x12, 0x2c, 0x0a, 0x03, 0x73, 0x71, 0x73, 0x18, 0x66, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
|
||||
0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2e, 0x53, 0x51, 0x53, 0x52, 0x03, 0x73,
|
||||
0x71, 0x73, 0x12, 0x2c, 0x0a, 0x03, 0x67, 0x63, 0x70, 0x18, 0x67, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x1a, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x61,
|
||||
0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2e, 0x47, 0x43, 0x50, 0x52, 0x03, 0x67, 0x63, 0x70,
|
||||
0x12, 0x38, 0x0a, 0x07, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x18, 0x68, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
|
||||
0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2e, 0x4d, 0x6f, 0x6e, 0x67, 0x6f, 0x44,
|
||||
0x42, 0x52, 0x07, 0x6d, 0x6f, 0x6e, 0x67, 0x6f, 0x64, 0x62, 0x12, 0x3b, 0x0a, 0x08, 0x64, 0x79,
|
||||
0x6e, 0x61, 0x6d, 0x6f, 0x64, 0x62, 0x18, 0x69, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1f, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x4d, 0x61, 0x63, 0x68, 0x69,
|
||||
0x6e, 0x65, 0x72, 0x79, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x6f, 0x44, 0x42, 0x52, 0x08, 0x64,
|
||||
0x79, 0x6e, 0x61, 0x6d, 0x6f, 0x64, 0x62, 0x1a, 0xb1, 0x03, 0x0a, 0x05, 0x52, 0x65, 0x64, 0x69,
|
||||
0x73, 0x12, 0x19, 0x0a, 0x08, 0x6d, 0x61, 0x78, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x12, 0x1d, 0x0a, 0x0a,
|
||||
0x6d, 0x61, 0x78, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x09, 0x6d, 0x61, 0x78, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6d,
|
||||
0x61, 0x78, 0x5f, 0x69, 0x64, 0x6c, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x6d, 0x61, 0x78, 0x49, 0x64, 0x6c, 0x65, 0x54, 0x69,
|
||||
0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x77, 0x61, 0x69, 0x74, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x04, 0x77, 0x61, 0x69, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x72, 0x65, 0x61,
|
||||
0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52,
|
||||
0x0b, 0x72, 0x65, 0x61, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x0d,
|
||||
0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20,
|
||||
0x01, 0x28, 0x05, 0x52, 0x0c, 0x77, 0x72, 0x69, 0x74, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75,
|
||||
0x74, 0x12, 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x6f, 0x75, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x6e,
|
||||
0x65, 0x63, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x37, 0x0a, 0x18, 0x6e, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x6c, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x5f, 0x70, 0x6f, 0x6c, 0x6c, 0x5f,
|
||||
0x70, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x15, 0x6e, 0x6f,
|
||||
0x72, 0x6d, 0x61, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x50, 0x6f, 0x6c, 0x6c, 0x50, 0x65, 0x72,
|
||||
0x69, 0x6f, 0x64, 0x12, 0x39, 0x0a, 0x19, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x5f, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x73, 0x5f, 0x70, 0x6f, 0x6c, 0x6c, 0x5f, 0x70, 0x65, 0x72, 0x69, 0x6f, 0x64,
|
||||
0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, 0x16, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x73, 0x50, 0x6f, 0x6c, 0x6c, 0x50, 0x65, 0x72, 0x69, 0x6f, 0x64, 0x12, 0x2a,
|
||||
0x0a, 0x11, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x5f,
|
||||
0x6b, 0x65, 0x79, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x6c, 0x61, 0x79,
|
||||
0x65, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61,
|
||||
0x73, 0x74, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x0a, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x1a, 0xa1, 0x04, 0x0a, 0x04,
|
||||
0x41, 0x4d, 0x51, 0x50, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
|
||||
0x12, 0x23, 0x0a, 0x0d, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x74, 0x79, 0x70,
|
||||
0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x65, 0x78, 0x63, 0x68, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x5f, 0x0a, 0x12, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f, 0x64,
|
||||
0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e,
|
||||
0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x4d, 0x51, 0x50, 0x2e, 0x51,
|
||||
0x75, 0x65, 0x75, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x65, 0x41, 0x72, 0x67, 0x73, 0x45,
|
||||
0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x71, 0x75, 0x65, 0x75, 0x65, 0x44, 0x65, 0x63, 0x6c, 0x61,
|
||||
0x72, 0x65, 0x41, 0x72, 0x67, 0x73, 0x12, 0x5f, 0x0a, 0x12, 0x71, 0x75, 0x65, 0x75, 0x65, 0x5f,
|
||||
0x62, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x61, 0x72, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03,
|
||||
0x28, 0x0b, 0x32, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72,
|
||||
0x2e, 0x4d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x2e, 0x41, 0x4d, 0x51, 0x50, 0x2e,
|
||||
0x51, 0x75, 0x65, 0x75, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x67, 0x73,
|
||||
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x71, 0x75, 0x65, 0x75, 0x65, 0x42, 0x69, 0x6e, 0x64,
|
||||
0x69, 0x6e, 0x67, 0x41, 0x72, 0x67, 0x73, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x69, 0x6e, 0x64, 0x69,
|
||||
0x6e, 0x67, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x69,
|
||||
0x6e, 0x64, 0x69, 0x6e, 0x67, 0x4b, 0x65, 0x79, 0x12, 0x25, 0x0a, 0x0e, 0x70, 0x72, 0x65, 0x66,
|
||||
0x65, 0x74, 0x63, 0x68, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05,
|
||||
0x52, 0x0d, 0x70, 0x72, 0x65, 0x66, 0x65, 0x74, 0x63, 0x68, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12,
|
||||
0x1f, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x07,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x6f, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65,
|
||||
0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64, 0x5f, 0x71, 0x75, 0x65, 0x75,
|
||||
0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x6c, 0x61, 0x79, 0x65, 0x64,
|
||||
0x51, 0x75, 0x65, 0x75, 0x65, 0x1a, 0x43, 0x0a, 0x15, 0x51, 0x75, 0x65, 0x75, 0x65, 0x44, 0x65,
|
||||
0x63, 0x6c, 0x61, 0x72, 0x65, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10,
|
||||
0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x43, 0x0a, 0x15, 0x51, 0x75,
|
||||
0x65, 0x75, 0x65, 0x42, 0x69, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x41, 0x72, 0x67, 0x73, 0x45, 0x6e,
|
||||
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
|
||||
0xa2, 0x01, 0x0a, 0x03, 0x53, 0x51, 0x53, 0x12, 0x39, 0x0a, 0x19, 0x72, 0x65, 0x63, 0x65, 0x69,
|
||||
0x76, 0x65, 0x5f, 0x77, 0x61, 0x69, 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x5f, 0x73, 0x65, 0x63,
|
||||
0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x16, 0x72, 0x65, 0x63, 0x65,
|
||||
0x69, 0x76, 0x65, 0x57, 0x61, 0x69, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x65, 0x63, 0x6f, 0x6e,
|
||||
0x64, 0x73, 0x12, 0x41, 0x0a, 0x1a, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x76, 0x69,
|
||||
0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x48, 0x00, 0x52, 0x18, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76,
|
||||
0x65, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x54, 0x69, 0x6d, 0x65, 0x6f,
|
||||
0x75, 0x74, 0x88, 0x01, 0x01, 0x42, 0x1d, 0x0a, 0x1b, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76,
|
||||
0x65, 0x5f, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x5f, 0x74, 0x69, 0x6d,
|
||||
0x65, 0x6f, 0x75, 0x74, 0x1a, 0x45, 0x0a, 0x03, 0x47, 0x43, 0x50, 0x12, 0x3e, 0x0a, 0x0d, 0x6d,
|
||||
0x61, 0x78, 0x5f, 0x65, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x6d,
|
||||
0x61, 0x78, 0x45, 0x78, 0x74, 0x65, 0x6e, 0x73, 0x69, 0x6f, 0x6e, 0x1a, 0x25, 0x0a, 0x07, 0x4d,
|
||||
0x6f, 0x6e, 0x67, 0x6f, 0x44, 0x42, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,
|
||||
0x73, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61,
|
||||
0x73, 0x65, 0x1a, 0x62, 0x0a, 0x08, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x6f, 0x44, 0x42, 0x12, 0x2a,
|
||||
0x0a, 0x11, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x73, 0x5f, 0x74, 0x61,
|
||||
0x62, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x61, 0x73, 0x6b, 0x53,
|
||||
0x74, 0x61, 0x74, 0x65, 0x73, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x2a, 0x0a, 0x11, 0x67, 0x72,
|
||||
0x6f, 0x75, 0x70, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x73, 0x5f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x18,
|
||||
0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x73, 0x54, 0x61, 0x62, 0x6c, 0x65, 0x1a, 0xeb, 0x02, 0x0a, 0x03, 0x53, 0x53, 0x45, 0x12, 0x18,
|
||||
0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68,
|
||||
0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x05, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03,
|
||||
0x74, 0x6c, 0x73, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x0a,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
|
||||
0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x65, 0x76, 0x65, 0x6e,
|
||||
0x74, 0x5f, 0x74, 0x74, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x08, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x54, 0x74, 0x6c,
|
||||
0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x18,
|
||||
0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x61, 0x75, 0x74, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x61,
|
||||
0x6d, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x6f, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x18,
|
||||
0x15, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x61, 0x75, 0x74, 0x6f, 0x52, 0x65, 0x70, 0x6c, 0x79,
|
||||
0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x16,
|
||||
0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x70, 0x6c, 0x69, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12,
|
||||
0x23, 0x0a, 0x0d, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x36, 0x34,
|
||||
0x18, 0x17, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0c, 0x65, 0x6e, 0x63, 0x6f, 0x64, 0x65, 0x42, 0x61,
|
||||
0x73, 0x65, 0x36, 0x34, 0x1a, 0x7f, 0x0a, 0x08, 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x49, 0x4f,
|
||||
0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64,
|
||||
0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x12,
|
||||
0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61,
|
||||
0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18,
|
||||
0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53,
|
||||
0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0xce, 0x02, 0x0a, 0x07, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x6c,
|
||||
0x52, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61,
|
||||
0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12,
|
||||
0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
|
||||
0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74,
|
||||
0x6c, 0x73, 0x12, 0x49, 0x0a, 0x13, 0x6b, 0x65, 0x65, 0x70, 0x5f, 0x61, 0x6c, 0x69, 0x76, 0x65,
|
||||
0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
|
||||
0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x11, 0x6b, 0x65, 0x65, 0x70,
|
||||
0x41, 0x6c, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x76, 0x61, 0x6c, 0x12, 0x4b, 0x0a,
|
||||
0x14, 0x63, 0x68, 0x61, 0x6e, 0x5f, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x5f, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x12, 0x63, 0x68, 0x61, 0x6e, 0x52, 0x65, 0x63, 0x65,
|
||||
0x69, 0x76, 0x65, 0x54, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x64, 0x65,
|
||||
0x62, 0x75, 0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x64, 0x65, 0x62, 0x75, 0x67,
|
||||
0x12, 0x34, 0x0a, 0x16, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x62, 0x75, 0x66, 0x66, 0x65,
|
||||
0x72, 0x5f, 0x63, 0x61, 0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0d,
|
||||
0x52, 0x14, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x43, 0x61,
|
||||
0x70, 0x61, 0x63, 0x69, 0x74, 0x79, 0x1a, 0xd6, 0x01, 0x0a, 0x07, 0x47, 0x72, 0x61, 0x70, 0x68,
|
||||
0x51, 0x4c, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04,
|
||||
0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72,
|
||||
0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04,
|
||||
0x70, 0x61, 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x18, 0x04, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x05, 0x63, 0x6f, 0x64, 0x65, 0x63, 0x12, 0x33, 0x0a, 0x07, 0x74, 0x69,
|
||||
0x6d, 0x65, 0x6f, 0x75, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75,
|
||||
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x07, 0x74, 0x69, 0x6d, 0x65, 0x6f, 0x75, 0x74, 0x12,
|
||||
0x21, 0x0a, 0x0c, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x5f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x18,
|
||||
0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x73, 0x74, 0x72, 0x69, 0x63, 0x74, 0x53, 0x6c, 0x61,
|
||||
0x73, 0x68, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a,
|
||||
0xc4, 0x01, 0x0a, 0x06, 0x54, 0x68, 0x72, 0x69, 0x66, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65,
|
||||
0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74,
|
||||
0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x65, 0x64,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x62, 0x75, 0x66, 0x66, 0x65, 0x72, 0x65, 0x64,
|
||||
0x12, 0x16, 0x0a, 0x06, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08,
|
||||
0x52, 0x06, 0x66, 0x72, 0x61, 0x6d, 0x65, 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, 0x66, 0x66,
|
||||
0x65, 0x72, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x62,
|
||||
0x75, 0x66, 0x66, 0x65, 0x72, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c,
|
||||
0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x1a, 0x56, 0x0a, 0x09, 0x4b, 0x65, 0x65, 0x70, 0x41, 0x6c,
|
||||
0x69, 0x76, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x12, 0x12, 0x0a,
|
||||
0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64,
|
||||
0x72, 0x12, 0x1b, 0x0a, 0x03, 0x74, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x52, 0x03, 0x74, 0x6c, 0x73, 0x42, 0x07,
|
||||
0x0a, 0x05, 0x5f, 0x72, 0x65, 0x73, 0x74, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x67, 0x72, 0x70, 0x63,
|
||||
0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x67, 0x72, 0x61, 0x70, 0x68, 0x71, 0x6c, 0x42, 0x09, 0x0a, 0x07,
|
||||
0x5f, 0x74, 0x68, 0x72, 0x69, 0x66, 0x74, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6b, 0x65, 0x65, 0x70,
|
||||
0x61, 0x6c, 0x69, 0x76, 0x65, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6d, 0x71, 0x74, 0x74, 0x42, 0x08,
|
||||
0x0a, 0x06, 0x5f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x61, 0x62,
|
||||
0x62, 0x69, 0x74, 0x6d, 0x71, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65,
|
||||
0x6d, 0x71, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x6e, 0x61, 0x74, 0x73, 0x42, 0x06, 0x0a, 0x04, 0x5f,
|
||||
0x6e, 0x73, 0x71, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x70, 0x75, 0x6c, 0x73, 0x61, 0x72, 0x42, 0x08,
|
||||
0x0a, 0x06, 0x5f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x72, 0x6f, 0x63,
|
||||
0x6b, 0x65, 0x74, 0x6d, 0x71, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x77, 0x65, 0x62, 0x73, 0x6f, 0x63,
|
||||
0x6b, 0x65, 0x74, 0x42, 0x06, 0x0a, 0x04, 0x5f, 0x73, 0x73, 0x65, 0x42, 0x0b, 0x0a, 0x09, 0x5f,
|
||||
0x73, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x69, 0x6f, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x73, 0x69, 0x67,
|
||||
0x6e, 0x61, 0x6c, 0x72, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x61, 0x73, 0x79, 0x6e, 0x71, 0x42, 0x0c,
|
||||
0x0a, 0x0a, 0x5f, 0x6d, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x65, 0x72, 0x79, 0x42, 0x87, 0x01, 0x0a,
|
||||
0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15, 0x4b, 0x72, 0x61, 0x74, 0x6f,
|
||||
0x73, 0x43, 0x6f, 0x6e, 0x66, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x50, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74,
|
||||
0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74,
|
||||
0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x58, 0x58, 0xaa, 0x02,
|
||||
0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xe2, 0x02, 0x10, 0x43,
|
||||
0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea,
|
||||
0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_server_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" conf/v1/kratos_conf_server.proto\x12\x04conf\x1a\x1egoogle/protobuf/duration.proto\x1a$conf/v1/kratos_conf_middleware.proto\x1a\x1dconf/v1/kratos_conf_tls.proto\"\xec=\n" +
|
||||
"\x06Server\x12*\n" +
|
||||
"\x04rest\x18\x01 \x01(\v2\x11.conf.Server.RESTH\x00R\x04rest\x88\x01\x01\x12*\n" +
|
||||
"\x04grpc\x18\x02 \x01(\v2\x11.conf.Server.GRPCH\x01R\x04grpc\x88\x01\x01\x123\n" +
|
||||
"\agraphql\x18\x03 \x01(\v2\x14.conf.Server.GraphQLH\x02R\agraphql\x88\x01\x01\x120\n" +
|
||||
"\x06thrift\x18\x04 \x01(\v2\x13.conf.Server.ThriftH\x03R\x06thrift\x88\x01\x01\x129\n" +
|
||||
"\tkeepalive\x18\x05 \x01(\v2\x16.conf.Server.KeepAliveH\x04R\tkeepalive\x88\x01\x01\x12*\n" +
|
||||
"\x04mqtt\x18\n" +
|
||||
" \x01(\v2\x11.conf.Server.MqttH\x05R\x04mqtt\x88\x01\x01\x12-\n" +
|
||||
"\x05kafka\x18\v \x01(\v2\x12.conf.Server.KafkaH\x06R\x05kafka\x88\x01\x01\x126\n" +
|
||||
"\brabbitmq\x18\f \x01(\v2\x15.conf.Server.RabbitMQH\aR\brabbitmq\x88\x01\x01\x126\n" +
|
||||
"\bactivemq\x18\r \x01(\v2\x15.conf.Server.ActiveMQH\bR\bactivemq\x88\x01\x01\x12*\n" +
|
||||
"\x04nats\x18\x0e \x01(\v2\x11.conf.Server.NATSH\tR\x04nats\x88\x01\x01\x12'\n" +
|
||||
"\x03nsq\x18\x0f \x01(\v2\x10.conf.Server.NSQH\n" +
|
||||
"R\x03nsq\x88\x01\x01\x120\n" +
|
||||
"\x06pulsar\x18\x10 \x01(\v2\x13.conf.Server.PulsarH\vR\x06pulsar\x88\x01\x01\x12-\n" +
|
||||
"\x05redis\x18\x11 \x01(\v2\x12.conf.Server.RedisH\fR\x05redis\x88\x01\x01\x126\n" +
|
||||
"\brocketmq\x18\x12 \x01(\v2\x15.conf.Server.RocketMQH\rR\brocketmq\x88\x01\x01\x129\n" +
|
||||
"\twebsocket\x18\x14 \x01(\v2\x16.conf.Server.WebsocketH\x0eR\twebsocket\x88\x01\x01\x12'\n" +
|
||||
"\x03sse\x18\x15 \x01(\v2\x10.conf.Server.SSEH\x0fR\x03sse\x88\x01\x01\x126\n" +
|
||||
"\bsocketio\x18\x16 \x01(\v2\x15.conf.Server.SocketIOH\x10R\bsocketio\x88\x01\x01\x123\n" +
|
||||
"\asignalr\x18\x17 \x01(\v2\x14.conf.Server.SignalRH\x11R\asignalr\x88\x01\x01\x12-\n" +
|
||||
"\x05asynq\x18\x1e \x01(\v2\x12.conf.Server.AsynqH\x12R\x05asynq\x88\x01\x01\x129\n" +
|
||||
"\tmachinery\x18\x1f \x01(\v2\x16.conf.Server.MachineryH\x13R\tmachinery\x88\x01\x01\x1a\x84\x03\n" +
|
||||
"\x04REST\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x123\n" +
|
||||
"\atimeout\x18\x03 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12*\n" +
|
||||
"\x04cors\x18\n" +
|
||||
" \x01(\v2\x16.conf.Server.REST.CORSR\x04cors\x120\n" +
|
||||
"\n" +
|
||||
"middleware\x18\v \x01(\v2\x10.conf.MiddlewareR\n" +
|
||||
"middleware\x12\x1b\n" +
|
||||
"\x03tls\x18\f \x01(\v2\t.conf.TLSR\x03tls\x12%\n" +
|
||||
"\x0eenable_swagger\x18\x14 \x01(\bR\renableSwagger\x12!\n" +
|
||||
"\fenable_pprof\x18\x15 \x01(\bR\venablePprof\x1aT\n" +
|
||||
"\x04CORS\x12\x18\n" +
|
||||
"\aheaders\x18\x01 \x03(\tR\aheaders\x12\x18\n" +
|
||||
"\amethods\x18\x02 \x03(\tR\amethods\x12\x18\n" +
|
||||
"\aorigins\x18\x03 \x03(\tR\aorigins\x1a\xb8\x01\n" +
|
||||
"\x04GRPC\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x123\n" +
|
||||
"\atimeout\x18\x03 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x120\n" +
|
||||
"\n" +
|
||||
"middleware\x18\x04 \x01(\v2\x10.conf.MiddlewareR\n" +
|
||||
"middleware\x12\x1b\n" +
|
||||
"\x03tls\x18\x05 \x01(\v2\t.conf.TLSR\x03tls\x1a\xb5\x01\n" +
|
||||
"\tWebsocket\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x12\x12\n" +
|
||||
"\x04path\x18\x03 \x01(\tR\x04path\x12\x14\n" +
|
||||
"\x05codec\x18\x04 \x01(\tR\x05codec\x123\n" +
|
||||
"\atimeout\x18\x05 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12\x1b\n" +
|
||||
"\x03tls\x18\x06 \x01(\v2\t.conf.TLSR\x03tls\x1a\xcf\x01\n" +
|
||||
"\x04Mqtt\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x12\x1a\n" +
|
||||
"\busername\x18\x04 \x01(\tR\busername\x12\x1a\n" +
|
||||
"\bpassword\x18\x05 \x01(\tR\bpassword\x12\x1b\n" +
|
||||
"\tclient_id\x18\x06 \x01(\tR\bclientId\x12#\n" +
|
||||
"\rclean_session\x18\a \x01(\bR\fcleanSession\x1aX\n" +
|
||||
"\x05Kafka\x12\x1c\n" +
|
||||
"\tendpoints\x18\x01 \x03(\tR\tendpoints\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1a[\n" +
|
||||
"\bRabbitMQ\x12\x1c\n" +
|
||||
"\tendpoints\x18\x01 \x03(\tR\tendpoints\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1aY\n" +
|
||||
"\bActiveMQ\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1aU\n" +
|
||||
"\x04NATS\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1aT\n" +
|
||||
"\x03NSQ\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1aW\n" +
|
||||
"\x06Pulsar\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1aV\n" +
|
||||
"\x05Redis\x12\x1a\n" +
|
||||
"\bendpoint\x18\x01 \x01(\tR\bendpoint\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tls\x1a\x92\x03\n" +
|
||||
"\bRocketMQ\x12\x18\n" +
|
||||
"\aversion\x18\x01 \x01(\tR\aversion\x12\x14\n" +
|
||||
"\x05codec\x18\x02 \x01(\tR\x05codec\x12!\n" +
|
||||
"\fname_servers\x18\x03 \x03(\tR\vnameServers\x12,\n" +
|
||||
"\x12name_server_domain\x18\x04 \x01(\tR\x10nameServerDomain\x12\x1d\n" +
|
||||
"\n" +
|
||||
"access_key\x18\x05 \x01(\tR\taccessKey\x12\x1d\n" +
|
||||
"\n" +
|
||||
"secret_key\x18\x06 \x01(\tR\tsecretKey\x12%\n" +
|
||||
"\x0esecurity_token\x18\a \x01(\tR\rsecurityToken\x12\x1c\n" +
|
||||
"\tnamespace\x18\b \x01(\tR\tnamespace\x12#\n" +
|
||||
"\rinstance_name\x18\t \x01(\tR\finstanceName\x12\x1d\n" +
|
||||
"\n" +
|
||||
"group_name\x18\n" +
|
||||
" \x01(\tR\tgroupName\x12\x1b\n" +
|
||||
"\x03tls\x18\v \x01(\v2\t.conf.TLSR\x03tls\x12!\n" +
|
||||
"\fenable_trace\x18d \x01(\bR\venableTrace\x1a\xcd\b\n" +
|
||||
"\x05Asynq\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x1a\n" +
|
||||
"\bendpoint\x18\x02 \x01(\tR\bendpoint\x12\x1a\n" +
|
||||
"\bpassword\x18\x03 \x01(\tR\bpassword\x12\x0e\n" +
|
||||
"\x02db\x18\x04 \x01(\x05R\x02db\x12\x10\n" +
|
||||
"\x03uri\x18\x05 \x01(\tR\x03uri\x12\x1b\n" +
|
||||
"\tpool_size\x18\x06 \x01(\x05R\bpoolSize\x12\x1b\n" +
|
||||
"\x03tls\x18\a \x01(\v2\t.conf.TLSR\x03tls\x12\x14\n" +
|
||||
"\x05codec\x18\b \x01(\tR\x05codec\x12\x1a\n" +
|
||||
"\blocation\x18\n" +
|
||||
" \x01(\tR\blocation\x12 \n" +
|
||||
"\vconcurrency\x18\v \x01(\x05R\vconcurrency\x12$\n" +
|
||||
"\x0egroup_max_size\x18\f \x01(\x05R\fgroupMaxSize\x126\n" +
|
||||
"\x06queues\x18\r \x03(\v2\x1e.conf.Server.Asynq.QueuesEntryR\x06queues\x12<\n" +
|
||||
"\x1aenable_gracefully_shutdown\x18\x14 \x01(\bR\x18enableGracefullyShutdown\x124\n" +
|
||||
"\x16enable_strict_priority\x18\x15 \x01(\bR\x14enableStrictPriority\x12D\n" +
|
||||
"\x10shutdown_timeout\x18\x1e \x01(\v2\x19.google.protobuf.DurationR\x0fshutdownTimeout\x12<\n" +
|
||||
"\fdial_timeout\x18\x1f \x01(\v2\x19.google.protobuf.DurationR\vdialTimeout\x12<\n" +
|
||||
"\fread_timeout\x18 \x01(\v2\x19.google.protobuf.DurationR\vreadTimeout\x12>\n" +
|
||||
"\rwrite_timeout\x18! \x01(\v2\x19.google.protobuf.DurationR\fwriteTimeout\x12M\n" +
|
||||
"\x15health_check_interval\x18\" \x01(\v2\x19.google.protobuf.DurationR\x13healthCheckInterval\x12X\n" +
|
||||
"\x1bdelayed_task_check_interval\x18# \x01(\v2\x19.google.protobuf.DurationR\x18delayedTaskCheckInterval\x12G\n" +
|
||||
"\x12group_grace_period\x18$ \x01(\v2\x19.google.protobuf.DurationR\x10groupGracePeriod\x12A\n" +
|
||||
"\x0fgroup_max_delay\x18% \x01(\v2\x19.google.protobuf.DurationR\rgroupMaxDelay\x1a9\n" +
|
||||
"\vQueuesEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\x05R\x05value:\x028\x01\x1a\xbc\x11\n" +
|
||||
"\tMachinery\x12\x1f\n" +
|
||||
"\vbroker_type\x18\x01 \x01(\tR\n" +
|
||||
"brokerType\x12\x1f\n" +
|
||||
"\vbroker_addr\x18\x02 \x01(\tR\n" +
|
||||
"brokerAddr\x12\x1b\n" +
|
||||
"\tbroker_db\x18\x03 \x01(\x05R\bbrokerDb\x12!\n" +
|
||||
"\fbackend_type\x18\n" +
|
||||
" \x01(\tR\vbackendType\x12!\n" +
|
||||
"\fbackend_addr\x18\v \x01(\tR\vbackendAddr\x12\x1d\n" +
|
||||
"\n" +
|
||||
"backend_db\x18\f \x01(\x05R\tbackendDb\x12\x1b\n" +
|
||||
"\tlock_type\x18\x14 \x01(\tR\blockType\x12\x1b\n" +
|
||||
"\tlock_addr\x18\x15 \x01(\tR\blockAddr\x12\x17\n" +
|
||||
"\alock_db\x18\x16 \x01(\x05R\x06lockDb\x12!\n" +
|
||||
"\fconsumer_tag\x18\x1e \x01(\tR\vconsumerTag\x121\n" +
|
||||
"\x14consumer_concurrency\x18\x1f \x01(\x05R\x13consumerConcurrency\x12%\n" +
|
||||
"\x0econsumer_queue\x18 \x01(\tR\rconsumerQueue\x12\x1b\n" +
|
||||
"\x03tls\x182 \x01(\v2\t.conf.TLSR\x03tls\x12#\n" +
|
||||
"\rdefault_queue\x183 \x01(\tR\fdefaultQueue\x12*\n" +
|
||||
"\x11results_expire_in\x184 \x01(\x05R\x0fresultsExpireIn\x12&\n" +
|
||||
"\x0fno_unix_signals\x185 \x01(\bR\rnoUnixSignals\x122\n" +
|
||||
"\x05redis\x18d \x01(\v2\x1c.conf.Server.Machinery.RedisR\x05redis\x12/\n" +
|
||||
"\x04amqp\x18e \x01(\v2\x1b.conf.Server.Machinery.AMQPR\x04amqp\x12,\n" +
|
||||
"\x03sqs\x18f \x01(\v2\x1a.conf.Server.Machinery.SQSR\x03sqs\x12,\n" +
|
||||
"\x03gcp\x18g \x01(\v2\x1a.conf.Server.Machinery.GCPR\x03gcp\x128\n" +
|
||||
"\amongodb\x18h \x01(\v2\x1e.conf.Server.Machinery.MongoDBR\amongodb\x12;\n" +
|
||||
"\bdynamodb\x18i \x01(\v2\x1f.conf.Server.Machinery.DynamoDBR\bdynamodb\x1a\xb1\x03\n" +
|
||||
"\x05Redis\x12\x19\n" +
|
||||
"\bmax_idle\x18\x01 \x01(\x05R\amaxIdle\x12\x1d\n" +
|
||||
"\n" +
|
||||
"max_active\x18\x02 \x01(\x05R\tmaxActive\x12(\n" +
|
||||
"\x10max_idle_timeout\x18\x03 \x01(\x05R\x0emaxIdleTimeout\x12\x12\n" +
|
||||
"\x04wait\x18\x04 \x01(\bR\x04wait\x12!\n" +
|
||||
"\fread_timeout\x18\x05 \x01(\x05R\vreadTimeout\x12#\n" +
|
||||
"\rwrite_timeout\x18\x06 \x01(\x05R\fwriteTimeout\x12'\n" +
|
||||
"\x0fconnect_timeout\x18\a \x01(\x05R\x0econnectTimeout\x127\n" +
|
||||
"\x18normal_tasks_poll_period\x18\b \x01(\x05R\x15normalTasksPollPeriod\x129\n" +
|
||||
"\x19delayed_tasks_poll_period\x18\t \x01(\x05R\x16delayedTasksPollPeriod\x12*\n" +
|
||||
"\x11delayed_tasks_key\x18\n" +
|
||||
" \x01(\tR\x0fdelayedTasksKey\x12\x1f\n" +
|
||||
"\vmaster_name\x18\v \x01(\tR\n" +
|
||||
"masterName\x1a\xa1\x04\n" +
|
||||
"\x04AMQP\x12\x1a\n" +
|
||||
"\bexchange\x18\x01 \x01(\tR\bexchange\x12#\n" +
|
||||
"\rexchange_type\x18\x02 \x01(\tR\fexchangeType\x12_\n" +
|
||||
"\x12queue_declare_args\x18\x03 \x03(\v21.conf.Server.Machinery.AMQP.QueueDeclareArgsEntryR\x10queueDeclareArgs\x12_\n" +
|
||||
"\x12queue_binding_args\x18\x04 \x03(\v21.conf.Server.Machinery.AMQP.QueueBindingArgsEntryR\x10queueBindingArgs\x12\x1f\n" +
|
||||
"\vbinding_key\x18\x05 \x01(\tR\n" +
|
||||
"bindingKey\x12%\n" +
|
||||
"\x0eprefetch_count\x18\x06 \x01(\x05R\rprefetchCount\x12\x1f\n" +
|
||||
"\vauto_delete\x18\a \x01(\bR\n" +
|
||||
"autoDelete\x12#\n" +
|
||||
"\rdelayed_queue\x18\b \x01(\tR\fdelayedQueue\x1aC\n" +
|
||||
"\x15QueueDeclareArgsEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1aC\n" +
|
||||
"\x15QueueBindingArgsEntry\x12\x10\n" +
|
||||
"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +
|
||||
"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\x1a\xa2\x01\n" +
|
||||
"\x03SQS\x129\n" +
|
||||
"\x19receive_wait_time_seconds\x18\x01 \x01(\x05R\x16receiveWaitTimeSeconds\x12A\n" +
|
||||
"\x1areceive_visibility_timeout\x18\x02 \x01(\x05H\x00R\x18receiveVisibilityTimeout\x88\x01\x01B\x1d\n" +
|
||||
"\x1b_receive_visibility_timeout\x1aE\n" +
|
||||
"\x03GCP\x12>\n" +
|
||||
"\rmax_extension\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\fmaxExtension\x1a%\n" +
|
||||
"\aMongoDB\x12\x1a\n" +
|
||||
"\bdatabase\x18\x01 \x01(\tR\bdatabase\x1ab\n" +
|
||||
"\bDynamoDB\x12*\n" +
|
||||
"\x11task_states_table\x18\x01 \x01(\tR\x0ftaskStatesTable\x12*\n" +
|
||||
"\x11group_metas_table\x18\x02 \x01(\tR\x0fgroupMetasTable\x1a\xeb\x02\n" +
|
||||
"\x03SSE\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x12\x12\n" +
|
||||
"\x04path\x18\x03 \x01(\tR\x04path\x12\x14\n" +
|
||||
"\x05codec\x18\x04 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x05 \x01(\v2\t.conf.TLSR\x03tls\x123\n" +
|
||||
"\atimeout\x18\n" +
|
||||
" \x01(\v2\x19.google.protobuf.DurationR\atimeout\x126\n" +
|
||||
"\tevent_ttl\x18\v \x01(\v2\x19.google.protobuf.DurationR\beventTtl\x12\x1f\n" +
|
||||
"\vauto_stream\x18\x14 \x01(\bR\n" +
|
||||
"autoStream\x12\x1d\n" +
|
||||
"\n" +
|
||||
"auto_reply\x18\x15 \x01(\bR\tautoReply\x12\x1d\n" +
|
||||
"\n" +
|
||||
"split_data\x18\x16 \x01(\bR\tsplitData\x12#\n" +
|
||||
"\rencode_base64\x18\x17 \x01(\bR\fencodeBase64\x1a\x7f\n" +
|
||||
"\bSocketIO\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x12\x12\n" +
|
||||
"\x04path\x18\x03 \x01(\tR\x04path\x12\x14\n" +
|
||||
"\x05codec\x18\x04 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x05 \x01(\v2\t.conf.TLSR\x03tls\x1a\xce\x02\n" +
|
||||
"\aSignalR\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x12\x14\n" +
|
||||
"\x05codec\x18\x03 \x01(\tR\x05codec\x12\x1b\n" +
|
||||
"\x03tls\x18\x04 \x01(\v2\t.conf.TLSR\x03tls\x12I\n" +
|
||||
"\x13keep_alive_interval\x18\n" +
|
||||
" \x01(\v2\x19.google.protobuf.DurationR\x11keepAliveInterval\x12K\n" +
|
||||
"\x14chan_receive_timeout\x18\v \x01(\v2\x19.google.protobuf.DurationR\x12chanReceiveTimeout\x12\x14\n" +
|
||||
"\x05debug\x18\x06 \x01(\bR\x05debug\x124\n" +
|
||||
"\x16stream_buffer_capacity\x18\a \x01(\rR\x14streamBufferCapacity\x1a\xd6\x01\n" +
|
||||
"\aGraphQL\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x12\x12\n" +
|
||||
"\x04path\x18\x03 \x01(\tR\x04path\x12\x14\n" +
|
||||
"\x05codec\x18\x04 \x01(\tR\x05codec\x123\n" +
|
||||
"\atimeout\x18\x05 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12!\n" +
|
||||
"\fstrict_slash\x18\x06 \x01(\bR\vstrictSlash\x12\x1b\n" +
|
||||
"\x03tls\x18\a \x01(\v2\t.conf.TLSR\x03tls\x1a\xc4\x01\n" +
|
||||
"\x06Thrift\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x12\x1a\n" +
|
||||
"\bprotocol\x18\x03 \x01(\tR\bprotocol\x12\x1a\n" +
|
||||
"\bbuffered\x18\x04 \x01(\bR\bbuffered\x12\x16\n" +
|
||||
"\x06framed\x18\x05 \x01(\bR\x06framed\x12\x1f\n" +
|
||||
"\vbuffer_size\x18\x06 \x01(\bR\n" +
|
||||
"bufferSize\x12\x1b\n" +
|
||||
"\x03tls\x18\a \x01(\v2\t.conf.TLSR\x03tls\x1aV\n" +
|
||||
"\tKeepAlive\x12\x18\n" +
|
||||
"\anetwork\x18\x01 \x01(\tR\anetwork\x12\x12\n" +
|
||||
"\x04addr\x18\x02 \x01(\tR\x04addr\x12\x1b\n" +
|
||||
"\x03tls\x18\x03 \x01(\v2\t.conf.TLSR\x03tlsB\a\n" +
|
||||
"\x05_restB\a\n" +
|
||||
"\x05_grpcB\n" +
|
||||
"\n" +
|
||||
"\b_graphqlB\t\n" +
|
||||
"\a_thriftB\f\n" +
|
||||
"\n" +
|
||||
"_keepaliveB\a\n" +
|
||||
"\x05_mqttB\b\n" +
|
||||
"\x06_kafkaB\v\n" +
|
||||
"\t_rabbitmqB\v\n" +
|
||||
"\t_activemqB\a\n" +
|
||||
"\x05_natsB\x06\n" +
|
||||
"\x04_nsqB\t\n" +
|
||||
"\a_pulsarB\b\n" +
|
||||
"\x06_redisB\v\n" +
|
||||
"\t_rocketmqB\f\n" +
|
||||
"\n" +
|
||||
"_websocketB\x06\n" +
|
||||
"\x04_sseB\v\n" +
|
||||
"\t_socketioB\n" +
|
||||
"\n" +
|
||||
"\b_signalrB\b\n" +
|
||||
"\x06_asynqB\f\n" +
|
||||
"\n" +
|
||||
"_machineryB\x87\x01\n" +
|
||||
"\bcom.confB\x15KratosConfServerProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_server_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_tls.proto
|
||||
|
||||
@@ -204,48 +204,33 @@ func (x *TLS_Config) GetCaPem() []byte {
|
||||
|
||||
var File_conf_v1_kratos_conf_tls_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_tls_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x1d, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x6c, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12,
|
||||
0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0xbc, 0x03, 0x0a, 0x03, 0x54, 0x4c, 0x53, 0x12, 0x27, 0x0a,
|
||||
0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x2e, 0x54, 0x4c, 0x53, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x48, 0x00, 0x52, 0x04, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x88, 0x01, 0x01, 0x12, 0x2d, 0x0a, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2e, 0x54, 0x4c,
|
||||
0x53, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x01, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x88, 0x01, 0x01, 0x12, 0x30, 0x0a, 0x14, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
|
||||
0x65, 0x5f, 0x73, 0x6b, 0x69, 0x70, 0x5f, 0x76, 0x65, 0x72, 0x69, 0x66, 0x79, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x08, 0x52, 0x12, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72, 0x65, 0x53, 0x6b, 0x69,
|
||||
0x70, 0x56, 0x65, 0x72, 0x69, 0x66, 0x79, 0x1a, 0x8d, 0x01, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65,
|
||||
0x12, 0x20, 0x0a, 0x09, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x08, 0x63, 0x65, 0x72, 0x74, 0x50, 0x61, 0x74, 0x68, 0x88,
|
||||
0x01, 0x01, 0x12, 0x1e, 0x0a, 0x08, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x09, 0x48, 0x01, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x50, 0x61, 0x74, 0x68, 0x88,
|
||||
0x01, 0x01, 0x12, 0x1c, 0x0a, 0x07, 0x63, 0x61, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20,
|
||||
0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x06, 0x63, 0x61, 0x50, 0x61, 0x74, 0x68, 0x88, 0x01, 0x01,
|
||||
0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x42, 0x0b,
|
||||
0x0a, 0x09, 0x5f, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x42, 0x0a, 0x0a, 0x08, 0x5f,
|
||||
0x63, 0x61, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x1a, 0x86, 0x01, 0x0a, 0x06, 0x43, 0x6f, 0x6e, 0x66,
|
||||
0x69, 0x67, 0x12, 0x1e, 0x0a, 0x08, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x6d, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, 0x07, 0x63, 0x65, 0x72, 0x74, 0x50, 0x65, 0x6d, 0x88,
|
||||
0x01, 0x01, 0x12, 0x1c, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x5f, 0x70, 0x65, 0x6d, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x48, 0x01, 0x52, 0x06, 0x6b, 0x65, 0x79, 0x50, 0x65, 0x6d, 0x88, 0x01, 0x01,
|
||||
0x12, 0x1a, 0x0a, 0x06, 0x63, 0x61, 0x5f, 0x70, 0x65, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x48, 0x02, 0x52, 0x05, 0x63, 0x61, 0x50, 0x65, 0x6d, 0x88, 0x01, 0x01, 0x42, 0x0b, 0x0a, 0x09,
|
||||
0x5f, 0x63, 0x65, 0x72, 0x74, 0x5f, 0x70, 0x65, 0x6d, 0x42, 0x0a, 0x0a, 0x08, 0x5f, 0x6b, 0x65,
|
||||
0x79, 0x5f, 0x70, 0x65, 0x6d, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x61, 0x5f, 0x70, 0x65, 0x6d,
|
||||
0x42, 0x07, 0x0a, 0x05, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x5f, 0x63, 0x6f,
|
||||
0x6e, 0x66, 0x69, 0x67, 0x42, 0x84, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x66, 0x42, 0x12, 0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x54, 0x6c, 0x73,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67,
|
||||
0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03,
|
||||
0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_tls_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1dconf/v1/kratos_conf_tls.proto\x12\x04conf\"\xbc\x03\n" +
|
||||
"\x03TLS\x12'\n" +
|
||||
"\x04file\x18\x01 \x01(\v2\x0e.conf.TLS.FileH\x00R\x04file\x88\x01\x01\x12-\n" +
|
||||
"\x06config\x18\x02 \x01(\v2\x10.conf.TLS.ConfigH\x01R\x06config\x88\x01\x01\x120\n" +
|
||||
"\x14insecure_skip_verify\x18\x03 \x01(\bR\x12insecureSkipVerify\x1a\x8d\x01\n" +
|
||||
"\x04File\x12 \n" +
|
||||
"\tcert_path\x18\x01 \x01(\tH\x00R\bcertPath\x88\x01\x01\x12\x1e\n" +
|
||||
"\bkey_path\x18\x02 \x01(\tH\x01R\akeyPath\x88\x01\x01\x12\x1c\n" +
|
||||
"\aca_path\x18\x03 \x01(\tH\x02R\x06caPath\x88\x01\x01B\f\n" +
|
||||
"\n" +
|
||||
"_cert_pathB\v\n" +
|
||||
"\t_key_pathB\n" +
|
||||
"\n" +
|
||||
"\b_ca_path\x1a\x86\x01\n" +
|
||||
"\x06Config\x12\x1e\n" +
|
||||
"\bcert_pem\x18\x01 \x01(\fH\x00R\acertPem\x88\x01\x01\x12\x1c\n" +
|
||||
"\akey_pem\x18\x02 \x01(\fH\x01R\x06keyPem\x88\x01\x01\x12\x1a\n" +
|
||||
"\x06ca_pem\x18\x03 \x01(\fH\x02R\x05caPem\x88\x01\x01B\v\n" +
|
||||
"\t_cert_pemB\n" +
|
||||
"\n" +
|
||||
"\b_key_pemB\t\n" +
|
||||
"\a_ca_pemB\a\n" +
|
||||
"\x05_fileB\t\n" +
|
||||
"\a_configB\x84\x01\n" +
|
||||
"\bcom.confB\x12KratosConfTlsProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_tls_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: conf/v1/kratos_conf_tracer.proto
|
||||
|
||||
@@ -100,29 +100,16 @@ func (x *Tracer) GetInsecure() bool {
|
||||
|
||||
var File_conf_v1_kratos_conf_tracer_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_conf_v1_kratos_conf_tracer_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x12, 0x04, 0x63, 0x6f, 0x6e, 0x66, 0x22, 0x86, 0x01, 0x0a, 0x06, 0x54, 0x72, 0x61,
|
||||
0x63, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x62, 0x61, 0x74, 0x63, 0x68, 0x65, 0x72, 0x12, 0x1a, 0x0a,
|
||||
0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||
0x08, 0x65, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x61, 0x6d,
|
||||
0x70, 0x6c, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x52, 0x07, 0x73, 0x61, 0x6d, 0x70,
|
||||
0x6c, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x03, 0x65, 0x6e, 0x76, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
|
||||
0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, 0x63, 0x75, 0x72,
|
||||
0x65, 0x42, 0x87, 0x01, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x42, 0x15,
|
||||
0x4b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x43, 0x6f, 0x6e, 0x66, 0x54, 0x72, 0x61, 0x63, 0x65, 0x72,
|
||||
0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73,
|
||||
0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74, 0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67,
|
||||
0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03,
|
||||
0x43, 0x58, 0x58, 0xaa, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0xca, 0x02, 0x04, 0x43, 0x6f, 0x6e,
|
||||
0x66, 0xe2, 0x02, 0x10, 0x43, 0x6f, 0x6e, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61,
|
||||
0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x04, 0x43, 0x6f, 0x6e, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_conf_v1_kratos_conf_tracer_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" conf/v1/kratos_conf_tracer.proto\x12\x04conf\"\x86\x01\n" +
|
||||
"\x06Tracer\x12\x18\n" +
|
||||
"\abatcher\x18\x01 \x01(\tR\abatcher\x12\x1a\n" +
|
||||
"\bendpoint\x18\x02 \x01(\tR\bendpoint\x12\x18\n" +
|
||||
"\asampler\x18\x03 \x01(\x01R\asampler\x12\x10\n" +
|
||||
"\x03env\x18\x04 \x01(\tR\x03env\x12\x1a\n" +
|
||||
"\binsecure\x18\x05 \x01(\bR\binsecureB\x87\x01\n" +
|
||||
"\bcom.confB\x15KratosConfTracerProtoP\x01Z4github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1\xa2\x02\x03CXX\xaa\x02\x04Conf\xca\x02\x04Conf\xe2\x02\x10Conf\\GPBMetadata\xea\x02\x04Confb\x06proto3"
|
||||
|
||||
var (
|
||||
file_conf_v1_kratos_conf_tracer_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.5
|
||||
// protoc-gen-go v1.36.6
|
||||
// protoc (unknown)
|
||||
// source: pagination/v1/pagination.proto
|
||||
|
||||
@@ -188,104 +188,37 @@ func (x *PagingResponse) GetItems() [][]byte {
|
||||
|
||||
var File_pagination_v1_pagination_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_pagination_v1_pagination_proto_rawDesc = string([]byte{
|
||||
0x0a, 0x1e, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0x2f,
|
||||
0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x12, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x20, 0x67, 0x6f,
|
||||
0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69,
|
||||
0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x24,
|
||||
0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x61, 0x70, 0x69, 0x2f,
|
||||
0x76, 0x33, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x09, 0x0a, 0x0d, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x05, 0x42, 0x1e, 0xba, 0x47, 0x1b, 0x8a, 0x02, 0x09, 0x09, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf0, 0x3f, 0x92, 0x02, 0x0c, 0xe5, 0xbd, 0x93, 0xe5, 0x89, 0x8d, 0xe9, 0xa1,
|
||||
0xb5, 0xe7, 0xa0, 0x81, 0x48, 0x00, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x88, 0x01, 0x01, 0x12,
|
||||
0x46, 0x0a, 0x09, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01,
|
||||
0x28, 0x05, 0x42, 0x24, 0xba, 0x47, 0x21, 0x8a, 0x02, 0x09, 0x09, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x24, 0x40, 0x92, 0x02, 0x12, 0xe6, 0xaf, 0x8f, 0xe4, 0xb8, 0x80, 0xe9, 0xa1, 0xb5, 0xe7,
|
||||
0x9a, 0x84, 0xe8, 0xa1, 0x8c, 0xe6, 0x95, 0xb0, 0x48, 0x01, 0x52, 0x08, 0x70, 0x61, 0x67, 0x65,
|
||||
0x53, 0x69, 0x7a, 0x65, 0x88, 0x01, 0x01, 0x12, 0xf5, 0x01, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0xd9, 0x01, 0xba, 0x47, 0xd5, 0x01, 0x3a, 0x1f,
|
||||
0x12, 0x1d, 0x7b, 0x22, 0x6b, 0x65, 0x79, 0x31, 0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x31, 0x22,
|
||||
0x2c, 0x22, 0x6b, 0x65, 0x79, 0x32, 0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x32, 0x22, 0x7d, 0x92,
|
||||
0x02, 0xb0, 0x01, 0x41, 0x4e, 0x44, 0xe8, 0xbf, 0x87, 0xe6, 0xbb, 0xa4, 0xe5, 0x8f, 0x82, 0xe6,
|
||||
0x95, 0xb0, 0xef, 0xbc, 0x8c, 0xe5, 0x85, 0xb6, 0xe8, 0xaf, 0xad, 0xe6, 0xb3, 0x95, 0xe4, 0xb8,
|
||||
0xba, 0x6a, 0x73, 0x6f, 0x6e, 0xe6, 0xa0, 0xbc, 0xe5, 0xbc, 0x8f, 0xe7, 0x9a, 0x84, 0xe5, 0xad,
|
||||
0x97, 0xe7, 0xac, 0xa6, 0xe4, 0xb8, 0xb2, 0xef, 0xbc, 0x8c, 0xe5, 0xa6, 0x82, 0xef, 0xbc, 0x9a,
|
||||
0x7b, 0x22, 0x6b, 0x65, 0x79, 0x31, 0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x31, 0x22, 0x2c, 0x22,
|
||||
0x6b, 0x65, 0x79, 0x32, 0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x32, 0x22, 0x7d, 0xef, 0xbc, 0x8c,
|
||||
0xe5, 0x85, 0xb7, 0xe4, 0xbd, 0x93, 0xe8, 0xaf, 0xb7, 0xe5, 0x8f, 0x82, 0xe8, 0xa7, 0x81, 0xef,
|
||||
0xbc, 0x9a, 0x68, 0x74, 0x74, 0x70, 0x73, 0x3a, 0x2f, 0x2f, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37, 0x64, 0x6f, 0x2f, 0x67, 0x6f, 0x2d, 0x75, 0x74,
|
||||
0x69, 0x6c, 0x73, 0x2f, 0x74, 0x72, 0x65, 0x65, 0x2f, 0x6d, 0x61, 0x69, 0x6e, 0x2f, 0x65, 0x6e,
|
||||
0x74, 0x67, 0x6f, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2f, 0x52, 0x45, 0x41, 0x44, 0x4d, 0x45,
|
||||
0x2e, 0x6d, 0x64, 0x48, 0x02, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x88, 0x01, 0x01, 0x12,
|
||||
0x50, 0x0a, 0x08, 0x6f, 0x72, 0x5f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28,
|
||||
0x09, 0x42, 0x35, 0xba, 0x47, 0x32, 0x3a, 0x1f, 0x12, 0x1d, 0x7b, 0x22, 0x6b, 0x65, 0x79, 0x31,
|
||||
0x22, 0x3a, 0x22, 0x76, 0x61, 0x6c, 0x31, 0x22, 0x2c, 0x22, 0x6b, 0x65, 0x79, 0x32, 0x22, 0x3a,
|
||||
0x22, 0x76, 0x61, 0x6c, 0x32, 0x22, 0x7d, 0x92, 0x02, 0x0e, 0x4f, 0x52, 0xe8, 0xbf, 0x87, 0xe6,
|
||||
0xbb, 0xa4, 0xe5, 0x8f, 0x82, 0xe6, 0x95, 0xb0, 0x48, 0x03, 0x52, 0x02, 0x6f, 0x72, 0x88, 0x01,
|
||||
0x01, 0x12, 0xb0, 0x01, 0x0a, 0x08, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x18, 0x05,
|
||||
0x20, 0x03, 0x28, 0x09, 0x42, 0x94, 0x01, 0xba, 0x47, 0x90, 0x01, 0x3a, 0x13, 0x12, 0x11, 0x7b,
|
||||
0x22, 0x76, 0x61, 0x6c, 0x31, 0x22, 0x2c, 0x20, 0x22, 0x2d, 0x76, 0x61, 0x6c, 0x32, 0x22, 0x7d,
|
||||
0x92, 0x02, 0x78, 0xe6, 0x8e, 0x92, 0xe5, 0xba, 0x8f, 0xe6, 0x9d, 0xa1, 0xe4, 0xbb, 0xb6, 0xef,
|
||||
0xbc, 0x8c, 0xe5, 0x85, 0xb6, 0xe8, 0xaf, 0xad, 0xe6, 0xb3, 0x95, 0xe4, 0xb8, 0xba, 0x4a, 0x53,
|
||||
0x4f, 0x4e, 0xe5, 0xad, 0x97, 0xe7, 0xac, 0xa6, 0xe4, 0xb8, 0xb2, 0xef, 0xbc, 0x8c, 0xe4, 0xbe,
|
||||
0x8b, 0xe5, 0xa6, 0x82, 0xef, 0xbc, 0x9a, 0x7b, 0x22, 0x76, 0x61, 0x6c, 0x31, 0x22, 0x2c, 0x20,
|
||||
0x22, 0x2d, 0x76, 0x61, 0x6c, 0x32, 0x22, 0x7d, 0xe3, 0x80, 0x82, 0xe5, 0xad, 0x97, 0xe6, 0xae,
|
||||
0xb5, 0xe5, 0x90, 0x8d, 0xe5, 0x89, 0x8d, 0xe5, 0x8a, 0xa0, 0x27, 0x2d, 0x27, 0xe4, 0xb8, 0xba,
|
||||
0xe9, 0x99, 0x8d, 0xe5, 0xba, 0x8f, 0xef, 0xbc, 0x8c, 0xe5, 0x90, 0xa6, 0xe5, 0x88, 0x99, 0xe4,
|
||||
0xb8, 0xba, 0xe5, 0x8d, 0x87, 0xe5, 0xba, 0x8f, 0xe3, 0x80, 0x82, 0x52, 0x07, 0x6f, 0x72, 0x64,
|
||||
0x65, 0x72, 0x42, 0x79, 0x12, 0x6b, 0x0a, 0x09, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x67, 0x69, 0x6e,
|
||||
0x67, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x42, 0x49, 0xba, 0x47, 0x46, 0x92, 0x02, 0x43, 0xe6,
|
||||
0x98, 0xaf, 0xe5, 0x90, 0xa6, 0xe4, 0xb8, 0x8d, 0xe5, 0x88, 0x86, 0xe9, 0xa1, 0xb5, 0xef, 0xbc,
|
||||
0x8c, 0xe5, 0xa6, 0x82, 0xe6, 0x9e, 0x9c, 0xe4, 0xb8, 0xba, 0x74, 0x72, 0x75, 0x65, 0xef, 0xbc,
|
||||
0x8c, 0xe5, 0x88, 0x99, 0x70, 0x61, 0x67, 0x65, 0xe5, 0x92, 0x8c, 0x70, 0x61, 0x67, 0x65, 0x53,
|
||||
0x69, 0x7a, 0x65, 0xe5, 0x8f, 0x82, 0xe6, 0x95, 0xb0, 0xe6, 0x97, 0xa0, 0xe6, 0x95, 0x88, 0xe3,
|
||||
0x80, 0x82, 0x48, 0x04, 0x52, 0x08, 0x6e, 0x6f, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x88, 0x01,
|
||||
0x01, 0x12, 0x8d, 0x02, 0x0a, 0x0a, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b,
|
||||
0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61,
|
||||
0x73, 0x6b, 0x42, 0xcc, 0x01, 0xba, 0x47, 0xc8, 0x01, 0x3a, 0x16, 0x12, 0x14, 0x69, 0x64, 0x2c,
|
||||
0x72, 0x65, 0x61, 0x6c, 0x4e, 0x61, 0x6d, 0x65, 0x2c, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d,
|
||||
0x65, 0x92, 0x02, 0xac, 0x01, 0xe5, 0xad, 0x97, 0xe6, 0xae, 0xb5, 0xe6, 0x8e, 0xa9, 0xe7, 0xa0,
|
||||
0x81, 0xef, 0xbc, 0x8c, 0xe5, 0x85, 0xb6, 0xe4, 0xbd, 0x9c, 0xe7, 0x94, 0xa8, 0xe4, 0xb8, 0xba,
|
||||
0x53, 0x45, 0x4c, 0x45, 0x43, 0x54, 0xe4, 0xb8, 0xad, 0xe7, 0x9a, 0x84, 0xe5, 0xad, 0x97, 0xe6,
|
||||
0xae, 0xb5, 0xef, 0xbc, 0x8c, 0xe5, 0x85, 0xb6, 0xe8, 0xaf, 0xad, 0xe6, 0xb3, 0x95, 0xe4, 0xb8,
|
||||
0xba, 0xe4, 0xbd, 0xbf, 0xe7, 0x94, 0xa8, 0xe9, 0x80, 0x97, 0xe5, 0x8f, 0xb7, 0xe5, 0x88, 0x86,
|
||||
0xe9, 0x9a, 0x94, 0xe5, 0xad, 0x97, 0xe6, 0xae, 0xb5, 0xe5, 0x90, 0x8d, 0xef, 0xbc, 0x8c, 0xe4,
|
||||
0xbe, 0x8b, 0xe5, 0xa6, 0x82, 0xef, 0xbc, 0x9a, 0x69, 0x64, 0x2c, 0x72, 0x65, 0x61, 0x6c, 0x4e,
|
||||
0x61, 0x6d, 0x65, 0x2c, 0x75, 0x73, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0xe3, 0x80, 0x82, 0xe5,
|
||||
0xa6, 0x82, 0xe6, 0x9e, 0x9c, 0xe4, 0xb8, 0xba, 0xe7, 0xa9, 0xba, 0xe5, 0x88, 0x99, 0xe9, 0x80,
|
||||
0x89, 0xe4, 0xb8, 0xad, 0xe6, 0x89, 0x80, 0xe6, 0x9c, 0x89, 0xe5, 0xad, 0x97, 0xe6, 0xae, 0xb5,
|
||||
0xef, 0xbc, 0x8c, 0xe5, 0x8d, 0xb3, 0x53, 0x45, 0x4c, 0x45, 0x43, 0x54, 0x20, 0x2a, 0xe3, 0x80,
|
||||
0x82, 0x48, 0x05, 0x52, 0x09, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, 0x6b, 0x88, 0x01,
|
||||
0x01, 0x12, 0x30, 0x0a, 0x09, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x08,
|
||||
0x20, 0x01, 0x28, 0x0d, 0x42, 0x0e, 0xba, 0x47, 0x0b, 0x92, 0x02, 0x08, 0xe7, 0xa7, 0x9f, 0xe6,
|
||||
0x88, 0xb7, 0x49, 0x44, 0x48, 0x06, 0x52, 0x08, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x49, 0x64,
|
||||
0x88, 0x01, 0x01, 0x42, 0x07, 0x0a, 0x05, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x42, 0x0c, 0x0a, 0x0a,
|
||||
0x5f, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x42, 0x08, 0x0a, 0x06, 0x5f, 0x71,
|
||||
0x75, 0x65, 0x72, 0x79, 0x42, 0x0b, 0x0a, 0x09, 0x5f, 0x6f, 0x72, 0x5f, 0x71, 0x75, 0x65, 0x72,
|
||||
0x79, 0x42, 0x0c, 0x0a, 0x0a, 0x5f, 0x6e, 0x6f, 0x5f, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x42,
|
||||
0x0d, 0x0a, 0x0b, 0x5f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x42, 0x0c,
|
||||
0x0a, 0x0a, 0x5f, 0x74, 0x65, 0x6e, 0x61, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x22, 0x3c, 0x0a, 0x0e,
|
||||
0x50, 0x61, 0x67, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14,
|
||||
0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74,
|
||||
0x6f, 0x74, 0x61, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x02, 0x20,
|
||||
0x03, 0x28, 0x0c, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x42, 0xa5, 0x01, 0x0a, 0x0e, 0x63,
|
||||
0x6f, 0x6d, 0x2e, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x0f, 0x50,
|
||||
0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
|
||||
0x5a, 0x3a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x74, 0x78, 0x37,
|
||||
0x64, 0x6f, 0x2f, 0x6b, 0x72, 0x61, 0x74, 0x6f, 0x73, 0x2d, 0x62, 0x6f, 0x6f, 0x74, 0x73, 0x74,
|
||||
0x72, 0x61, 0x70, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x67, 0x6f, 0x2f, 0x70,
|
||||
0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2f, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x50,
|
||||
0x58, 0x58, 0xaa, 0x02, 0x0a, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xca,
|
||||
0x02, 0x0a, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0xe2, 0x02, 0x16, 0x50,
|
||||
0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74,
|
||||
0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0a, 0x50, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69,
|
||||
0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
})
|
||||
const file_pagination_v1_pagination_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x1epagination/v1/pagination.proto\x12\n" +
|
||||
"pagination\x1a google/protobuf/field_mask.proto\x1a$gnostic/openapi/v3/annotations.proto\"\x95\t\n" +
|
||||
"\rPagingRequest\x127\n" +
|
||||
"\x04page\x18\x01 \x01(\x05B\x1e\xbaG\x1b\x8a\x02\t\t\x00\x00\x00\x00\x00\x00\xf0?\x92\x02\f当前页码H\x00R\x04page\x88\x01\x01\x12F\n" +
|
||||
"\tpage_size\x18\x02 \x01(\x05B$\xbaG!\x8a\x02\t\t\x00\x00\x00\x00\x00\x00$@\x92\x02\x12每一页的行数H\x01R\bpageSize\x88\x01\x01\x12\xf5\x01\n" +
|
||||
"\x05query\x18\x03 \x01(\tB\xd9\x01\xbaG\xd5\x01:\x1f\x12\x1d{\"key1\":\"val1\",\"key2\":\"val2\"}\x92\x02\xb0\x01AND过滤参数,其语法为json格式的字符串,如:{\"key1\":\"val1\",\"key2\":\"val2\"},具体请参见:https://github.com/tx7do/go-utils/tree/main/entgo/query/README.mdH\x02R\x05query\x88\x01\x01\x12P\n" +
|
||||
"\bor_query\x18\x04 \x01(\tB5\xbaG2:\x1f\x12\x1d{\"key1\":\"val1\",\"key2\":\"val2\"}\x92\x02\x0eOR过滤参数H\x03R\x02or\x88\x01\x01\x12\xb0\x01\n" +
|
||||
"\border_by\x18\x05 \x03(\tB\x94\x01\xbaG\x90\x01:\x13\x12\x11{\"val1\", \"-val2\"}\x92\x02x排序条件,其语法为JSON字符串,例如:{\"val1\", \"-val2\"}。字段名前加'-'为降序,否则为升序。R\aorderBy\x12k\n" +
|
||||
"\tno_paging\x18\x06 \x01(\bBI\xbaGF\x92\x02C是否不分页,如果为true,则page和pageSize参数无效。H\x04R\bnoPaging\x88\x01\x01\x12\x8d\x02\n" +
|
||||
"\n" +
|
||||
"field_mask\x18\a \x01(\v2\x1a.google.protobuf.FieldMaskB\xcc\x01\xbaG\xc8\x01:\x16\x12\x14id,realName,userName\x92\x02\xac\x01字段掩码,其作用为SELECT中的字段,其语法为使用逗号分隔字段名,例如:id,realName,userName。如果为空则选中所有字段,即SELECT *。H\x05R\tfieldMask\x88\x01\x01\x120\n" +
|
||||
"\ttenant_id\x18\b \x01(\rB\x0e\xbaG\v\x92\x02\b租户IDH\x06R\btenantId\x88\x01\x01B\a\n" +
|
||||
"\x05_pageB\f\n" +
|
||||
"\n" +
|
||||
"_page_sizeB\b\n" +
|
||||
"\x06_queryB\v\n" +
|
||||
"\t_or_queryB\f\n" +
|
||||
"\n" +
|
||||
"_no_pagingB\r\n" +
|
||||
"\v_field_maskB\f\n" +
|
||||
"\n" +
|
||||
"_tenant_id\"<\n" +
|
||||
"\x0ePagingResponse\x12\x14\n" +
|
||||
"\x05total\x18\x01 \x01(\x05R\x05total\x12\x14\n" +
|
||||
"\x05items\x18\x02 \x03(\fR\x05itemsB\xa5\x01\n" +
|
||||
"\x0ecom.paginationB\x0fPaginationProtoP\x01Z:github.com/tx7do/kratos-bootstrap/api/gen/go/pagination/v1\xa2\x02\x03PXX\xaa\x02\n" +
|
||||
"Pagination\xca\x02\n" +
|
||||
"Pagination\xe2\x02\x16Pagination\\GPBMetadata\xea\x02\n" +
|
||||
"Paginationb\x06proto3"
|
||||
|
||||
var (
|
||||
file_pagination_v1_pagination_proto_rawDescOnce sync.Once
|
||||
|
||||
@@ -14,6 +14,19 @@ message Authentication {
|
||||
string key = 2; // JWT 秘钥
|
||||
}
|
||||
|
||||
message OIDC {
|
||||
string issuer_url = 1;
|
||||
string audience = 2;
|
||||
string method = 3; // JWT签名的算法,支持算法:HS256
|
||||
}
|
||||
|
||||
optional Jwt jwt = 1;
|
||||
message PresharedKey {
|
||||
repeated string valid_keys = 1;
|
||||
}
|
||||
|
||||
string type = 1;
|
||||
|
||||
optional Jwt jwt = 2; // JWT 认证
|
||||
optional OIDC oidc = 3; // OIDC
|
||||
optional PresharedKey preshared_key = 4; // 预共享密钥
|
||||
}
|
||||
|
||||
@@ -8,4 +8,46 @@ import "google/protobuf/duration.proto";
|
||||
|
||||
// 授权
|
||||
message Authorization {
|
||||
message Casbin {
|
||||
optional string model_path = 1; // casbin 模型文件路径
|
||||
optional string policy_path = 2; // casbin 策略文件路径
|
||||
|
||||
repeated string policies = 10; // 策略列表
|
||||
optional string model = 11; // 模型内容
|
||||
}
|
||||
|
||||
message OPA {
|
||||
message RoleActions {
|
||||
repeated string actions = 1; // 角色对应的操作列表 {
|
||||
}
|
||||
|
||||
map<string, string> policies = 1; // OPA 策略列表
|
||||
map<string, RoleActions> roles = 2; //
|
||||
}
|
||||
|
||||
message Zanzibar {
|
||||
message Keto {
|
||||
string write_url = 1; // 写入 URL
|
||||
string read_url = 2; // 读取 URL
|
||||
bool use_grpc = 3; // 是否使用 gRPC
|
||||
}
|
||||
|
||||
message OpenFga {
|
||||
string api_url = 1; // OpenFGA API URL
|
||||
string store_id = 2; // OpenFGA 存储 ID
|
||||
string token = 3; // OpenFGA 访问令牌
|
||||
string client_id = 4; // OpenFGA 客户端 ID
|
||||
}
|
||||
|
||||
string type = 1; // zanzibar 类型
|
||||
|
||||
optional Keto keto = 2; // Keto 配置
|
||||
optional OpenFga open_fga = 3; // OpenFGA 配置
|
||||
}
|
||||
|
||||
string type = 1;
|
||||
|
||||
Casbin casbin = 2; // casbin
|
||||
OPA opa = 3; // OPA
|
||||
Zanzibar zanzibar = 4; // zanzibar
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@ message RemoteConfig {
|
||||
string address = 1; // 服务端地址
|
||||
uint64 port = 2; // 服务端端口
|
||||
string key = 3; // 配置键
|
||||
string username = 4; // 用户名
|
||||
string password = 5; // 密码
|
||||
string namespace_id = 6; // 命名空间ID
|
||||
}
|
||||
|
||||
message Etcd {
|
||||
|
||||
@@ -36,50 +36,89 @@ message Data {
|
||||
string password = 3; // 密码
|
||||
int32 db = 4; // 数据库索引
|
||||
|
||||
google.protobuf.Duration dial_timeout = 5; // 连接超时时间
|
||||
google.protobuf.Duration read_timeout = 6; // 读取超时时间
|
||||
google.protobuf.Duration write_timeout = 7; // 写入超时时间
|
||||
google.protobuf.Duration dial_timeout = 50; // 连接超时时间
|
||||
google.protobuf.Duration read_timeout = 51; // 读取超时时间
|
||||
google.protobuf.Duration write_timeout = 52; // 写入超时时间
|
||||
|
||||
bool enable_tracing = 8; // 打开链路追踪
|
||||
bool enable_metrics = 9; // 打开性能度量
|
||||
bool enable_tracing = 100; // 打开链路追踪
|
||||
bool enable_metrics = 1001; // 打开性能度量
|
||||
}
|
||||
|
||||
// MongoDB
|
||||
message MongoDB {
|
||||
string address = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
string uri = 1;
|
||||
|
||||
optional string database = 2;
|
||||
|
||||
optional string username = 10;
|
||||
optional string password = 11;
|
||||
|
||||
optional string auth_mechanism = 20; // 认证机制:SCRAM-SHA-1、SCRAM-SHA-256、MONGODB-X509、GSSAPI、PLAIN
|
||||
map<string, string> auth_mechanism_properties = 21; // 认证机制属性
|
||||
optional string auth_source = 22; // 认证源:admin、$external等
|
||||
|
||||
google.protobuf.Duration connect_timeout = 50; // 连接超时时间
|
||||
google.protobuf.Duration heartbeat_interval = 51; // 心跳间隔
|
||||
google.protobuf.Duration local_threshold = 52; // 本地延迟阈值
|
||||
google.protobuf.Duration max_conn_idle_time = 53; // 最大连接空闲时间
|
||||
google.protobuf.Duration max_staleness = 54; // 最大陈旧时间
|
||||
google.protobuf.Duration server_selection_timeout = 55; // 服务器选择超时时间
|
||||
google.protobuf.Duration socket_timeout = 56; // 套接字超时时间
|
||||
google.protobuf.Duration timeout = 57; // 总超时时间
|
||||
|
||||
bool enable_tracing = 100; // 打开链路追踪
|
||||
bool enable_metrics = 101; // 打开性能度量
|
||||
}
|
||||
|
||||
// ClickHouse
|
||||
message ClickHouse {
|
||||
string address = 1;
|
||||
string database = 2;
|
||||
string username = 3;
|
||||
string password = 4;
|
||||
bool debug = 5;
|
||||
string compression_method = 6;
|
||||
google.protobuf.Duration dial_timeout = 7;
|
||||
int32 max_execution_time = 8;
|
||||
int32 max_open_conns = 9;
|
||||
int32 max_idle_conns = 10;
|
||||
google.protobuf.Duration conn_max_life_time = 11;
|
||||
int32 block_buffer_size = 12;
|
||||
int32 max_compression_buffer = 13;
|
||||
string conn_open_strategy = 14;
|
||||
int32 max_idle_connections = 15; // 连接池最大空闲连接数
|
||||
int32 max_open_connections = 16; // 连接池最大打开连接数
|
||||
google.protobuf.Duration connection_max_lifetime = 17; // 连接可重用的最大时间长度
|
||||
string protocol = 18;
|
||||
TLS tls = 19; // TLS配置
|
||||
repeated string addresses = 1; // 对端网络地址
|
||||
|
||||
optional string database = 2; // 数据库名
|
||||
optional string username = 3; // 用户名
|
||||
optional string password = 4; // 密码
|
||||
|
||||
optional bool debug = 5; // 调试开关
|
||||
optional string scheme = 6; // 协议:http、https、native
|
||||
|
||||
optional TLS tls = 7; // TLS配置
|
||||
|
||||
optional int32 block_buffer_size = 8; // 数据块缓冲区大小
|
||||
|
||||
optional string compression_method = 10; // 压缩方法:zstd、lz4、lz4hc、gzip、deflate、br、none
|
||||
optional int32 compression_level = 11; // 压缩级别:0-9
|
||||
optional int32 max_compression_buffer = 12; // 最大压缩缓冲区大小
|
||||
|
||||
optional string connection_open_strategy = 20; // 连接打开策略:in_order、round_robin、random
|
||||
|
||||
optional google.protobuf.Duration dial_timeout = 30; // 连接超时时间
|
||||
optional google.protobuf.Duration read_timeout = 31; // 读取超时时间
|
||||
optional google.protobuf.Duration conn_max_lifetime = 32; // 连接可重用的最大时间长度
|
||||
|
||||
optional int32 max_idle_conns = 40; // 连接池最大空闲连接数
|
||||
optional int32 max_open_conns = 41; // 连接池最大打开连接数
|
||||
|
||||
optional string dsn = 50; // 数据源名称(DSN字符串)
|
||||
|
||||
optional string http_proxy = 60; // HTTP代理地址
|
||||
|
||||
optional bool enable_tracing = 100; // 打开链路追踪
|
||||
optional bool enable_metrics = 101; // 打开性能度量
|
||||
}
|
||||
|
||||
// InfluxDB
|
||||
message InfluxDB {
|
||||
string address = 1;
|
||||
string token = 2;
|
||||
string organization = 3;
|
||||
string bucket = 4;
|
||||
string host = 1; // 主机地址
|
||||
string token = 2; // 认证令牌
|
||||
string auth_scheme = 3; // 认证方案:default、basic
|
||||
string proxy = 4; // 代理地址
|
||||
|
||||
string organization = 10; // 组织名
|
||||
string database = 11; // 数据库名
|
||||
|
||||
google.protobuf.Duration timeout = 20; // 连接超时时间
|
||||
google.protobuf.Duration idle_connection_timeout = 21; // 空闲连接超时时间
|
||||
int32 max_idle_connections = 22; // 连接池最大空闲连接数
|
||||
}
|
||||
|
||||
message Doris {
|
||||
@@ -88,11 +127,31 @@ message Data {
|
||||
|
||||
message ElasticSearch {
|
||||
repeated string addresses = 1;
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
bool enable_sniffer = 4;
|
||||
bool enable_gzip = 5;
|
||||
google.protobuf.Duration health_check_interval = 6;
|
||||
|
||||
string username = 10;
|
||||
string password = 11;
|
||||
|
||||
string cloud_id = 20;
|
||||
string api_key = 21;
|
||||
string service_token = 22;
|
||||
string certificate_fingerprint = 23;
|
||||
|
||||
bool disable_retry = 30;
|
||||
int32 max_retries = 31;
|
||||
|
||||
bool compress_request_body = 40;
|
||||
int32 compress_request_body_level = 41;
|
||||
bool pool_compressor = 42;
|
||||
|
||||
bool discover_nodes_on_start = 50;
|
||||
google.protobuf.Duration discover_nodes_interval = 51;
|
||||
|
||||
bool enable_metrics = 60;
|
||||
bool enable_debug_logger = 61;
|
||||
bool enable_compatibility_mode = 62;
|
||||
bool disable_meta_header = 63;
|
||||
|
||||
TLS tls = 70; // TLS配置
|
||||
}
|
||||
|
||||
message Cassandra {
|
||||
@@ -100,11 +159,14 @@ message Data {
|
||||
string username = 2;
|
||||
string password = 3;
|
||||
string keyspace = 5;
|
||||
|
||||
google.protobuf.Duration connect_timeout = 6;
|
||||
google.protobuf.Duration timeout = 7;
|
||||
uint32 consistency = 8;
|
||||
|
||||
bool disable_initial_host_lookup = 9;
|
||||
bool ignore_peer_addr = 10;
|
||||
|
||||
TLS tls = 11; // TLS配置
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ message Logger {
|
||||
string timestamp_format = 3; // 定义时间戳格式,例如:"2006-01-02 15:04:05"
|
||||
bool disable_colors = 4; // 不需要彩色日志
|
||||
bool disable_timestamp = 5; // 不需要时间戳
|
||||
bool force_colors = 6; // 是否开启彩色日志
|
||||
}
|
||||
|
||||
// Fluent
|
||||
|
||||
8
cache/redis/go.mod
vendored
8
cache/redis/go.mod
vendored
@@ -8,9 +8,9 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.4
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0
|
||||
github.com/redis/go-redis/v9 v9.9.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.21
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0
|
||||
github.com/redis/go-redis/v9 v9.10.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.23
|
||||
)
|
||||
|
||||
require (
|
||||
@@ -18,7 +18,7 @@ require (
|
||||
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0 // indirect
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/otel v1.36.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.36.0 // indirect
|
||||
|
||||
12
cache/redis/go.sum
vendored
12
cache/redis/go.sum
vendored
@@ -19,12 +19,12 @@ github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0 h1:fhZTCKxHb3jlFYktf+ReLzEMrt58NHpmoZsky+8Xz3s=
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.9.0/go.mod h1:UmKU2NxlGJSED8CBkZftTpwke0Tg144MKAu/d/r4L0I=
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0 h1:trEhEKFu8qKSNl+7TRvUKcsoAEsPUsrO0HBf00mBSbg=
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.9.0/go.mod h1:gz3iYRb85Y8cXhuZKCvwZBH9rS+VS6ZCMItCRdMA+NU=
|
||||
github.com/redis/go-redis/v9 v9.9.0 h1:URbPQ4xVQSQhZ27WMQVmZSo3uT3pL+4IdHVcYq2nVfM=
|
||||
github.com/redis/go-redis/v9 v9.9.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0 h1:uTiEyEyfLhkw678n6EulHVto8AkcXVr8zUcBJNZ0ark=
|
||||
github.com/redis/go-redis/extra/rediscmd/v9 v9.10.0/go.mod h1:eFYL/99JvdLP4T9/3FZ5t2pClnv7mMskc+WstTcyVr4=
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0 h1:4z7/hCJ9Jft8EBb2tDmK38p2WjyIEJ1ShhhwAhjOCps=
|
||||
github.com/redis/go-redis/extra/redisotel/v9 v9.10.0/go.mod h1:B0thqLh4hB8MvvcUKSwyP5YiIcCCp8UrQ0cA9gEqyjk=
|
||||
github.com/redis/go-redis/v9 v9.10.0 h1:FxwK3eV8p/CQa0Ch276C7u2d0eNC9kCmAYQ7mCXCzVs=
|
||||
github.com/redis/go-redis/v9 v9.10.0/go.mod h1:huWgSWd8mW6+m0VPhJjSSQ+d6Nh1VICQ6Q5lHuCH/Iw=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
|
||||
12
cache/redis/redis.go
vendored
12
cache/redis/redis.go
vendored
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// NewClient create go-redis client
|
||||
func NewClient(conf *conf.Data) (rdb *redis.Client) {
|
||||
func NewClient(conf *conf.Data, logger *log.Helper) (rdb *redis.Client) {
|
||||
if rdb = redis.NewClient(&redis.Options{
|
||||
Addr: conf.GetRedis().GetAddr(),
|
||||
Password: conf.GetRedis().GetPassword(),
|
||||
@@ -19,23 +19,23 @@ func NewClient(conf *conf.Data) (rdb *redis.Client) {
|
||||
WriteTimeout: conf.GetRedis().GetWriteTimeout().AsDuration(),
|
||||
ReadTimeout: conf.GetRedis().GetReadTimeout().AsDuration(),
|
||||
}); rdb == nil {
|
||||
log.Fatalf("failed opening connection to redis")
|
||||
logger.Fatalf("failed opening connection to redis")
|
||||
return nil
|
||||
}
|
||||
|
||||
// open tracing instrumentation.
|
||||
if conf.GetRedis().GetEnableTracing() {
|
||||
if err := redisotel.InstrumentTracing(rdb); err != nil {
|
||||
log.Fatalf("failed open tracing: %s", err.Error())
|
||||
panic(err)
|
||||
logger.Fatalf("failed open tracing: %s", err.Error())
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
// open metrics instrumentation.
|
||||
if conf.GetRedis().GetEnableMetrics() {
|
||||
if err := redisotel.InstrumentMetrics(rdb); err != nil {
|
||||
log.Fatalf("failed open metrics: %s", err.Error())
|
||||
panic(err)
|
||||
logger.Fatalf("failed open metrics: %s", err.Error())
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
18
database/clickhouse/README.md
Normal file
18
database/clickhouse/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# ClickHouse
|
||||
|
||||
## Docker部署
|
||||
|
||||
```bash
|
||||
docker pull bitnami/clickhouse:latest
|
||||
|
||||
docker run -itd \
|
||||
--name clickhouse-server \
|
||||
--network=app-tier \
|
||||
-p 8123:8123 \
|
||||
-p 9000:9000 \
|
||||
-p 9004:9004 \
|
||||
-e ALLOW_EMPTY_PASSWORD=no \
|
||||
-e CLICKHOUSE_ADMIN_USER=default \
|
||||
-e CLICKHOUSE_ADMIN_PASSWORD=123456 \
|
||||
bitnami/clickhouse:latest
|
||||
```
|
||||
199
database/clickhouse/batch.go
Normal file
199
database/clickhouse/batch.go
Normal file
@@ -0,0 +1,199 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
clickhouseV2 "github.com/ClickHouse/clickhouse-go/v2"
|
||||
driverV2 "github.com/ClickHouse/clickhouse-go/v2/lib/driver"
|
||||
)
|
||||
|
||||
// BatchInserter 批量插入器
|
||||
type BatchInserter struct {
|
||||
conn clickhouseV2.Conn
|
||||
tableName string
|
||||
columns []string
|
||||
batchSize int
|
||||
rows []interface{}
|
||||
insertStmt string
|
||||
mu sync.Mutex
|
||||
ctx context.Context
|
||||
cancel context.CancelFunc
|
||||
}
|
||||
|
||||
// NewBatchInserter 创建新的批量插入器
|
||||
func NewBatchInserter(
|
||||
ctx context.Context,
|
||||
conn clickhouseV2.Conn,
|
||||
tableName string,
|
||||
batchSize int,
|
||||
columns []string,
|
||||
) (*BatchInserter, error) {
|
||||
if batchSize <= 0 {
|
||||
batchSize = 1000 // 默认批量大小
|
||||
}
|
||||
|
||||
if len(columns) == 0 {
|
||||
return nil, errors.New("必须指定列名")
|
||||
}
|
||||
|
||||
// 构建INSERT语句
|
||||
placeholders := make([]string, len(columns))
|
||||
for i := range placeholders {
|
||||
placeholders[i] = "?"
|
||||
}
|
||||
|
||||
insertStmt := fmt.Sprintf(
|
||||
"INSERT INTO %s (%s) VALUES (%s)",
|
||||
tableName,
|
||||
strings.Join(columns, ", "),
|
||||
strings.Join(placeholders, ", "),
|
||||
)
|
||||
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
|
||||
return &BatchInserter{
|
||||
conn: conn,
|
||||
tableName: tableName,
|
||||
columns: columns,
|
||||
batchSize: batchSize,
|
||||
rows: make([]interface{}, 0, batchSize),
|
||||
insertStmt: insertStmt,
|
||||
ctx: ctx,
|
||||
cancel: cancel,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Add 添加数据行
|
||||
func (bi *BatchInserter) Add(row interface{}) error {
|
||||
bi.mu.Lock()
|
||||
defer bi.mu.Unlock()
|
||||
|
||||
// 检查上下文是否已取消
|
||||
if bi.ctx.Err() != nil {
|
||||
return bi.ctx.Err()
|
||||
}
|
||||
|
||||
bi.rows = append(bi.rows, row)
|
||||
|
||||
// 达到批量大小时自动提交
|
||||
if len(bi.rows) >= bi.batchSize {
|
||||
return bi.flush()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Flush 强制提交当前批次
|
||||
func (bi *BatchInserter) Flush() error {
|
||||
bi.mu.Lock()
|
||||
defer bi.mu.Unlock()
|
||||
|
||||
return bi.flush()
|
||||
}
|
||||
|
||||
// Close 关闭插入器并提交剩余数据
|
||||
func (bi *BatchInserter) Close() error {
|
||||
defer bi.cancel()
|
||||
|
||||
bi.mu.Lock()
|
||||
defer bi.mu.Unlock()
|
||||
|
||||
return bi.flush()
|
||||
}
|
||||
|
||||
// flush 内部提交方法
|
||||
func (bi *BatchInserter) flush() error {
|
||||
if len(bi.rows) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 创建批量
|
||||
batch, err := bi.conn.PrepareBatch(bi.ctx, bi.insertStmt)
|
||||
if err != nil {
|
||||
return ErrBatchPrepareFailed
|
||||
}
|
||||
|
||||
// 添加所有行
|
||||
for _, row := range bi.rows {
|
||||
// 使用反射获取字段值
|
||||
if err = appendStructToBatch(batch, row, bi.columns); err != nil {
|
||||
return ErrBatchAppendFailed
|
||||
}
|
||||
}
|
||||
|
||||
// 提交批量
|
||||
if err = batch.Send(); err != nil {
|
||||
return ErrBatchSendFailed
|
||||
}
|
||||
|
||||
// 清空批次
|
||||
bi.rows = bi.rows[:0]
|
||||
return nil
|
||||
}
|
||||
|
||||
// appendStructToBatch 使用反射将结构体字段添加到批次
|
||||
func appendStructToBatch(batch driverV2.Batch, obj interface{}, columns []string) error {
|
||||
v := reflect.ValueOf(obj)
|
||||
|
||||
// 如果是指针,获取指针指向的值
|
||||
if v.Kind() == reflect.Ptr {
|
||||
if v.IsNil() {
|
||||
return errors.New("nil指针")
|
||||
}
|
||||
v = v.Elem()
|
||||
}
|
||||
|
||||
// 必须是结构体
|
||||
if v.Kind() != reflect.Struct {
|
||||
return fmt.Errorf("期望结构体类型,得到 %v", v.Kind())
|
||||
}
|
||||
|
||||
// 获取结构体类型
|
||||
t := v.Type()
|
||||
|
||||
// 准备参数值
|
||||
values := make([]interface{}, len(columns))
|
||||
|
||||
// 映射列名到结构体字段
|
||||
for i, col := range columns {
|
||||
// 查找匹配的字段
|
||||
found := false
|
||||
for j := 0; j < v.NumField(); j++ {
|
||||
field := t.Field(j)
|
||||
|
||||
// 检查ch标签
|
||||
if tag := field.Tag.Get("ch"); strings.TrimSpace(tag) == col {
|
||||
values[i] = v.Field(j).Interface()
|
||||
found = true
|
||||
break
|
||||
}
|
||||
|
||||
// 检查json标签
|
||||
jsonTags := strings.Split(field.Tag.Get("json"), ",")
|
||||
if len(jsonTags) > 0 && strings.TrimSpace(jsonTags[0]) == col {
|
||||
values[i] = v.Field(j).Interface()
|
||||
found = true
|
||||
break
|
||||
}
|
||||
|
||||
// 检查字段名
|
||||
if field.Name == col {
|
||||
values[i] = v.Field(j).Interface()
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
return fmt.Errorf("未找到列 %s 对应的结构体字段", col)
|
||||
}
|
||||
}
|
||||
|
||||
// 添加到批次
|
||||
return batch.Append(values...)
|
||||
}
|
||||
@@ -1,55 +1,632 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/ClickHouse/clickhouse-go/v2"
|
||||
clickhouseV2 "github.com/ClickHouse/clickhouse-go/v2"
|
||||
driverV2 "github.com/ClickHouse/clickhouse-go/v2/lib/driver"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"github.com/tx7do/kratos-bootstrap/utils"
|
||||
)
|
||||
|
||||
func NewClickHouseClient(cfg *conf.Bootstrap, l *log.Helper) clickhouse.Conn {
|
||||
type Creator func() any
|
||||
|
||||
var compressionMap = map[string]clickhouseV2.CompressionMethod{
|
||||
"none": clickhouseV2.CompressionNone,
|
||||
"zstd": clickhouseV2.CompressionZSTD,
|
||||
"lz4": clickhouseV2.CompressionLZ4,
|
||||
"lz4hc": clickhouseV2.CompressionLZ4HC,
|
||||
"gzip": clickhouseV2.CompressionGZIP,
|
||||
"deflate": clickhouseV2.CompressionDeflate,
|
||||
"br": clickhouseV2.CompressionBrotli,
|
||||
}
|
||||
|
||||
type Client struct {
|
||||
log *log.Helper
|
||||
|
||||
conn clickhouseV2.Conn
|
||||
db *sql.DB
|
||||
}
|
||||
|
||||
func NewClient(logger log.Logger, cfg *conf.Bootstrap) (*Client, error) {
|
||||
c := &Client{
|
||||
log: log.NewHelper(log.With(logger, "module", "clickhouse-client")),
|
||||
}
|
||||
|
||||
if err := c.createClickHouseClient(cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// createClickHouseClient 创建ClickHouse客户端
|
||||
func (c *Client) createClickHouseClient(cfg *conf.Bootstrap) error {
|
||||
if cfg.Data == nil || cfg.Data.Clickhouse == nil {
|
||||
l.Warn("ClickHouse config is nil")
|
||||
return nil
|
||||
}
|
||||
|
||||
options := &clickhouse.Options{
|
||||
Addr: []string{cfg.Data.Clickhouse.Address},
|
||||
Auth: clickhouse.Auth{
|
||||
Database: cfg.Data.Clickhouse.Database,
|
||||
Username: cfg.Data.Clickhouse.Username,
|
||||
Password: cfg.Data.Clickhouse.Password,
|
||||
},
|
||||
Debug: cfg.Data.Clickhouse.Debug,
|
||||
DialTimeout: cfg.Data.Clickhouse.DialTimeout.AsDuration(),
|
||||
MaxOpenConns: int(cfg.Data.Clickhouse.MaxOpenConns),
|
||||
MaxIdleConns: int(cfg.Data.Clickhouse.MaxIdleConns),
|
||||
ConnMaxLifetime: cfg.Data.Clickhouse.ConnMaxLifeTime.AsDuration(),
|
||||
opts := &clickhouseV2.Options{}
|
||||
|
||||
if cfg.Data.Clickhouse.Dsn != nil {
|
||||
tmp, err := clickhouseV2.ParseDSN(cfg.Data.Clickhouse.GetDsn())
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to parse clickhouse DSN: %v", err)
|
||||
return ErrInvalidDSN
|
||||
}
|
||||
opts = tmp
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.Addresses != nil {
|
||||
opts.Addr = cfg.Data.Clickhouse.GetAddresses()
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.Database != nil ||
|
||||
cfg.Data.Clickhouse.Username != nil ||
|
||||
cfg.Data.Clickhouse.Password != nil {
|
||||
opts.Auth = clickhouseV2.Auth{}
|
||||
|
||||
if cfg.Data.Clickhouse.Database != nil {
|
||||
opts.Auth.Database = cfg.Data.Clickhouse.GetDatabase()
|
||||
}
|
||||
if cfg.Data.Clickhouse.Username != nil {
|
||||
opts.Auth.Username = cfg.Data.Clickhouse.GetUsername()
|
||||
}
|
||||
if cfg.Data.Clickhouse.Password != nil {
|
||||
opts.Auth.Password = cfg.Data.Clickhouse.GetPassword()
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.Debug != nil {
|
||||
opts.Debug = cfg.Data.Clickhouse.GetDebug()
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.MaxOpenConns != nil {
|
||||
opts.MaxOpenConns = int(cfg.Data.Clickhouse.GetMaxOpenConns())
|
||||
}
|
||||
if cfg.Data.Clickhouse.MaxIdleConns != nil {
|
||||
opts.MaxIdleConns = int(cfg.Data.Clickhouse.GetMaxIdleConns())
|
||||
}
|
||||
|
||||
// 设置ssl
|
||||
if cfg.Data.Clickhouse.Tls != nil {
|
||||
var tlsCfg *tls.Config
|
||||
var err error
|
||||
|
||||
if tlsCfg, err = utils.LoadServerTlsConfig(cfg.Data.Clickhouse.Tls); err != nil {
|
||||
if tlsCfg, err = utils.LoadServerTlsConfig(cfg.Server.Grpc.Tls); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
if tlsCfg != nil {
|
||||
options.TLS = tlsCfg
|
||||
opts.TLS = tlsCfg
|
||||
}
|
||||
}
|
||||
|
||||
conn, err := clickhouse.Open(options)
|
||||
if err != nil {
|
||||
l.Fatalf("failed opening connection to clickhouse: %v", err)
|
||||
return nil
|
||||
if cfg.Data.Clickhouse.CompressionMethod != nil || cfg.Data.Clickhouse.CompressionLevel != nil {
|
||||
opts.Compression = &clickhouseV2.Compression{}
|
||||
|
||||
if cfg.Data.Clickhouse.GetCompressionMethod() != "" {
|
||||
opts.Compression.Method = compressionMap[cfg.Data.Clickhouse.GetCompressionMethod()]
|
||||
}
|
||||
if cfg.Data.Clickhouse.CompressionLevel != nil {
|
||||
opts.Compression.Level = int(cfg.Data.Clickhouse.GetCompressionLevel())
|
||||
}
|
||||
}
|
||||
if cfg.Data.Clickhouse.MaxCompressionBuffer != nil {
|
||||
opts.MaxCompressionBuffer = int(cfg.Data.Clickhouse.GetMaxCompressionBuffer())
|
||||
}
|
||||
|
||||
return conn
|
||||
if cfg.Data.Clickhouse.DialTimeout != nil {
|
||||
opts.DialTimeout = cfg.Data.Clickhouse.GetDialTimeout().AsDuration()
|
||||
}
|
||||
if cfg.Data.Clickhouse.ReadTimeout != nil {
|
||||
opts.ReadTimeout = cfg.Data.Clickhouse.GetReadTimeout().AsDuration()
|
||||
}
|
||||
if cfg.Data.Clickhouse.ConnMaxLifetime != nil {
|
||||
opts.ConnMaxLifetime = cfg.Data.Clickhouse.GetConnMaxLifetime().AsDuration()
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.HttpProxy != nil {
|
||||
proxyURL, err := url.Parse(cfg.Data.Clickhouse.GetHttpProxy())
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to parse HTTP proxy URL: %v", err)
|
||||
return ErrInvalidProxyURL
|
||||
}
|
||||
|
||||
opts.HTTPProxyURL = proxyURL
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.ConnectionOpenStrategy != nil {
|
||||
strategy := clickhouseV2.ConnOpenInOrder
|
||||
switch cfg.Data.Clickhouse.GetConnectionOpenStrategy() {
|
||||
case "in_order":
|
||||
strategy = clickhouseV2.ConnOpenInOrder
|
||||
case "round_robin":
|
||||
strategy = clickhouseV2.ConnOpenRoundRobin
|
||||
case "random":
|
||||
strategy = clickhouseV2.ConnOpenRandom
|
||||
}
|
||||
opts.ConnOpenStrategy = strategy
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.Scheme != nil {
|
||||
switch cfg.Data.Clickhouse.GetScheme() {
|
||||
case "http":
|
||||
opts.Protocol = clickhouseV2.HTTP
|
||||
case "https":
|
||||
opts.Protocol = clickhouseV2.HTTP
|
||||
default:
|
||||
opts.Protocol = clickhouseV2.Native
|
||||
}
|
||||
}
|
||||
|
||||
if cfg.Data.Clickhouse.BlockBufferSize != nil {
|
||||
opts.BlockBufferSize = uint8(cfg.Data.Clickhouse.GetBlockBufferSize())
|
||||
}
|
||||
|
||||
// 创建ClickHouse连接
|
||||
conn, err := clickhouseV2.Open(opts)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to create clickhouse client: %v", err)
|
||||
return ErrConnectionFailed
|
||||
}
|
||||
|
||||
c.conn = conn
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close 关闭ClickHouse客户端连接
|
||||
func (c *Client) Close() {
|
||||
if c.conn == nil {
|
||||
c.log.Warn("clickhouse client is already closed or not initialized")
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.conn.Close(); err != nil {
|
||||
c.log.Errorf("failed to close clickhouse client: %v", err)
|
||||
} else {
|
||||
c.log.Info("clickhouse client closed successfully")
|
||||
}
|
||||
}
|
||||
|
||||
// GetServerVersion 获取ClickHouse服务器版本
|
||||
func (c *Client) GetServerVersion() string {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ""
|
||||
}
|
||||
|
||||
version, err := c.conn.ServerVersion()
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to get server version: %v", err)
|
||||
return ""
|
||||
} else {
|
||||
c.log.Infof("ClickHouse server version: %s", version)
|
||||
return version.String()
|
||||
}
|
||||
}
|
||||
|
||||
// CheckConnection 检查ClickHouse客户端连接是否正常
|
||||
func (c *Client) CheckConnection(ctx context.Context) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
if err := c.conn.Ping(ctx); err != nil {
|
||||
c.log.Errorf("ping failed: %v", err)
|
||||
return ErrPingFailed
|
||||
}
|
||||
|
||||
c.log.Info("clickhouse client connection is healthy")
|
||||
return nil
|
||||
}
|
||||
|
||||
// Query 执行查询并返回结果
|
||||
func (c *Client) Query(ctx context.Context, creator Creator, results *[]any, query string, args ...any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
if creator == nil {
|
||||
c.log.Error("creator function cannot be nil")
|
||||
return ErrCreatorFunctionNil
|
||||
}
|
||||
|
||||
rows, err := c.conn.Query(ctx, query, args...)
|
||||
if err != nil {
|
||||
c.log.Errorf("query failed: %v", err)
|
||||
return ErrQueryExecutionFailed
|
||||
}
|
||||
defer func(rows driverV2.Rows) {
|
||||
if err = rows.Close(); err != nil {
|
||||
c.log.Errorf("failed to close rows: %v", err)
|
||||
}
|
||||
}(rows)
|
||||
|
||||
for rows.Next() {
|
||||
row := creator()
|
||||
if err = rows.ScanStruct(row); err != nil {
|
||||
c.log.Errorf("failed to scan row: %v", err)
|
||||
return ErrRowScanFailed
|
||||
}
|
||||
*results = append(*results, row)
|
||||
}
|
||||
|
||||
// 检查是否有未处理的错误
|
||||
if rows.Err() != nil {
|
||||
c.log.Errorf("Rows iteration error: %v", rows.Err())
|
||||
return ErrRowsIterationError
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// QueryRow 执行查询并返回单行结果
|
||||
func (c *Client) QueryRow(ctx context.Context, dest any, query string, args ...any) error {
|
||||
row := c.conn.QueryRow(ctx, query, args...)
|
||||
if row == nil {
|
||||
c.log.Error("query row returned nil")
|
||||
return ErrRowNotFound
|
||||
}
|
||||
|
||||
if err := row.ScanStruct(dest); err != nil {
|
||||
c.log.Errorf("")
|
||||
return ErrRowScanFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Select 封装 SELECT 子句
|
||||
func (c *Client) Select(ctx context.Context, dest any, query string, args ...any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
err := c.conn.Select(ctx, dest, query, args...)
|
||||
if err != nil {
|
||||
c.log.Errorf("select failed: %v", err)
|
||||
return ErrQueryExecutionFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Exec 执行非查询语句
|
||||
func (c *Client) Exec(ctx context.Context, query string, args ...any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
if err := c.conn.Exec(ctx, query, args...); err != nil {
|
||||
c.log.Errorf("exec failed: %v", err)
|
||||
return ErrExecutionFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) prepareInsertData(data any) (string, string, []any, error) {
|
||||
val := reflect.ValueOf(data)
|
||||
if val.Kind() != reflect.Ptr || val.IsNil() {
|
||||
return "", "", nil, fmt.Errorf("data must be a non-nil pointer")
|
||||
}
|
||||
|
||||
val = val.Elem()
|
||||
typ := val.Type()
|
||||
|
||||
columns := make([]string, 0, typ.NumField())
|
||||
placeholders := make([]string, 0, typ.NumField())
|
||||
values := make([]any, 0, typ.NumField())
|
||||
|
||||
values = structToValueArray(data)
|
||||
|
||||
for i := 0; i < typ.NumField(); i++ {
|
||||
field := typ.Field(i)
|
||||
|
||||
// 优先获取 `ch` 标签,其次获取 `json` 标签,最后使用字段名
|
||||
columnName := field.Tag.Get("ch")
|
||||
if columnName == "" {
|
||||
jsonTag := field.Tag.Get("json")
|
||||
if jsonTag != "" {
|
||||
tags := strings.Split(jsonTag, ",") // 只取逗号前的部分
|
||||
if len(tags) > 0 {
|
||||
columnName = tags[0]
|
||||
}
|
||||
}
|
||||
}
|
||||
if columnName == "" {
|
||||
columnName = field.Name
|
||||
}
|
||||
//columnName = strings.TrimSpace(columnName)
|
||||
|
||||
columns = append(columns, columnName)
|
||||
placeholders = append(placeholders, "?")
|
||||
}
|
||||
|
||||
return strings.Join(columns, ", "), strings.Join(placeholders, ", "), values, nil
|
||||
}
|
||||
|
||||
// Insert 插入数据到指定表
|
||||
func (c *Client) Insert(ctx context.Context, tableName string, in any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
columns, placeholders, values, err := c.prepareInsertData(in)
|
||||
if err != nil {
|
||||
c.log.Errorf("prepare insert in failed: %v", err)
|
||||
return ErrPrepareInsertDataFailed
|
||||
}
|
||||
|
||||
// 构造 SQL 语句
|
||||
query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)",
|
||||
tableName,
|
||||
columns,
|
||||
placeholders,
|
||||
)
|
||||
|
||||
// 执行插入操作
|
||||
if err = c.conn.Exec(ctx, query, values...); err != nil {
|
||||
c.log.Errorf("insert failed: %v", err)
|
||||
return ErrInsertFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) InsertMany(ctx context.Context, tableName string, data []any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
if len(data) == 0 {
|
||||
c.log.Error("data slice is empty")
|
||||
return ErrInvalidColumnData
|
||||
}
|
||||
|
||||
var columns string
|
||||
var placeholders []string
|
||||
var values []any
|
||||
|
||||
for _, item := range data {
|
||||
itemColumns, itemPlaceholders, itemValues, err := c.prepareInsertData(item)
|
||||
if err != nil {
|
||||
c.log.Errorf("prepare insert data failed: %v", err)
|
||||
return ErrPrepareInsertDataFailed
|
||||
}
|
||||
|
||||
if columns == "" {
|
||||
columns = itemColumns
|
||||
} else if columns != itemColumns {
|
||||
c.log.Error("data items have inconsistent columns")
|
||||
return ErrInvalidColumnData
|
||||
}
|
||||
|
||||
placeholders = append(placeholders, fmt.Sprintf("(%s)", itemPlaceholders))
|
||||
values = append(values, itemValues...)
|
||||
}
|
||||
|
||||
// 构造 SQL 语句
|
||||
query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)",
|
||||
tableName,
|
||||
columns,
|
||||
strings.Join(placeholders, ", "),
|
||||
)
|
||||
|
||||
// 执行插入操作
|
||||
if err := c.conn.Exec(ctx, query, values...); err != nil {
|
||||
c.log.Errorf("insert many failed: %v", err)
|
||||
return ErrInsertFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AsyncInsert 异步插入数据
|
||||
func (c *Client) AsyncInsert(ctx context.Context, tableName string, data any, wait bool) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
// 准备插入数据
|
||||
columns, placeholders, values, err := c.prepareInsertData(data)
|
||||
if err != nil {
|
||||
c.log.Errorf("prepare insert data failed: %v", err)
|
||||
return ErrPrepareInsertDataFailed
|
||||
}
|
||||
|
||||
// 构造 SQL 语句
|
||||
query := fmt.Sprintf("INSERT INTO %s (%s) VALUES (%s)",
|
||||
tableName,
|
||||
columns,
|
||||
placeholders,
|
||||
)
|
||||
|
||||
// 执行异步插入
|
||||
if err = c.asyncInsert(ctx, query, wait, values...); err != nil {
|
||||
c.log.Errorf("async insert failed: %v", err)
|
||||
return ErrAsyncInsertFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// asyncInsert 异步插入数据
|
||||
func (c *Client) asyncInsert(ctx context.Context, query string, wait bool, args ...any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
if err := c.conn.AsyncInsert(ctx, query, wait, args...); err != nil {
|
||||
c.log.Errorf("async insert failed: %v", err)
|
||||
return ErrAsyncInsertFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// AsyncInsertMany 批量异步插入数据
|
||||
func (c *Client) AsyncInsertMany(ctx context.Context, tableName string, data []any, wait bool) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
if len(data) == 0 {
|
||||
c.log.Error("data slice is empty")
|
||||
return ErrInvalidColumnData
|
||||
}
|
||||
|
||||
// 准备插入数据的列名和占位符
|
||||
var columns string
|
||||
var placeholders []string
|
||||
var values []any
|
||||
|
||||
for _, item := range data {
|
||||
itemColumns, itemPlaceholders, itemValues, err := c.prepareInsertData(item)
|
||||
if err != nil {
|
||||
c.log.Errorf("prepare insert data failed: %v", err)
|
||||
return ErrPrepareInsertDataFailed
|
||||
}
|
||||
|
||||
if columns == "" {
|
||||
columns = itemColumns
|
||||
} else if columns != itemColumns {
|
||||
c.log.Error("data items have inconsistent columns")
|
||||
return ErrInvalidColumnData
|
||||
}
|
||||
|
||||
placeholders = append(placeholders, fmt.Sprintf("(%s)", itemPlaceholders))
|
||||
values = append(values, itemValues...)
|
||||
}
|
||||
|
||||
// 构造 SQL 语句
|
||||
query := fmt.Sprintf("INSERT INTO %s (%s) VALUES %s",
|
||||
tableName,
|
||||
columns,
|
||||
strings.Join(placeholders, ", "),
|
||||
)
|
||||
|
||||
// 执行异步插入操作
|
||||
if err := c.asyncInsert(ctx, query, wait, values...); err != nil {
|
||||
c.log.Errorf("batch insert failed: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入数据
|
||||
func (c *Client) BatchInsert(ctx context.Context, tableName string, data []any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
if len(data) == 0 {
|
||||
c.log.Error("data slice is empty")
|
||||
return ErrInvalidColumnData
|
||||
}
|
||||
|
||||
// 准备插入数据的列名和占位符
|
||||
var columns string
|
||||
var values [][]any
|
||||
|
||||
for _, item := range data {
|
||||
itemColumns, _, itemValues, err := c.prepareInsertData(item)
|
||||
if err != nil {
|
||||
c.log.Errorf("prepare insert data failed: %v", err)
|
||||
return ErrPrepareInsertDataFailed
|
||||
}
|
||||
|
||||
if columns == "" {
|
||||
columns = itemColumns
|
||||
} else if columns != itemColumns {
|
||||
c.log.Error("data items have inconsistent columns")
|
||||
return ErrInvalidColumnData
|
||||
}
|
||||
|
||||
values = append(values, itemValues)
|
||||
}
|
||||
|
||||
// 构造 SQL 语句
|
||||
query := fmt.Sprintf("INSERT INTO %s (%s) VALUES", tableName, columns)
|
||||
|
||||
// 调用 batchExec 方法执行批量插入
|
||||
if err := c.batchExec(ctx, query, values); err != nil {
|
||||
c.log.Errorf("batch insert failed: %v", err)
|
||||
return ErrBatchInsertFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// batchExec 执行批量操作
|
||||
func (c *Client) batchExec(ctx context.Context, query string, data [][]any) error {
|
||||
batch, err := c.conn.PrepareBatch(ctx, query)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to prepare batch: %v", err)
|
||||
return ErrBatchPrepareFailed
|
||||
}
|
||||
|
||||
for _, row := range data {
|
||||
if err = batch.Append(row...); err != nil {
|
||||
c.log.Errorf("failed to append batch data: %v", err)
|
||||
return ErrBatchAppendFailed
|
||||
}
|
||||
}
|
||||
|
||||
if err = batch.Send(); err != nil {
|
||||
c.log.Errorf("failed to send batch: %v", err)
|
||||
return ErrBatchSendFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BatchStructs 批量插入结构体数据
|
||||
func (c *Client) BatchStructs(ctx context.Context, query string, data []any) error {
|
||||
if c.conn == nil {
|
||||
c.log.Error("clickhouse client is not initialized")
|
||||
return ErrClientNotInitialized
|
||||
}
|
||||
|
||||
// 准备批量插入
|
||||
batch, err := c.conn.PrepareBatch(ctx, query)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to prepare batch: %v", err)
|
||||
return ErrBatchPrepareFailed
|
||||
}
|
||||
|
||||
// 遍历数据并添加到批量插入
|
||||
for _, row := range data {
|
||||
if err := batch.AppendStruct(row); err != nil {
|
||||
c.log.Errorf("failed to append batch struct data: %v", err)
|
||||
return ErrBatchAppendFailed
|
||||
}
|
||||
}
|
||||
|
||||
// 发送批量插入
|
||||
if err = batch.Send(); err != nil {
|
||||
c.log.Errorf("failed to send batch: %v", err)
|
||||
return ErrBatchSendFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
500
database/clickhouse/client_test.go
Normal file
500
database/clickhouse/client_test.go
Normal file
@@ -0,0 +1,500 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
type Candle struct {
|
||||
Timestamp *time.Time `json:"timestamp" ch:"timestamp"`
|
||||
Symbol *string `json:"symbol" ch:"symbol"`
|
||||
Open *float64 `json:"open" ch:"open"`
|
||||
High *float64 `json:"high" ch:"high"`
|
||||
Low *float64 `json:"low" ch:"low"`
|
||||
Close *float64 `json:"close" ch:"close"`
|
||||
Volume *float64 `json:"volume" ch:"volume"`
|
||||
}
|
||||
|
||||
func createTestClient() *Client {
|
||||
cli, _ := NewClient(
|
||||
log.DefaultLogger,
|
||||
&conf.Bootstrap{
|
||||
Data: &conf.Data{
|
||||
Clickhouse: &conf.Data_ClickHouse{
|
||||
Addresses: []string{"localhost:9000"},
|
||||
Database: Ptr("finances"),
|
||||
Username: Ptr("default"),
|
||||
Password: Ptr("*Abcd123456"),
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
return cli
|
||||
}
|
||||
|
||||
func createCandlesTable(client *Client) {
|
||||
// 创建表的 SQL 语句
|
||||
createTableQuery := `
|
||||
CREATE TABLE IF NOT EXISTS candles (
|
||||
timestamp DateTime64(3),
|
||||
symbol String,
|
||||
open Float64,
|
||||
high Float64,
|
||||
low Float64,
|
||||
close Float64,
|
||||
volume Float64
|
||||
) ENGINE = MergeTree()
|
||||
ORDER BY timestamp
|
||||
`
|
||||
err := client.Exec(context.Background(), createTableQuery)
|
||||
if err != nil {
|
||||
log.Errorf("Failed to create candles table: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func TestNewClient(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
// 测试 CheckConnection
|
||||
err := client.CheckConnection(context.Background())
|
||||
assert.NoError(t, err, "CheckConnection 应该成功执行")
|
||||
|
||||
// 测试 GetServerVersion
|
||||
version := client.GetServerVersion()
|
||||
assert.NotEmpty(t, version, "GetServerVersion 应该返回非空值")
|
||||
|
||||
createCandlesTable(client)
|
||||
}
|
||||
|
||||
func TestInsertCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 测试数据
|
||||
candle := &Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("AAPL"),
|
||||
Open: Ptr(100.5),
|
||||
High: Ptr(105.0),
|
||||
Low: Ptr(99.5),
|
||||
Close: Ptr(102.0),
|
||||
Volume: Ptr(1500.0),
|
||||
}
|
||||
|
||||
// 插入数据
|
||||
err := client.Insert(context.Background(), "candles", candle)
|
||||
assert.NoError(t, err, "InsertCandlesTable 应该成功执行")
|
||||
}
|
||||
|
||||
func TestInsertManyCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 测试数据
|
||||
data := []any{
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("AAPL"),
|
||||
Open: Ptr(100.5),
|
||||
High: Ptr(105.0),
|
||||
Low: Ptr(99.5),
|
||||
Close: Ptr(102.0),
|
||||
Volume: Ptr(1500.0),
|
||||
},
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("GOOG"),
|
||||
Open: Ptr(200.5),
|
||||
High: Ptr(205.0),
|
||||
Low: Ptr(199.5),
|
||||
Close: Ptr(202.0),
|
||||
Volume: Ptr(2500.0),
|
||||
},
|
||||
}
|
||||
|
||||
// 插入数据
|
||||
err := client.InsertMany(context.Background(), "candles", data)
|
||||
assert.NoError(t, err, "InsertManyCandlesTable 应该成功执行")
|
||||
}
|
||||
|
||||
func TestAsyncInsertCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 测试数据
|
||||
candle := &Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("BTC/USD"),
|
||||
Open: Ptr(30000.0),
|
||||
High: Ptr(31000.0),
|
||||
Low: Ptr(29000.0),
|
||||
Close: Ptr(30500.0),
|
||||
Volume: Ptr(500.0),
|
||||
}
|
||||
|
||||
// 异步插入数据
|
||||
err := client.AsyncInsert(context.Background(), "candles", candle, true)
|
||||
assert.NoError(t, err, "AsyncInsert 方法应该成功执行")
|
||||
|
||||
// 验证插入结果
|
||||
query := `
|
||||
SELECT timestamp, symbol, open, high, low, close, volume
|
||||
FROM candles
|
||||
WHERE symbol = ?
|
||||
`
|
||||
var result Candle
|
||||
err = client.QueryRow(context.Background(), &result, query, "BTC/USD")
|
||||
assert.NoError(t, err, "QueryRow 应该成功执行")
|
||||
assert.Equal(t, "BTC/USD", *result.Symbol, "symbol 列值应该为 BTC/USD")
|
||||
assert.Equal(t, 30500.0, *result.Close, "close 列值应该为 30500.0")
|
||||
assert.Equal(t, 500.0, *result.Volume, "volume 列值应该为 500.0")
|
||||
}
|
||||
|
||||
func TestAsyncInsertManyCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 测试数据
|
||||
data := []any{
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("AAPL"),
|
||||
Open: Ptr(100.5),
|
||||
High: Ptr(105.0),
|
||||
Low: Ptr(99.5),
|
||||
Close: Ptr(102.0),
|
||||
Volume: Ptr(1500.0),
|
||||
},
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("GOOG"),
|
||||
Open: Ptr(200.5),
|
||||
High: Ptr(205.0),
|
||||
Low: Ptr(199.5),
|
||||
Close: Ptr(202.0),
|
||||
Volume: Ptr(2500.0),
|
||||
},
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("MSFT"),
|
||||
Open: Ptr(300.5),
|
||||
High: Ptr(305.0),
|
||||
Low: Ptr(299.5),
|
||||
Close: Ptr(302.0),
|
||||
Volume: Ptr(3500.0),
|
||||
},
|
||||
}
|
||||
|
||||
// 批量插入数据
|
||||
err := client.AsyncInsertMany(context.Background(), "candles", data, true)
|
||||
assert.NoError(t, err, "AsyncInsertMany 方法应该成功执行")
|
||||
|
||||
// 验证插入结果
|
||||
query := `
|
||||
SELECT timestamp, symbol, open, high, low, close, volume
|
||||
FROM candles
|
||||
`
|
||||
var results []Candle
|
||||
err = client.Select(context.Background(), &results, query)
|
||||
assert.NoError(t, err, "查询数据应该成功执行")
|
||||
}
|
||||
|
||||
func TestInternalBatchExecCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 插入数据的 SQL 语句
|
||||
insertQuery := `
|
||||
INSERT INTO candles (timestamp, symbol, open, high, low, close, volume)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
`
|
||||
|
||||
// 测试数据
|
||||
data := [][]interface{}{
|
||||
{"2023-10-01 12:00:00", "AAPL", 100.5, 105.0, 99.5, 102.0, 1500.0},
|
||||
{"2023-10-01 12:01:00", "GOOG", 200.5, 205.0, 199.5, 202.0, 2500.0},
|
||||
{"2023-10-01 12:02:00", "MSFT", 300.5, 305.0, 299.5, 302.0, 3500.0},
|
||||
}
|
||||
|
||||
// 批量插入数据
|
||||
err := client.batchExec(context.Background(), insertQuery, data)
|
||||
assert.NoError(t, err, "batchExec 应该成功执行")
|
||||
}
|
||||
|
||||
func TestBatchInsertCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 测试数据
|
||||
data := []any{
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("AAPL"),
|
||||
Open: Ptr(100.5),
|
||||
High: Ptr(105.0),
|
||||
Low: Ptr(99.5),
|
||||
Close: Ptr(102.0),
|
||||
Volume: Ptr(1500.0),
|
||||
},
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("GOOG"),
|
||||
Open: Ptr(200.5),
|
||||
High: Ptr(205.0),
|
||||
Low: Ptr(199.5),
|
||||
Close: Ptr(202.0),
|
||||
Volume: Ptr(2500.0),
|
||||
},
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("MSFT"),
|
||||
Open: Ptr(300.5),
|
||||
High: Ptr(305.0),
|
||||
Low: Ptr(299.5),
|
||||
Close: Ptr(302.0),
|
||||
Volume: Ptr(3500.0),
|
||||
},
|
||||
}
|
||||
|
||||
// 批量插入数据
|
||||
err := client.BatchInsert(context.Background(), "candles", data)
|
||||
assert.NoError(t, err, "BatchInsert 方法应该成功执行")
|
||||
|
||||
// 验证插入结果
|
||||
query := `
|
||||
SELECT timestamp, symbol, open, high, low, close, volume
|
||||
FROM candles
|
||||
`
|
||||
var results []Candle
|
||||
err = client.Select(context.Background(), &results, query)
|
||||
assert.NoError(t, err, "查询数据应该成功执行")
|
||||
}
|
||||
|
||||
func TestBatchStructsCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 插入数据的 SQL 语句
|
||||
insertQuery := `
|
||||
INSERT INTO candles (timestamp, symbol, open, high, low, close, volume)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
`
|
||||
|
||||
// 测试数据
|
||||
data := []any{
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("AAPL"),
|
||||
Open: Ptr(100.5),
|
||||
High: Ptr(105.0),
|
||||
Low: Ptr(99.5),
|
||||
Close: Ptr(102.0),
|
||||
Volume: Ptr(1500.0),
|
||||
},
|
||||
&Candle{
|
||||
Timestamp: Ptr(time.Now()),
|
||||
Symbol: Ptr("GOOG"),
|
||||
Open: Ptr(200.5),
|
||||
High: Ptr(205.0),
|
||||
Low: Ptr(199.5),
|
||||
Close: Ptr(202.0),
|
||||
Volume: Ptr(2500.0),
|
||||
},
|
||||
}
|
||||
|
||||
// 批量插入数据
|
||||
err := client.BatchStructs(context.Background(), insertQuery, data)
|
||||
assert.NoError(t, err, "BatchStructsCandlesTable 应该成功执行")
|
||||
}
|
||||
|
||||
func TestInternalAsyncInsertIntoCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 插入数据的 SQL 语句
|
||||
insertQuery := `
|
||||
INSERT INTO candles (timestamp, symbol, open, high, low, close, volume)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
`
|
||||
|
||||
// 测试数据
|
||||
err := client.asyncInsert(context.Background(), insertQuery, true,
|
||||
"2023-10-01 12:00:00", "AAPL", 100.5, 105.0, 99.5, 102.0, 1500.0)
|
||||
assert.NoError(t, err, "InsertIntoCandlesTable 应该成功执行")
|
||||
}
|
||||
|
||||
func TestQueryCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 查询数据的 SQL 语句
|
||||
query := `
|
||||
SELECT timestamp, symbol, open, high, low, close, volume
|
||||
FROM candles
|
||||
`
|
||||
|
||||
// 定义结果集
|
||||
var results []any
|
||||
|
||||
// 执行查询
|
||||
err := client.Query(context.Background(), func() interface{} { return &Candle{} }, &results, query)
|
||||
assert.NoError(t, err, "QueryCandlesTable 应该成功执行")
|
||||
assert.NotEmpty(t, results, "QueryCandlesTable 应该返回结果")
|
||||
for _, result := range results {
|
||||
candle, ok := result.(*Candle)
|
||||
assert.True(t, ok, "结果应该是 Candle 类型")
|
||||
assert.NotNil(t, candle.Timestamp, "Timestamp 列不应该为 nil")
|
||||
assert.NotNil(t, candle.Symbol, "Symbol 列不应该为 nil")
|
||||
assert.NotNil(t, candle.Open, "Open 列不应该为 nil")
|
||||
assert.NotNil(t, candle.High, "High 列不应该为 nil")
|
||||
assert.NotNil(t, candle.Low, "Low 列不应该为 nil")
|
||||
assert.NotNil(t, candle.Close, "Close 列不应该为 nil")
|
||||
assert.NotNil(t, candle.Volume, "Volume 列不应该为 nil")
|
||||
t.Logf("[%v] Candle: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %f\n",
|
||||
candle.Timestamp.String(),
|
||||
*candle.Symbol,
|
||||
*candle.Open, *candle.High, *candle.Low, *candle.Close, *candle.Volume,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestSelectCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 查询数据的 SQL 语句
|
||||
query := `
|
||||
SELECT timestamp, symbol, open, high, low, close, volume
|
||||
FROM candles
|
||||
`
|
||||
|
||||
// 定义结果集
|
||||
var results []Candle
|
||||
|
||||
// 执行查询
|
||||
err := client.Select(context.Background(), &results, query)
|
||||
assert.NoError(t, err, "QueryCandlesTable 应该成功执行")
|
||||
assert.NotEmpty(t, results, "QueryCandlesTable 应该返回结果")
|
||||
|
||||
for _, result := range results {
|
||||
assert.NotNil(t, result.Timestamp, "Timestamp 列不应该为 nil")
|
||||
assert.NotNil(t, result.Symbol, "Symbol 列不应该为 nil")
|
||||
assert.NotNil(t, result.Open, "Open 列不应该为 nil")
|
||||
assert.NotNil(t, result.High, "High 列不应该为 nil")
|
||||
assert.NotNil(t, result.Low, "Low 列不应该为 nil")
|
||||
assert.NotNil(t, result.Close, "Close 列不应该为 nil")
|
||||
assert.NotNil(t, result.Volume, "Volume 列不应该为 nil")
|
||||
t.Logf("[%v] Candle: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %f\n",
|
||||
result.Timestamp.String(),
|
||||
*result.Symbol,
|
||||
*result.Open, *result.High, *result.Low, *result.Close, *result.Volume,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryRow(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 插入测试数据
|
||||
insertQuery := `
|
||||
INSERT INTO candles (timestamp, symbol, open, high, low, close, volume)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
`
|
||||
err := client.asyncInsert(context.Background(), insertQuery, true,
|
||||
"2023-10-01 12:00:00", "AAPL", 100.5, 105.0, 99.5, 102.0, 1500.0)
|
||||
assert.NoError(t, err, "数据插入失败")
|
||||
|
||||
// 查询单行数据
|
||||
query := `
|
||||
SELECT timestamp, symbol, open, high, low, close, volume
|
||||
FROM candles
|
||||
WHERE symbol = ?
|
||||
`
|
||||
|
||||
var result Candle
|
||||
|
||||
err = client.QueryRow(context.Background(), &result, query, "AAPL")
|
||||
assert.NoError(t, err, "QueryRow 应该成功执行")
|
||||
assert.Equal(t, "AAPL", *result.Symbol, "symbol 列值应该为 AAPL")
|
||||
assert.Equal(t, 100.5, *result.Open, "open 列值应该为 100.5")
|
||||
assert.Equal(t, 1500.0, *result.Volume, "volume 列值应该为 1500.0")
|
||||
t.Logf("QueryRow Result: [%v] Candle: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %f\n",
|
||||
result.Timestamp.String(),
|
||||
*result.Symbol,
|
||||
*result.Open, *result.High, *result.Low, *result.Close, *result.Volume,
|
||||
)
|
||||
}
|
||||
|
||||
func TestDropCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
// 删除表的 SQL 语句
|
||||
dropTableQuery := `DROP TABLE IF EXISTS candles`
|
||||
|
||||
// 执行删除表操作
|
||||
err := client.Exec(context.Background(), dropTableQuery)
|
||||
assert.NoError(t, err, "DropCandlesTable 应该成功执行")
|
||||
}
|
||||
|
||||
func TestAggregateCandlesTable(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
createCandlesTable(client)
|
||||
|
||||
// 聚合查询的 SQL 语句
|
||||
query := `
|
||||
SELECT symbol,
|
||||
MAX(high) AS max_high,
|
||||
MIN(low) AS min_low,
|
||||
AVG(close) AS avg_close,
|
||||
SUM(volume) AS total_volume
|
||||
FROM candles
|
||||
GROUP BY symbol
|
||||
`
|
||||
|
||||
// 定义结果集
|
||||
var results []struct {
|
||||
Symbol string `ch:"symbol"`
|
||||
MaxHigh float64 `ch:"max_high"`
|
||||
MinLow float64 `ch:"min_low"`
|
||||
AvgClose float64 `ch:"avg_close"`
|
||||
TotalVolume float64 `ch:"total_volume"`
|
||||
}
|
||||
|
||||
// 执行查询
|
||||
err := client.Select(context.Background(), &results, query)
|
||||
assert.NoError(t, err, "AggregateCandlesTable 应该成功执行")
|
||||
assert.NotEmpty(t, results, "AggregateCandlesTable 应该返回结果")
|
||||
}
|
||||
89
database/clickhouse/errors.go
Normal file
89
database/clickhouse/errors.go
Normal file
@@ -0,0 +1,89 @@
|
||||
package clickhouse
|
||||
|
||||
import "github.com/go-kratos/kratos/v2/errors"
|
||||
|
||||
var (
|
||||
// ErrInvalidColumnName is returned when an invalid column name is used.
|
||||
ErrInvalidColumnName = errors.InternalServer("INVALID_COLUMN_NAME", "invalid column name")
|
||||
|
||||
// ErrInvalidTableName is returned when an invalid table name is used.
|
||||
ErrInvalidTableName = errors.InternalServer("INVALID_TABLE_NAME", "invalid table name")
|
||||
|
||||
// ErrInvalidCondition is returned when an invalid condition is used in a query.
|
||||
ErrInvalidCondition = errors.InternalServer("INVALID_CONDITION", "invalid condition in query")
|
||||
|
||||
// ErrQueryExecutionFailed is returned when a query execution fails.
|
||||
ErrQueryExecutionFailed = errors.InternalServer("QUERY_EXECUTION_FAILED", "query execution failed")
|
||||
|
||||
// ErrExecutionFailed is returned when a general execution fails.
|
||||
ErrExecutionFailed = errors.InternalServer("EXECUTION_FAILED", "execution failed")
|
||||
|
||||
// ErrAsyncInsertFailed is returned when an asynchronous insert operation fails.
|
||||
ErrAsyncInsertFailed = errors.InternalServer("ASYNC_INSERT_FAILED", "async insert operation failed")
|
||||
|
||||
// ErrRowScanFailed is returned when scanning rows from a query result fails.
|
||||
ErrRowScanFailed = errors.InternalServer("ROW_SCAN_FAILED", "row scan failed")
|
||||
|
||||
// ErrRowsIterationError is returned when there is an error iterating over rows.
|
||||
ErrRowsIterationError = errors.InternalServer("ROWS_ITERATION_ERROR", "rows iteration error")
|
||||
|
||||
// ErrRowNotFound is returned when a specific row is not found in the result set.
|
||||
ErrRowNotFound = errors.InternalServer("ROW_NOT_FOUND", "row not found")
|
||||
|
||||
// ErrConnectionFailed is returned when the connection to ClickHouse fails.
|
||||
ErrConnectionFailed = errors.InternalServer("CONNECTION_FAILED", "failed to connect to ClickHouse")
|
||||
|
||||
// ErrDatabaseNotFound is returned when the specified database is not found.
|
||||
ErrDatabaseNotFound = errors.InternalServer("DATABASE_NOT_FOUND", "specified database not found")
|
||||
|
||||
// ErrTableNotFound is returned when the specified table is not found.
|
||||
ErrTableNotFound = errors.InternalServer("TABLE_NOT_FOUND", "specified table not found")
|
||||
|
||||
// ErrInsertFailed is returned when an insert operation fails.
|
||||
ErrInsertFailed = errors.InternalServer("INSERT_FAILED", "insert operation failed")
|
||||
|
||||
// ErrUpdateFailed is returned when an update operation fails.
|
||||
ErrUpdateFailed = errors.InternalServer("UPDATE_FAILED", "update operation failed")
|
||||
|
||||
// ErrDeleteFailed is returned when a delete operation fails.
|
||||
ErrDeleteFailed = errors.InternalServer("DELETE_FAILED", "delete operation failed")
|
||||
|
||||
// ErrTransactionFailed is returned when a transaction fails.
|
||||
ErrTransactionFailed = errors.InternalServer("TRANSACTION_FAILED", "transaction failed")
|
||||
|
||||
// ErrClientNotInitialized is returned when the ClickHouse client is not initialized.
|
||||
ErrClientNotInitialized = errors.InternalServer("CLIENT_NOT_INITIALIZED", "clickhouse client not initialized")
|
||||
|
||||
// ErrGetServerVersionFailed is returned when getting the server version fails.
|
||||
ErrGetServerVersionFailed = errors.InternalServer("GET_SERVER_VERSION_FAILED", "failed to get server version")
|
||||
|
||||
// ErrPingFailed is returned when a ping to the ClickHouse server fails.
|
||||
ErrPingFailed = errors.InternalServer("PING_FAILED", "ping to ClickHouse server failed")
|
||||
|
||||
// ErrCreatorFunctionNil is returned when the creator function is nil.
|
||||
ErrCreatorFunctionNil = errors.InternalServer("CREATOR_FUNCTION_NIL", "creator function cannot be nil")
|
||||
|
||||
// ErrBatchPrepareFailed is returned when a batch prepare operation fails.
|
||||
ErrBatchPrepareFailed = errors.InternalServer("BATCH_PREPARE_FAILED", "batch prepare operation failed")
|
||||
|
||||
// ErrBatchSendFailed is returned when a batch send operation fails.
|
||||
ErrBatchSendFailed = errors.InternalServer("BATCH_SEND_FAILED", "batch send operation failed")
|
||||
|
||||
// ErrBatchAppendFailed is returned when appending to a batch fails.
|
||||
ErrBatchAppendFailed = errors.InternalServer("BATCH_APPEND_FAILED", "batch append operation failed")
|
||||
|
||||
// ErrBatchInsertFailed is returned when a batch insert operation fails.
|
||||
ErrBatchInsertFailed = errors.InternalServer("BATCH_INSERT_FAILED", "batch insert operation failed")
|
||||
|
||||
// ErrInvalidDSN is returned when the data source name (DSN) is invalid.
|
||||
ErrInvalidDSN = errors.InternalServer("INVALID_DSN", "invalid data source name")
|
||||
|
||||
// ErrInvalidProxyURL is returned when the proxy URL is invalid.
|
||||
ErrInvalidProxyURL = errors.InternalServer("INVALID_PROXY_URL", "invalid proxy URL")
|
||||
|
||||
// ErrPrepareInsertDataFailed is returned when preparing insert data fails.
|
||||
ErrPrepareInsertDataFailed = errors.InternalServer("PREPARE_INSERT_DATA_FAILED", "failed to prepare insert data")
|
||||
|
||||
// ErrInvalidColumnData is returned when the column data type is invalid.
|
||||
ErrInvalidColumnData = errors.InternalServer("INVALID_COLUMN_DATA", "invalid column data type")
|
||||
)
|
||||
@@ -7,27 +7,32 @@ toolchain go1.23.3
|
||||
replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.35.0
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.37.2
|
||||
github.com/go-kratos/kratos/v2 v2.8.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.21
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.27
|
||||
github.com/tx7do/kratos-bootstrap/utils v0.1.3
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/ClickHouse/ch-go v0.66.0 // indirect
|
||||
github.com/andybalholm/brotli v1.1.1 // indirect
|
||||
github.com/ClickHouse/ch-go v0.66.1 // indirect
|
||||
github.com/andybalholm/brotli v1.2.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/go-faster/city v1.0.1 // indirect
|
||||
github.com/go-faster/errors v0.7.1 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/paulmach/orb v0.11.1 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.22 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.13.1 // indirect
|
||||
github.com/segmentio/asm v1.2.0 // indirect
|
||||
github.com/shopspring/decimal v1.4.0 // indirect
|
||||
go.opentelemetry.io/otel v1.36.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.36.0 // indirect
|
||||
go.opentelemetry.io/otel v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.37.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
|
||||
google.golang.org/grpc v1.73.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
github.com/ClickHouse/ch-go v0.66.0 h1:hLslxxAVb2PHpbHr4n0d6aP8CEIpUYGMVT1Yj/Q5Img=
|
||||
github.com/ClickHouse/ch-go v0.66.0/go.mod h1:noiHWyLMJAZ5wYuq3R/K0TcRhrNA8h7o1AqHX0klEhM=
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.35.0 h1:ZMLZqxu+NiW55f4JS32kzyEbMb7CthGn3ziCcULOvSE=
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.35.0/go.mod h1:O2FFT/rugdpGEW2VKyEGyMUWyQU0ahmenY9/emxLPxs=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
github.com/ClickHouse/ch-go v0.66.1 h1:LQHFslfVYZsISOY0dnOYOXGkOUvpv376CCm8g7W74A4=
|
||||
github.com/ClickHouse/ch-go v0.66.1/go.mod h1:NEYcg3aOFv2EmTJfo4m2WF7sHB/YFbLUuIWv9iq76xY=
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.37.2 h1:wRLNKoynvHQEN4znnVHNLaYnrqVc9sGJmGYg+GGCfto=
|
||||
github.com/ClickHouse/clickhouse-go/v2 v2.37.2/go.mod h1:pH2zrBGp5Y438DMwAxXMm1neSXPPjSI7tD4MURVULw8=
|
||||
github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwToPjQ=
|
||||
github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -15,6 +15,8 @@ github.com/go-kratos/kratos/v2 v2.8.4 h1:eIJLE9Qq9WSoKx+Buy2uPyrahtF/lPh+Xf4MTpx
|
||||
github.com/go-kratos/kratos/v2 v2.8.4/go.mod h1:mq62W2101a5uYyRxe+7IdWubu7gZCGYqSNKwGFiiRcw=
|
||||
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
@@ -65,10 +67,10 @@ github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7Jul
|
||||
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
|
||||
go.opentelemetry.io/otel v1.36.0 h1:UumtzIklRBY6cI/lllNZlALOF5nNIzJVb16APdvgTXg=
|
||||
go.opentelemetry.io/otel v1.36.0/go.mod h1:/TcFMXYjyRNh8khOAO9ybYkqaDBb/70aVwkNML4pP8E=
|
||||
go.opentelemetry.io/otel/trace v1.36.0 h1:ahxWNuqZjpdiFAyrIoQ4GIiAIhxAunQR6MUoKrsNd4w=
|
||||
go.opentelemetry.io/otel/trace v1.36.0/go.mod h1:gQ+OnDZzrybY4k4seLzPAWNwVBBVlF2szhehOBB/tGA=
|
||||
go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ=
|
||||
go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I=
|
||||
go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4=
|
||||
go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
@@ -80,12 +82,14 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
@@ -99,6 +103,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
|
||||
@@ -107,6 +113,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
|
||||
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
|
||||
246
database/clickhouse/query.go
Normal file
246
database/clickhouse/query.go
Normal file
@@ -0,0 +1,246 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
)
|
||||
|
||||
type QueryBuilder struct {
|
||||
table string
|
||||
columns []string
|
||||
distinct bool
|
||||
conditions []string
|
||||
orderBy []string
|
||||
groupBy []string
|
||||
having []string
|
||||
joins []string
|
||||
with []string
|
||||
union []string
|
||||
limit int
|
||||
offset int
|
||||
params []interface{} // 用于存储参数
|
||||
useIndex string // 索引提示
|
||||
cacheResult bool // 是否缓存查询结果
|
||||
debug bool // 是否启用调试
|
||||
log *log.Helper
|
||||
}
|
||||
|
||||
// NewQueryBuilder 创建一个新的 QueryBuilder 实例
|
||||
func NewQueryBuilder(table string, log *log.Helper) *QueryBuilder {
|
||||
return &QueryBuilder{
|
||||
log: log,
|
||||
table: table,
|
||||
params: []interface{}{},
|
||||
}
|
||||
}
|
||||
|
||||
// EnableDebug 启用调试模式
|
||||
func (qb *QueryBuilder) EnableDebug() *QueryBuilder {
|
||||
qb.debug = true
|
||||
return qb
|
||||
}
|
||||
|
||||
// logDebug 打印调试信息
|
||||
func (qb *QueryBuilder) logDebug(message string) {
|
||||
if qb.debug {
|
||||
qb.log.Debug("[QueryBuilder Debug]:", message)
|
||||
}
|
||||
}
|
||||
|
||||
// Select 设置查询的列
|
||||
func (qb *QueryBuilder) Select(columns ...string) *QueryBuilder {
|
||||
for _, column := range columns {
|
||||
if !isValidIdentifier(column) {
|
||||
panic("Invalid column name")
|
||||
}
|
||||
}
|
||||
|
||||
qb.columns = columns
|
||||
return qb
|
||||
}
|
||||
|
||||
// Distinct 设置 DISTINCT 查询
|
||||
func (qb *QueryBuilder) Distinct() *QueryBuilder {
|
||||
qb.distinct = true
|
||||
return qb
|
||||
}
|
||||
|
||||
// Where 添加查询条件并支持参数化
|
||||
func (qb *QueryBuilder) Where(condition string, args ...interface{}) *QueryBuilder {
|
||||
if !isValidCondition(condition) {
|
||||
panic("Invalid condition")
|
||||
}
|
||||
|
||||
qb.conditions = append(qb.conditions, condition)
|
||||
qb.params = append(qb.params, args...)
|
||||
return qb
|
||||
}
|
||||
|
||||
// OrderBy 设置排序条件
|
||||
func (qb *QueryBuilder) OrderBy(order string) *QueryBuilder {
|
||||
qb.orderBy = append(qb.orderBy, order)
|
||||
return qb
|
||||
}
|
||||
|
||||
// GroupBy 设置分组条件
|
||||
func (qb *QueryBuilder) GroupBy(columns ...string) *QueryBuilder {
|
||||
qb.groupBy = append(qb.groupBy, columns...)
|
||||
return qb
|
||||
}
|
||||
|
||||
// Having 添加分组后的过滤条件并支持参数化
|
||||
func (qb *QueryBuilder) Having(condition string, args ...interface{}) *QueryBuilder {
|
||||
qb.having = append(qb.having, condition)
|
||||
qb.params = append(qb.params, args...)
|
||||
return qb
|
||||
}
|
||||
|
||||
// Join 添加 JOIN 操作
|
||||
func (qb *QueryBuilder) Join(joinType, table, onCondition string) *QueryBuilder {
|
||||
join := fmt.Sprintf("%s JOIN %s ON %s", joinType, table, onCondition)
|
||||
qb.joins = append(qb.joins, join)
|
||||
return qb
|
||||
}
|
||||
|
||||
// With 添加 WITH 子句
|
||||
func (qb *QueryBuilder) With(expression string) *QueryBuilder {
|
||||
qb.with = append(qb.with, expression)
|
||||
return qb
|
||||
}
|
||||
|
||||
// Union 添加 UNION 操作
|
||||
func (qb *QueryBuilder) Union(query string) *QueryBuilder {
|
||||
qb.union = append(qb.union, query)
|
||||
return qb
|
||||
}
|
||||
|
||||
// Limit 设置查询结果的限制数量
|
||||
func (qb *QueryBuilder) Limit(limit int) *QueryBuilder {
|
||||
qb.limit = limit
|
||||
return qb
|
||||
}
|
||||
|
||||
// Offset 设置查询结果的偏移量
|
||||
func (qb *QueryBuilder) Offset(offset int) *QueryBuilder {
|
||||
qb.offset = offset
|
||||
return qb
|
||||
}
|
||||
|
||||
// UseIndex 设置索引提示
|
||||
func (qb *QueryBuilder) UseIndex(index string) *QueryBuilder {
|
||||
qb.useIndex = index
|
||||
return qb
|
||||
}
|
||||
|
||||
// CacheResult 启用查询结果缓存
|
||||
func (qb *QueryBuilder) CacheResult() *QueryBuilder {
|
||||
qb.cacheResult = true
|
||||
return qb
|
||||
}
|
||||
|
||||
// ArrayJoin 添加 ARRAY JOIN 子句
|
||||
func (qb *QueryBuilder) ArrayJoin(expression string) *QueryBuilder {
|
||||
qb.joins = append(qb.joins, fmt.Sprintf("ARRAY JOIN %s", expression))
|
||||
return qb
|
||||
}
|
||||
|
||||
// Final 添加 FINAL 修饰符
|
||||
func (qb *QueryBuilder) Final() *QueryBuilder {
|
||||
qb.table = fmt.Sprintf("%s FINAL", qb.table)
|
||||
return qb
|
||||
}
|
||||
|
||||
// Sample 添加 SAMPLE 子句
|
||||
func (qb *QueryBuilder) Sample(sampleRate float64) *QueryBuilder {
|
||||
qb.table = fmt.Sprintf("%s SAMPLE %f", qb.table, sampleRate)
|
||||
return qb
|
||||
}
|
||||
|
||||
// LimitBy 添加 LIMIT BY 子句
|
||||
func (qb *QueryBuilder) LimitBy(limit int, columns ...string) *QueryBuilder {
|
||||
qb.limit = limit
|
||||
qb.orderBy = append(qb.orderBy, fmt.Sprintf("LIMIT BY %d (%s)", limit, strings.Join(columns, ", ")))
|
||||
return qb
|
||||
}
|
||||
|
||||
// PreWhere 添加 PREWHERE 子句
|
||||
func (qb *QueryBuilder) PreWhere(condition string, args ...interface{}) *QueryBuilder {
|
||||
qb.conditions = append([]string{condition}, qb.conditions...)
|
||||
qb.params = append(args, qb.params...)
|
||||
return qb
|
||||
}
|
||||
|
||||
// Format 添加 FORMAT 子句
|
||||
func (qb *QueryBuilder) Format(format string) *QueryBuilder {
|
||||
qb.union = append(qb.union, fmt.Sprintf("FORMAT %s", format))
|
||||
return qb
|
||||
}
|
||||
|
||||
// Build 构建最终的 SQL 查询
|
||||
func (qb *QueryBuilder) Build() (string, []interface{}) {
|
||||
query := ""
|
||||
|
||||
if qb.cacheResult {
|
||||
query += "/* CACHE */ "
|
||||
}
|
||||
|
||||
query += "SELECT "
|
||||
if qb.distinct {
|
||||
query += "DISTINCT "
|
||||
}
|
||||
query += qb.buildColumns()
|
||||
query += fmt.Sprintf(" FROM %s", qb.table)
|
||||
|
||||
if qb.useIndex != "" {
|
||||
query += fmt.Sprintf(" USE INDEX (%s)", qb.useIndex)
|
||||
}
|
||||
|
||||
if len(qb.conditions) > 0 {
|
||||
query += fmt.Sprintf(" WHERE %s", strings.Join(qb.conditions, " AND "))
|
||||
}
|
||||
|
||||
if len(qb.groupBy) > 0 {
|
||||
query += fmt.Sprintf(" GROUP BY %s", strings.Join(qb.groupBy, ", "))
|
||||
}
|
||||
|
||||
if len(qb.having) > 0 {
|
||||
query += fmt.Sprintf(" HAVING %s", strings.Join(qb.having, " AND "))
|
||||
}
|
||||
|
||||
if len(qb.orderBy) > 0 {
|
||||
query += fmt.Sprintf(" ORDER BY %s", strings.Join(qb.orderBy, ", "))
|
||||
}
|
||||
|
||||
if qb.limit > 0 {
|
||||
query += fmt.Sprintf(" LIMIT %d", qb.limit)
|
||||
}
|
||||
|
||||
if qb.offset > 0 {
|
||||
query += fmt.Sprintf(" OFFSET %d", qb.offset)
|
||||
}
|
||||
|
||||
return query, qb.params
|
||||
}
|
||||
|
||||
func (qb *QueryBuilder) buildColumns() string {
|
||||
if len(qb.columns) == 0 {
|
||||
return "*"
|
||||
}
|
||||
return strings.Join(qb.columns, ", ")
|
||||
}
|
||||
|
||||
// isValidIdentifier 验证表名或列名是否合法
|
||||
func isValidIdentifier(identifier string) bool {
|
||||
// 仅允许字母、数字、下划线,且不能以数字开头
|
||||
matched, _ := regexp.MatchString(`^[a-zA-Z_][a-zA-Z0-9_]*$`, identifier)
|
||||
return matched
|
||||
}
|
||||
|
||||
// isValidCondition 验证条件语句是否合法
|
||||
func isValidCondition(condition string) bool {
|
||||
// 简单验证条件中是否包含危险字符
|
||||
return !strings.Contains(condition, ";") && !strings.Contains(condition, "--")
|
||||
}
|
||||
120
database/clickhouse/query_test.go
Normal file
120
database/clickhouse/query_test.go
Normal file
@@ -0,0 +1,120 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestQueryBuilder(t *testing.T) {
|
||||
logger := log.NewHelper(log.DefaultLogger)
|
||||
qb := NewQueryBuilder("test_table", logger)
|
||||
|
||||
// 测试 Select 方法
|
||||
qb.Select("id", "name")
|
||||
query, params := qb.Build()
|
||||
assert.Contains(t, query, "SELECT id, name FROM test_table")
|
||||
|
||||
// 测试 Distinct 方法
|
||||
qb.Distinct()
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "SELECT DISTINCT id, name FROM test_table")
|
||||
|
||||
// 测试 Where 方法
|
||||
qb.Where("id > ?", 10).Where("name = ?", "example")
|
||||
query, params = qb.Build()
|
||||
assert.Contains(t, query, "WHERE id > ? AND name = ?")
|
||||
assert.Equal(t, []interface{}{10, "example"}, params)
|
||||
|
||||
// 测试 OrderBy 方法
|
||||
qb.OrderBy("name ASC")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "ORDER BY name ASC")
|
||||
|
||||
// 测试 GroupBy 方法
|
||||
qb.GroupBy("category")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "GROUP BY category")
|
||||
|
||||
// 测试 Having 方法
|
||||
qb.Having("COUNT(id) > ?", 5)
|
||||
query, params = qb.Build()
|
||||
assert.Contains(t, query, "HAVING COUNT(id) > ?")
|
||||
assert.Equal(t, []interface{}{10, "example", 5}, params)
|
||||
|
||||
// 测试 Join 方法
|
||||
qb.Join("INNER", "other_table", "test_table.id = other_table.id")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "INNER JOIN other_table ON test_table.id = other_table.id")
|
||||
|
||||
// 测试 With 方法
|
||||
qb.With("temp AS (SELECT id FROM another_table WHERE status = 'active')")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "WITH temp AS (SELECT id FROM another_table WHERE status = 'active')")
|
||||
|
||||
// 测试 Union 方法
|
||||
qb.Union("SELECT id FROM another_table")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "UNION SELECT id FROM another_table")
|
||||
|
||||
// 测试 Limit 和 Offset 方法
|
||||
qb.Limit(10).Offset(20)
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "LIMIT 10 OFFSET 20")
|
||||
|
||||
// 测试 UseIndex 方法
|
||||
qb.UseIndex("idx_name")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "USE INDEX (idx_name)")
|
||||
|
||||
// 测试 CacheResult 方法
|
||||
qb.CacheResult()
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "/* CACHE */")
|
||||
|
||||
// 测试 EnableDebug 方法
|
||||
qb.EnableDebug()
|
||||
assert.True(t, qb.debug)
|
||||
|
||||
// 测试 ArrayJoin 方法
|
||||
qb.ArrayJoin("array_column")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "ARRAY JOIN array_column")
|
||||
|
||||
// 测试 Final 方法
|
||||
qb.Final()
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "test_table FINAL")
|
||||
|
||||
// 测试 Sample 方法
|
||||
qb.Sample(0.1)
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "test_table SAMPLE 0.100000")
|
||||
|
||||
// 测试 LimitBy 方法
|
||||
qb.LimitBy(5, "name")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "LIMIT BY 5 (name)")
|
||||
|
||||
// 测试 PreWhere 方法
|
||||
qb.PreWhere("status = ?", "active")
|
||||
query, params = qb.Build()
|
||||
assert.Contains(t, query, "PREWHERE status = ?")
|
||||
assert.Equal(t, []interface{}{"active"}, params)
|
||||
|
||||
// 测试 Format 方法
|
||||
qb.Format("JSON")
|
||||
query, _ = qb.Build()
|
||||
assert.Contains(t, query, "FORMAT JSON")
|
||||
|
||||
// 测试边界情况:空列名
|
||||
assert.Panics(t, func() {
|
||||
qb.Select("")
|
||||
}, "应该抛出异常:无效的列名")
|
||||
|
||||
// 测试边界情况:无效条件
|
||||
assert.Panics(t, func() {
|
||||
qb.Where("id = 1; DROP TABLE test_table")
|
||||
}, "应该抛出异常:无效的条件")
|
||||
}
|
||||
146
database/clickhouse/utils.go
Normal file
146
database/clickhouse/utils.go
Normal file
@@ -0,0 +1,146 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"google.golang.org/protobuf/types/known/durationpb"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
const (
|
||||
timeFormat = "2006-01-02 15:04:05.000000000"
|
||||
)
|
||||
|
||||
func structToValueArray(input any) []any {
|
||||
// 检查是否是指针类型,如果是则解引用
|
||||
val := reflect.ValueOf(input)
|
||||
if val.Kind() == reflect.Ptr {
|
||||
val = val.Elem()
|
||||
}
|
||||
|
||||
// 确保输入是结构体
|
||||
if val.Kind() != reflect.Struct {
|
||||
return nil
|
||||
}
|
||||
|
||||
var values []any
|
||||
for i := 0; i < val.NumField(); i++ {
|
||||
value := val.Field(i).Interface()
|
||||
|
||||
switch v := value.(type) {
|
||||
case *sql.NullString:
|
||||
if v.Valid {
|
||||
values = append(values, v.String)
|
||||
} else {
|
||||
values = append(values, nil)
|
||||
}
|
||||
case *sql.NullInt64:
|
||||
if v.Valid {
|
||||
values = append(values, v.Int64)
|
||||
} else {
|
||||
values = append(values, nil)
|
||||
}
|
||||
case *sql.NullFloat64:
|
||||
if v.Valid {
|
||||
values = append(values, v.Float64)
|
||||
} else {
|
||||
values = append(values, nil)
|
||||
}
|
||||
case *sql.NullBool:
|
||||
if v.Valid {
|
||||
values = append(values, v.Bool)
|
||||
} else {
|
||||
values = append(values, nil)
|
||||
}
|
||||
|
||||
case *sql.NullTime:
|
||||
if v != nil && v.Valid {
|
||||
values = append(values, v.Time.Format(timeFormat))
|
||||
} else {
|
||||
values = append(values, nil)
|
||||
}
|
||||
|
||||
case *time.Time:
|
||||
if v != nil {
|
||||
values = append(values, v.Format(timeFormat))
|
||||
} else {
|
||||
values = append(values, nil)
|
||||
}
|
||||
|
||||
case time.Time:
|
||||
// 处理 time.Time 类型
|
||||
if !v.IsZero() {
|
||||
values = append(values, v.Format(timeFormat))
|
||||
} else {
|
||||
values = append(values, nil) // 如果时间为零值,插入 NULL
|
||||
}
|
||||
|
||||
case timestamppb.Timestamp:
|
||||
// 处理 timestamppb.Timestamp 类型
|
||||
if !v.IsValid() {
|
||||
values = append(values, v.AsTime().Format(timeFormat))
|
||||
} else {
|
||||
values = append(values, nil) // 如果时间为零值,插入 NULL
|
||||
}
|
||||
|
||||
case *timestamppb.Timestamp:
|
||||
// 处理 *timestamppb.Timestamp 类型
|
||||
if v != nil && v.IsValid() {
|
||||
values = append(values, v.AsTime().Format(timeFormat))
|
||||
} else {
|
||||
values = append(values, nil) // 如果时间为零值,插入 NULL
|
||||
}
|
||||
|
||||
case durationpb.Duration:
|
||||
// 处理 timestamppb.Duration 类型
|
||||
if v.AsDuration() != 0 {
|
||||
values = append(values, v.AsDuration().String())
|
||||
} else {
|
||||
values = append(values, nil) // 如果时间为零值,插入 NULL
|
||||
}
|
||||
|
||||
case *durationpb.Duration:
|
||||
// 处理 *timestamppb.Duration 类型
|
||||
if v != nil && v.AsDuration() != 0 {
|
||||
values = append(values, v.AsDuration().String())
|
||||
} else {
|
||||
values = append(values, nil) // 如果时间为零值,插入 NULL
|
||||
}
|
||||
|
||||
case []any:
|
||||
// 处理切片类型
|
||||
if len(v) > 0 {
|
||||
for _, item := range v {
|
||||
if item == nil {
|
||||
values = append(values, nil)
|
||||
} else {
|
||||
values = append(values, item)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
values = append(values, nil) // 如果切片为空,插入 NULL
|
||||
}
|
||||
|
||||
case [][]any:
|
||||
// 处理二维切片类型
|
||||
if len(v) > 0 {
|
||||
for _, item := range v {
|
||||
if len(item) > 0 {
|
||||
values = append(values, item)
|
||||
} else {
|
||||
values = append(values, nil) // 如果子切片为空,插入 NULL
|
||||
}
|
||||
}
|
||||
} else {
|
||||
values = append(values, nil) // 如果二维切片为空,插入 NULL
|
||||
}
|
||||
|
||||
default:
|
||||
values = append(values, v)
|
||||
}
|
||||
}
|
||||
|
||||
return values
|
||||
}
|
||||
83
database/clickhouse/utils_test.go
Normal file
83
database/clickhouse/utils_test.go
Normal file
@@ -0,0 +1,83 @@
|
||||
package clickhouse
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// Ptr returns a pointer to the provided value.
|
||||
func Ptr[T any](v T) *T {
|
||||
return &v
|
||||
}
|
||||
|
||||
func TestStructToValueArrayWithCandle(t *testing.T) {
|
||||
now := time.Now()
|
||||
|
||||
candle := Candle{
|
||||
Timestamp: Ptr(now),
|
||||
Symbol: Ptr("AAPL"),
|
||||
Open: Ptr(100.5),
|
||||
High: Ptr(105.0),
|
||||
Low: Ptr(99.5),
|
||||
Close: Ptr(102.0),
|
||||
Volume: Ptr(1500.0),
|
||||
}
|
||||
|
||||
values := structToValueArray(candle)
|
||||
assert.NotNil(t, values, "Values should not be nil")
|
||||
assert.Len(t, values, 7, "Expected 7 fields in the Candle struct")
|
||||
assert.Equal(t, now.Format(timeFormat), values[0].(string), "Timestamp should match")
|
||||
assert.Equal(t, *candle.Symbol, *(values[1].(*string)), "Symbol should match")
|
||||
assert.Equal(t, *candle.Open, *values[2].(*float64), "Open price should match")
|
||||
assert.Equal(t, *candle.High, *values[3].(*float64), "High price should match")
|
||||
assert.Equal(t, *candle.Low, *values[4].(*float64), "Low price should match")
|
||||
assert.Equal(t, *candle.Close, *values[5].(*float64), "Close price should match")
|
||||
assert.Equal(t, *candle.Volume, *values[6].(*float64), "Volume should match")
|
||||
|
||||
t.Logf("QueryRow Result: [%v] Candle: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %f\n",
|
||||
values[0],
|
||||
*(values[1].(*string)),
|
||||
*values[2].(*float64),
|
||||
*values[3].(*float64),
|
||||
*values[4].(*float64),
|
||||
*values[5].(*float64),
|
||||
*values[6].(*float64),
|
||||
)
|
||||
}
|
||||
|
||||
func TestStructToValueArrayWithCandlePtr(t *testing.T) {
|
||||
now := time.Now()
|
||||
|
||||
candle := &Candle{
|
||||
Timestamp: Ptr(now),
|
||||
Symbol: Ptr("AAPL"),
|
||||
Open: Ptr(100.5),
|
||||
High: Ptr(105.0),
|
||||
Low: Ptr(99.5),
|
||||
Close: Ptr(102.0),
|
||||
Volume: Ptr(1500.0),
|
||||
}
|
||||
|
||||
values := structToValueArray(candle)
|
||||
assert.NotNil(t, values, "Values should not be nil")
|
||||
assert.Len(t, values, 7, "Expected 7 fields in the Candle struct")
|
||||
assert.Equal(t, now.Format(timeFormat), values[0].(string), "Timestamp should match")
|
||||
assert.Equal(t, *candle.Symbol, *(values[1].(*string)), "Symbol should match")
|
||||
assert.Equal(t, *candle.Open, *values[2].(*float64), "Open price should match")
|
||||
assert.Equal(t, *candle.High, *values[3].(*float64), "High price should match")
|
||||
assert.Equal(t, *candle.Low, *values[4].(*float64), "Low price should match")
|
||||
assert.Equal(t, *candle.Close, *values[5].(*float64), "Close price should match")
|
||||
assert.Equal(t, *candle.Volume, *values[6].(*float64), "Volume should match")
|
||||
|
||||
t.Logf("QueryRow Result: [%v] Candle: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %f\n",
|
||||
values[0],
|
||||
*(values[1].(*string)),
|
||||
*values[2].(*float64),
|
||||
*values[3].(*float64),
|
||||
*values[4].(*float64),
|
||||
*values[5].(*float64),
|
||||
*values[6].(*float64),
|
||||
)
|
||||
}
|
||||
32
database/elasticsearch/README.md
Normal file
32
database/elasticsearch/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# ElasticSearch
|
||||
|
||||
## 概念对比
|
||||
|
||||
| ES存储结构 | RDBMS存储结构 |
|
||||
|----------|-----------|
|
||||
| Index | 表 |
|
||||
| Document | 行 |
|
||||
| Field | 表字段 |
|
||||
| Mapping | 表结构定义 |
|
||||
|
||||
## mapping
|
||||
|
||||
- 动态映射(dynamic mapping)
|
||||
- 显式映射(explicit mapping)
|
||||
- 严格映射(strict mappings)
|
||||
|
||||
## Docker部署
|
||||
|
||||
```bash
|
||||
docker pull bitnami/elasticsearch:latest
|
||||
|
||||
docker run -itd \
|
||||
--name elasticsearch \
|
||||
-p 9200:9200 \
|
||||
-p 9300:9300 \
|
||||
-e ELASTICSEARCH_USERNAME=elastic \
|
||||
-e ELASTICSEARCH_PASSWORD=elastic \
|
||||
-e ELASTICSEARCH_NODE_NAME=elasticsearch-node-1 \
|
||||
-e ELASTICSEARCH_CLUSTER_NAME=elasticsearch-cluster \
|
||||
bitnami/elasticsearch:latest
|
||||
```
|
||||
442
database/elasticsearch/client.go
Normal file
442
database/elasticsearch/client.go
Normal file
@@ -0,0 +1,442 @@
|
||||
package elasticsearch
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
elasticsearchV9 "github.com/elastic/go-elasticsearch/v9"
|
||||
esapiV9 "github.com/elastic/go-elasticsearch/v9/esapi"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
pagination "github.com/tx7do/kratos-bootstrap/api/gen/go/pagination/v1"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
cli *elasticsearchV9.Client
|
||||
log *log.Helper
|
||||
}
|
||||
|
||||
func NewClient(logger log.Logger, cfg *conf.Bootstrap) (*Client, error) {
|
||||
c := &Client{
|
||||
log: log.NewHelper(log.With(logger, "module", "elasticsearch-client")),
|
||||
}
|
||||
|
||||
if err := c.createESClient(cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// createESClient 创建Elasticsearch客户端
|
||||
func (c *Client) createESClient(cfg *conf.Bootstrap) error {
|
||||
if cfg.Data == nil || cfg.Data.ElasticSearch == nil {
|
||||
return nil // No Elasticsearch configuration provided
|
||||
}
|
||||
|
||||
cli, err := elasticsearchV9.NewClient(
|
||||
elasticsearchV9.Config{
|
||||
Addresses: cfg.Data.ElasticSearch.GetAddresses(),
|
||||
Username: cfg.Data.ElasticSearch.GetUsername(),
|
||||
Password: cfg.Data.ElasticSearch.GetPassword(),
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to create elasticsearch client: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
c.cli = cli
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) Close() {
|
||||
|
||||
}
|
||||
|
||||
// CheckConnectStatus 检查Elasticsearch连接
|
||||
func (c *Client) CheckConnectStatus() bool {
|
||||
if c.cli == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
resp, err := c.cli.Info()
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to connect to elasticsearch: %v", err)
|
||||
return false
|
||||
}
|
||||
defer func(Body io.ReadCloser) {
|
||||
if err = Body.Close(); err != nil {
|
||||
c.log.Errorf("failed to close response body: %v", err)
|
||||
}
|
||||
}(resp.Body)
|
||||
|
||||
if resp.IsError() {
|
||||
c.log.Errorf("Error: %s", resp.String())
|
||||
return false
|
||||
}
|
||||
|
||||
var r map[string]interface{}
|
||||
if err = json.NewDecoder(resp.Body).Decode(&r); err != nil {
|
||||
log.Fatalf("Error parsing the response body: %s", err)
|
||||
return false
|
||||
}
|
||||
|
||||
c.log.Infof("Client Version: %s", elasticsearchV9.Version)
|
||||
c.log.Infof("Server Version: %s", r["version"].(map[string]interface{})["number"])
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// IndexExists 检查索引是否存在
|
||||
func (c *Client) IndexExists(ctx context.Context, indexName string) (bool, error) {
|
||||
resp, err := c.cli.Indices.Exists(
|
||||
[]string{indexName},
|
||||
c.cli.Indices.Exists.WithContext(ctx),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to check if index exists: %v", err)
|
||||
return false, err
|
||||
}
|
||||
|
||||
return !resp.IsError(), nil
|
||||
}
|
||||
|
||||
// CreateIndex 创建一条索引
|
||||
//
|
||||
// 如果mapping为空("")则表示不创建模型
|
||||
func (c *Client) CreateIndex(ctx context.Context, indexName string, mapping, settings string) error {
|
||||
exist, err := c.IndexExists(ctx, indexName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if exist {
|
||||
return ErrIndexAlreadyExists
|
||||
}
|
||||
|
||||
body, err := MergeOptions(mapping, settings)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to merge options: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
resp, err := c.cli.Indices.Create(
|
||||
indexName,
|
||||
c.cli.Indices.Create.WithContext(ctx),
|
||||
c.cli.Indices.Create.WithBody(bytes.NewReader([]byte(body))),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to create index: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if resp.IsError() {
|
||||
var errResp *ErrorResponse
|
||||
if errResp, err = ParseErrorMessage(resp.Body); err != nil {
|
||||
c.log.Errorf("failed to parse error message: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
c.log.Errorf("create index failed: %s", errResp.Error)
|
||||
|
||||
return ErrCreateIndex
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteIndex 删除一条索引
|
||||
func (c *Client) DeleteIndex(ctx context.Context, indexName string) error {
|
||||
exist, err := c.IndexExists(ctx, indexName)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to check if index exists: %v", err)
|
||||
return err
|
||||
}
|
||||
if !exist {
|
||||
return ErrIndexNotFound
|
||||
}
|
||||
|
||||
resp, err := c.cli.Indices.Delete(
|
||||
[]string{indexName},
|
||||
c.cli.Indices.Delete.WithContext(ctx),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to delete index: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if resp.IsError() {
|
||||
var errResp *ErrorResponse
|
||||
if errResp, err = ParseErrorMessage(resp.Body); err != nil {
|
||||
c.log.Errorf("failed to parse error message: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
c.log.Errorf("delete index failed: %s", errResp.Error.Reason)
|
||||
|
||||
return ErrDeleteIndex
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DeleteDocument 删除一条数据
|
||||
func (c *Client) DeleteDocument(ctx context.Context, indexName, id string) error {
|
||||
_, err := c.cli.Delete(
|
||||
indexName, id,
|
||||
c.cli.Delete.WithContext(ctx),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to delete document: %v", err)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertDocument 插入一条数据
|
||||
func (c *Client) InsertDocument(ctx context.Context, indexName, id string, data interface{}) error {
|
||||
var err error
|
||||
|
||||
var dataBytes []byte
|
||||
dataBytes, err = json.Marshal(data)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to marshal data: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
var resp *esapiV9.Response
|
||||
|
||||
if id == "" {
|
||||
resp, err = c.cli.Index(
|
||||
indexName,
|
||||
bytes.NewReader(dataBytes),
|
||||
c.cli.Index.WithContext(ctx),
|
||||
)
|
||||
} else {
|
||||
resp, err = c.cli.Create(
|
||||
indexName, id,
|
||||
bytes.NewReader(dataBytes),
|
||||
c.cli.Create.WithContext(ctx),
|
||||
)
|
||||
}
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to insert document: %v", err)
|
||||
return err
|
||||
}
|
||||
defer func(Body io.ReadCloser) {
|
||||
if err = Body.Close(); err != nil {
|
||||
c.log.Errorf("failed to close response body: %v", err)
|
||||
}
|
||||
}(resp.Body)
|
||||
|
||||
if resp.IsError() {
|
||||
var errResp *ErrorResponse
|
||||
if errResp, err = ParseErrorMessage(resp.Body); err != nil {
|
||||
c.log.Errorf("failed to parse error message: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
c.log.Errorf("insert data failed: %s", errResp.Error.Reason)
|
||||
|
||||
return ErrInsertDocument
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BatchInsertDocument 批量插入数据
|
||||
func (c *Client) BatchInsertDocument(ctx context.Context, indexName string, dataSet []interface{}) error {
|
||||
var buf bytes.Buffer
|
||||
for _, data := range dataSet {
|
||||
meta := []byte(`{"index":{}}` + "\n")
|
||||
dataBytes, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to marshal data: %v", err)
|
||||
continue
|
||||
}
|
||||
dataBytes = append(dataBytes, "\n"...)
|
||||
buf.Grow(len(meta) + len(dataBytes))
|
||||
buf.Write(meta)
|
||||
buf.Write(dataBytes)
|
||||
}
|
||||
|
||||
resp, err := c.cli.Bulk(
|
||||
bytes.NewReader(buf.Bytes()),
|
||||
c.cli.Bulk.WithContext(ctx),
|
||||
c.cli.Bulk.WithIndex(indexName),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to perform bulk insert: %v", err)
|
||||
return err
|
||||
}
|
||||
defer func(Body io.ReadCloser) {
|
||||
if err = Body.Close(); err != nil {
|
||||
c.log.Errorf("failed to close response body: %v", err)
|
||||
}
|
||||
}(resp.Body)
|
||||
|
||||
if resp.IsError() {
|
||||
var errResp *ErrorResponse
|
||||
if errResp, err = ParseErrorMessage(resp.Body); err != nil {
|
||||
c.log.Errorf("failed to parse error message: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
c.log.Errorf("batch insert data failed: %s", errResp.Error.Reason)
|
||||
|
||||
return ErrBatchInsertDocument
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) UpdateDocument(ctx context.Context, indexName string, pk string, doc interface{}) error {
|
||||
data, err := json.Marshal(doc)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to marshal data: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
_, err = c.cli.Update(
|
||||
indexName, pk,
|
||||
bytes.NewReader(data),
|
||||
c.cli.Update.WithContext(ctx),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to update document: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetDocument 查询数据
|
||||
func (c *Client) GetDocument(
|
||||
ctx context.Context,
|
||||
indexName string,
|
||||
id string,
|
||||
sourceFields []string,
|
||||
out interface{},
|
||||
) error {
|
||||
resp, err := c.cli.Get(
|
||||
indexName, id,
|
||||
c.cli.Get.WithContext(ctx),
|
||||
c.cli.Get.WithSource(sourceFields...), // 指定返回的字段
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to get document: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if resp.IsError() {
|
||||
var errResp *ErrorResponse
|
||||
if errResp, err = ParseErrorMessage(resp.Body); err != nil {
|
||||
c.log.Errorf("failed to parse error message: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
if resp.StatusCode == 404 {
|
||||
c.log.Warnf("document not found: %s", errResp.Error.Reason)
|
||||
return ErrDocumentNotFound
|
||||
}
|
||||
|
||||
c.log.Errorf("get document failed: %s", errResp.Error.Reason)
|
||||
|
||||
return ErrGetDocument
|
||||
}
|
||||
|
||||
if err = json.NewDecoder(resp.Body).Decode(&out); err != nil {
|
||||
c.log.Errorf("failed to decode document: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) Search(
|
||||
ctx context.Context,
|
||||
indexName string,
|
||||
req *pagination.PagingRequest,
|
||||
) (*SearchResult, error) {
|
||||
var query string
|
||||
ParseQueryString(req.GetQuery())
|
||||
|
||||
sortBy := make(map[string]bool)
|
||||
|
||||
pageSize := req.GetPageSize()
|
||||
if pageSize <= 0 {
|
||||
pageSize = 20 // Default page size
|
||||
}
|
||||
|
||||
return c.search(ctx, indexName, query, nil, sortBy, int(req.GetPage()), int(pageSize))
|
||||
}
|
||||
|
||||
// search 查询数据
|
||||
//
|
||||
// @param ctx 上下文
|
||||
// @param indexName 索引名
|
||||
// @param query 查询条件,例如:field1:value1 AND field2:value2
|
||||
// @param sourceFields 指定返回的字段,传入nil表示返回所有字段
|
||||
// @param sortBy 排序
|
||||
// @param from 分页的页码
|
||||
// @param pageSize 分页每页的行数
|
||||
func (c *Client) search(
|
||||
ctx context.Context,
|
||||
indexName string,
|
||||
query string,
|
||||
sourceFields []string,
|
||||
sortBy map[string]bool,
|
||||
from, pageSize int,
|
||||
) (*SearchResult, error) {
|
||||
var sorts []string
|
||||
for k, v := range sortBy {
|
||||
if v {
|
||||
sorts = append(sorts, k+":asc")
|
||||
} else {
|
||||
sorts = append(sorts, k+":desc")
|
||||
}
|
||||
}
|
||||
|
||||
resp, err := c.cli.Search(
|
||||
c.cli.Search.WithContext(ctx),
|
||||
c.cli.Search.WithIndex(indexName),
|
||||
c.cli.Search.WithFrom(from),
|
||||
c.cli.Search.WithSize(pageSize),
|
||||
c.cli.Search.WithSort(sorts...),
|
||||
c.cli.Search.WithQuery(query),
|
||||
c.cli.Search.WithSource(sourceFields...), // 指定返回的字段
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to search documents: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
defer func(Body io.ReadCloser) {
|
||||
if err := Body.Close(); err != nil {
|
||||
c.log.Errorf("failed to close response body: %v", err)
|
||||
}
|
||||
}(resp.Body)
|
||||
|
||||
if resp.IsError() {
|
||||
var errResp *ErrorResponse
|
||||
if errResp, err = ParseErrorMessage(resp.Body); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
c.log.Errorf("search document failed: %s", errResp.Error.Reason)
|
||||
|
||||
return nil, ErrSearchDocument
|
||||
}
|
||||
|
||||
var searchResult SearchResult
|
||||
if err = json.NewDecoder(resp.Body).Decode(&searchResult); err != nil {
|
||||
c.log.Errorf("failed to decode search result: %v", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &searchResult, nil
|
||||
}
|
||||
359
database/elasticsearch/client_test.go
Normal file
359
database/elasticsearch/client_test.go
Normal file
@@ -0,0 +1,359 @@
|
||||
package elasticsearch
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
const (
|
||||
userIndex = "user"
|
||||
tweetIndex = "tweet"
|
||||
sensorIndex = "sensor"
|
||||
)
|
||||
|
||||
type User struct {
|
||||
Name string `json:"name"`
|
||||
Age int `json:"age"`
|
||||
Phone string `json:"phone"`
|
||||
Birth time.Time `json:"birth"`
|
||||
Height float32 `json:"height"`
|
||||
Smoke bool `json:"smoke"`
|
||||
Home string `json:"home"`
|
||||
}
|
||||
|
||||
// UserMapping 定义用户mapping
|
||||
const UserMapping = `
|
||||
{
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"name": {"type": "text"},
|
||||
"age": {"type": "byte"},
|
||||
"phone": {"type": "text"},
|
||||
"birth": {"type": "date"},
|
||||
"height": {"type": "float"},
|
||||
"smoke": {"type": "boolean"},
|
||||
"home": {"type": "geo_point"}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
type Tweet struct {
|
||||
User string `json:"user"` // 用户
|
||||
Message string `json:"message"` // 微博内容
|
||||
Retweets int `json:"retweets"` // 转发数
|
||||
Image string `json:"image,omitempty"` // 图片
|
||||
Created time.Time `json:"created,omitempty"` // 创建时间
|
||||
Tags []string `json:"tags,omitempty"` // 标签
|
||||
Location string `json:"location,omitempty"` //位置
|
||||
//Suggest *elasticsearchV9.SuggestField `json:"suggest_field,omitempty"`
|
||||
}
|
||||
|
||||
const TweetMapping = `
|
||||
{
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"user": {"type": "keyword"},
|
||||
"message": {"type": "text"},
|
||||
"image": {"type": "keyword"},
|
||||
"created": {"type": "date"},
|
||||
"tags": {"type": "keyword"},
|
||||
"location": {"type": "geo_point"},
|
||||
"suggest_field": {"type": "completion"}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
type Sensor struct {
|
||||
Id int `json:"id" bson:"_id,omitempty"`
|
||||
Type string `json:"type" bson:"type,omitempty"`
|
||||
Location string `json:"location,omitempty" bson:"location,omitempty"`
|
||||
}
|
||||
|
||||
type SensorData struct {
|
||||
Id string `json:"id" bson:"_id,omitempty"`
|
||||
Time time.Time `json:"time" bson:"created,omitempty"`
|
||||
SensorId int `json:"sensor_id" bson:"sensor_id,omitempty"`
|
||||
Temperature float64 `json:"temperature" bson:"temperature,omitempty"`
|
||||
CPU float64 `json:"cpu" bson:"cpu,omitempty"`
|
||||
}
|
||||
|
||||
const SensorMapping = `
|
||||
{
|
||||
"mappings": {
|
||||
"properties": {
|
||||
"sensor_id": {"type": "integer"},
|
||||
"temperature": {"type": "double"},
|
||||
"cpu": {"type": "double"},
|
||||
"location": {"type": "geo_point"}
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
func createTestClient() *Client {
|
||||
cli, _ := NewClient(
|
||||
log.DefaultLogger,
|
||||
&conf.Bootstrap{
|
||||
Data: &conf.Data{
|
||||
ElasticSearch: &conf.Data_ElasticSearch{
|
||||
Addresses: []string{"http://localhost:9200"},
|
||||
Username: "elastic",
|
||||
Password: "elastic",
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
return cli
|
||||
}
|
||||
|
||||
func TestNewClient(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
client.CheckConnectStatus()
|
||||
}
|
||||
|
||||
func TestCreateIndex(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
var esCtx = context.Background()
|
||||
|
||||
{
|
||||
_ = client.DeleteIndex(esCtx, userIndex)
|
||||
err := client.CreateIndex(esCtx, userIndex, UserMapping, "")
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
{
|
||||
_ = client.DeleteIndex(esCtx, tweetIndex)
|
||||
err := client.CreateIndex(esCtx, tweetIndex, TweetMapping, "")
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
{
|
||||
_ = client.DeleteIndex(esCtx, sensorIndex)
|
||||
err := client.CreateIndex(esCtx, sensorIndex, SensorMapping, "")
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeleteIndex(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
var esCtx = context.Background()
|
||||
|
||||
err := client.DeleteIndex(esCtx, userIndex)
|
||||
assert.Nil(t, err)
|
||||
|
||||
err = client.DeleteIndex(esCtx, tweetIndex)
|
||||
assert.Nil(t, err)
|
||||
|
||||
err = client.DeleteIndex(esCtx, sensorIndex)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
func TestInsertDocument(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
var esCtx = context.Background()
|
||||
|
||||
{
|
||||
// http://localhost:9200/user/_search?q=*&pretty
|
||||
loc, _ := time.LoadLocation("Local")
|
||||
birth, _ := time.ParseInLocation("2006-01-02", "1991-04-25", loc)
|
||||
userOne := User{
|
||||
Name: "张三",
|
||||
Age: 23,
|
||||
Phone: "17600000000",
|
||||
Birth: birth,
|
||||
Height: 170.5,
|
||||
Home: "41.40338,2.17403",
|
||||
}
|
||||
|
||||
err := client.InsertDocument(esCtx, userIndex, "", userOne)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
|
||||
{
|
||||
tweetOne := Tweet{User: "olive", Message: "打酱油的一天", Retweets: 0}
|
||||
|
||||
err := client.InsertDocument(esCtx, tweetIndex, "", tweetOne)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBatchInsertDocument(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
var esCtx = context.Background()
|
||||
|
||||
{
|
||||
loc, _ := time.LoadLocation("Local")
|
||||
// 生日
|
||||
birthSlice := []string{"1991-04-25", "1990-01-15", "1989-11-05", "1988-01-25", "1994-10-12"}
|
||||
// 姓名
|
||||
nameSlice := []string{"李四", "张飞", "赵云", "关羽", "刘备"}
|
||||
|
||||
var users []interface{}
|
||||
for i := 1; i < 20; i++ {
|
||||
birth, _ := time.ParseInLocation("2006-01-02", birthSlice[rand.Intn(len(birthSlice))], loc)
|
||||
height, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", rand.Float32()+175.0), 32)
|
||||
user := User{
|
||||
Name: nameSlice[rand.Intn(len(nameSlice))],
|
||||
Age: rand.Intn(10) + 18,
|
||||
Phone: "1760000000" + strconv.Itoa(i),
|
||||
Birth: birth,
|
||||
Height: float32(height),
|
||||
Home: "41.40338,2.17403",
|
||||
}
|
||||
users = append(users, user)
|
||||
}
|
||||
|
||||
err := client.BatchInsertDocument(esCtx, userIndex, users)
|
||||
assert.Nil(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetDocument(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
var esCtx = context.Background()
|
||||
var user User
|
||||
const id = "N_1fm5cBE8GqVkmNBLNY"
|
||||
err := client.GetDocument(esCtx, userIndex, id, nil, &user)
|
||||
assert.Equal(t, err, ErrDocumentNotFound)
|
||||
assert.NotNil(t, user)
|
||||
}
|
||||
|
||||
func TestSearch(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
var esCtx = context.Background()
|
||||
|
||||
//// 创建索引并插入测试数据
|
||||
//_ = client.DeleteIndex(esCtx, userIndex)
|
||||
//err := client.CreateIndex(esCtx, userIndex, UserMapping, "")
|
||||
//assert.Nil(t, err)
|
||||
//
|
||||
//userOne := User{
|
||||
// Name: "张三",
|
||||
// Age: 23,
|
||||
// Phone: "17600000000",
|
||||
// Height: 170.5,
|
||||
// Home: "41.40338,2.17403",
|
||||
//}
|
||||
//err = client.InsertDocument(esCtx, userIndex, "", userOne)
|
||||
//assert.Nil(t, err)
|
||||
|
||||
// 测试Search方法
|
||||
query := "name:张三"
|
||||
sortBy := map[string]bool{"age": true}
|
||||
from := 0
|
||||
pageSize := 10
|
||||
|
||||
searchResult, err := client.search(
|
||||
esCtx, userIndex, query, nil, sortBy, from, pageSize,
|
||||
)
|
||||
assert.Nil(t, err)
|
||||
assert.NotNil(t, searchResult)
|
||||
|
||||
var users []User
|
||||
for _, hit := range searchResult.Hits.Hits {
|
||||
var user User
|
||||
if err = json.Unmarshal(hit.Source, &user); err != nil {
|
||||
t.Errorf("Failed to unmarshal hit: %v", err)
|
||||
continue
|
||||
}
|
||||
users = append(users, user)
|
||||
}
|
||||
t.Logf("Search result: %v", users)
|
||||
}
|
||||
|
||||
func TestMergeOptions(t *testing.T) {
|
||||
mapping := `{
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "text"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer"
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
settings := `{
|
||||
"index": {
|
||||
"number_of_shards": 1,
|
||||
"number_of_replicas": 0
|
||||
}
|
||||
}`
|
||||
|
||||
//expected := `{"mappings":{"properties":{"name":{"type":"text"},"age":{"type":"integer"}}},"settings":{"index":{"number_of_shards":1,"number_of_replicas":0}}}`
|
||||
|
||||
result, err := MergeOptions(mapping, settings)
|
||||
assert.Nil(t, err)
|
||||
//assert.Equal(t, expected, result)
|
||||
t.Log(result)
|
||||
}
|
||||
|
||||
func TestParseQueryString(t *testing.T) {
|
||||
// 测试单个键值对的查询字符串
|
||||
query := `{"name":"张三"}`
|
||||
result := ParseQueryString(query)
|
||||
assert.NotNil(t, result)
|
||||
assert.Equal(t, []string{"name:张三"}, result)
|
||||
|
||||
// 测试多个键值对的查询字符串
|
||||
query = `[{"name":"张三"},{"age":"23"}]`
|
||||
result = ParseQueryString(query)
|
||||
assert.NotNil(t, result)
|
||||
assert.Equal(t, []string{"name:张三", "age:23"}, result)
|
||||
|
||||
t.Log(strings.Join(result, " AND "))
|
||||
|
||||
// 测试无效的查询字符串
|
||||
query = `invalid`
|
||||
result = ParseQueryString(query)
|
||||
assert.Nil(t, result)
|
||||
}
|
||||
|
||||
func TestMakeQueryString(t *testing.T) {
|
||||
// 测试 AND 查询
|
||||
andQuery := `{"name":"张三","age":"23"}`
|
||||
orQuery := ``
|
||||
result := MakeQueryString(andQuery, orQuery)
|
||||
assert.Equal(t, "name:张三 AND age:23", result)
|
||||
|
||||
// 测试 OR 查询
|
||||
andQuery = ``
|
||||
orQuery = `[{"city":"北京"},{"country":"中国"}]`
|
||||
result = MakeQueryString(andQuery, orQuery)
|
||||
assert.Equal(t, "city:北京 OR country:中国", result)
|
||||
|
||||
// 测试 AND 和 OR 查询同时存在
|
||||
andQuery = `{"name":"张三"}`
|
||||
orQuery = `[{"city":"北京"},{"country":"中国"}]`
|
||||
result = MakeQueryString(andQuery, orQuery)
|
||||
assert.Equal(t, "name:张三 AND (city:北京 OR country:中国)", result)
|
||||
|
||||
// 测试空查询
|
||||
andQuery = ``
|
||||
orQuery = ``
|
||||
result = MakeQueryString(andQuery, orQuery)
|
||||
assert.Equal(t, "", result)
|
||||
}
|
||||
38
database/elasticsearch/errors.go
Normal file
38
database/elasticsearch/errors.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package elasticsearch
|
||||
|
||||
import "github.com/go-kratos/kratos/v2/errors"
|
||||
|
||||
var (
|
||||
// ErrRequestFailed is returned when a request to Elasticsearch fails.
|
||||
ErrRequestFailed = errors.InternalServer("REQUEST_FAILED", "request failed")
|
||||
|
||||
// ErrIndexNotFound is returned when the specified index does not exist.
|
||||
ErrIndexNotFound = errors.InternalServer("INDEX_NOT_FOUND", "index not found")
|
||||
|
||||
// ErrIndexAlreadyExists is returned when trying to create an index that already exists.
|
||||
ErrIndexAlreadyExists = errors.InternalServer("INDEX_ALREADY_EXISTS", "index already exists")
|
||||
|
||||
ErrCreateIndex = errors.InternalServer("CREATE_INDEX_FAILED", "failed to create index")
|
||||
|
||||
ErrDeleteIndex = errors.InternalServer("DELETE_INDEX_FAILED", "failed to delete index")
|
||||
|
||||
// ErrDocumentNotFound is returned when a document is not found in the index.
|
||||
ErrDocumentNotFound = errors.InternalServer("DOCUMENT_NOT_FOUND", "document not found")
|
||||
|
||||
// ErrDocumentAlreadyExists is returned when trying to create a document that already exists.
|
||||
ErrDocumentAlreadyExists = errors.InternalServer("DOCUMENT_ALREADY_EXISTS", "document already exists")
|
||||
|
||||
// ErrInvalidQuery is returned when the query provided to Elasticsearch is invalid.
|
||||
ErrInvalidQuery = errors.InternalServer("INVALID_QUERY", "invalid query")
|
||||
|
||||
// ErrUnmarshalResponse is returned when the response from Elasticsearch cannot be unmarshalled.
|
||||
ErrUnmarshalResponse = errors.InternalServer("UNMARSHAL_RESPONSE_FAILED", "failed to unmarshal response")
|
||||
|
||||
ErrInsertDocument = errors.InternalServer("INSERT_DOCUMENT_FAILED", "failed to insert document")
|
||||
|
||||
ErrBatchInsertDocument = errors.InternalServer("BATCH_INSERT_DOCUMENT_FAILED", "failed to batch insert documents")
|
||||
|
||||
ErrGetDocument = errors.InternalServer("GET_DOCUMENT_FAILED", "failed to get document")
|
||||
|
||||
ErrSearchDocument = errors.InternalServer("SEARCH_DOCUMENT_FAILED", "failed to search document")
|
||||
)
|
||||
36
database/elasticsearch/go.mod
Normal file
36
database/elasticsearch/go.mod
Normal file
@@ -0,0 +1,36 @@
|
||||
module github.com/tx7do/kratos-bootstrap/database/elasticsearch
|
||||
|
||||
go 1.23.0
|
||||
|
||||
toolchain go1.23.3
|
||||
|
||||
replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/elastic/go-elasticsearch/v9 v9.0.0
|
||||
github.com/go-kratos/kratos/v2 v2.8.4
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.27
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/elastic/elastic-transport-go/v8 v8.7.0 // indirect
|
||||
github.com/go-logr/logr v1.4.3 // indirect
|
||||
github.com/go-logr/stdr v1.2.2 // indirect
|
||||
github.com/google/gnostic v0.7.0 // indirect
|
||||
github.com/google/gnostic-models v0.7.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
|
||||
go.opentelemetry.io/otel v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/metric v1.37.0 // indirect
|
||||
go.opentelemetry.io/otel/trace v1.37.0 // indirect
|
||||
go.yaml.in/yaml/v3 v3.0.3 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sync v0.14.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
|
||||
google.golang.org/grpc v1.73.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
1567
database/elasticsearch/go.sum
Normal file
1567
database/elasticsearch/go.sum
Normal file
File diff suppressed because it is too large
Load Diff
38
database/elasticsearch/types.go
Normal file
38
database/elasticsearch/types.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package elasticsearch
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// ErrorResponse 表示 Elasticsearch 错误响应的结构
|
||||
type ErrorResponse struct {
|
||||
Error struct {
|
||||
RootCause []struct {
|
||||
Type string `json:"type"`
|
||||
Reason string `json:"reason"`
|
||||
} `json:"root_cause"`
|
||||
Type string `json:"type"`
|
||||
Reason string `json:"reason"`
|
||||
CausedBy struct {
|
||||
Type string `json:"type"`
|
||||
Reason string `json:"reason"`
|
||||
} `json:"caused_by,omitempty"`
|
||||
} `json:"error"`
|
||||
Status int `json:"status"`
|
||||
}
|
||||
|
||||
type SearchResult struct {
|
||||
Took int `json:"took"`
|
||||
TimedOut bool `json:"timed_out"`
|
||||
Hits struct {
|
||||
Total struct {
|
||||
Value int `json:"value"`
|
||||
Relation string `json:"relation"`
|
||||
} `json:"total"`
|
||||
Hits []struct {
|
||||
Index string `json:"_index"`
|
||||
Type string `json:"_type"`
|
||||
ID string `json:"_id"`
|
||||
Score float64 `json:"_score"`
|
||||
Source json.RawMessage `json:"_source"`
|
||||
} `json:"hits"`
|
||||
} `json:"hits"`
|
||||
}
|
||||
111
database/elasticsearch/utils.go
Normal file
111
database/elasticsearch/utils.go
Normal file
@@ -0,0 +1,111 @@
|
||||
package elasticsearch
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/encoding"
|
||||
_ "github.com/go-kratos/kratos/v2/encoding/json"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
)
|
||||
|
||||
// ParseErrorMessage 解析 Elasticsearch 错误消息
|
||||
func ParseErrorMessage(body io.ReadCloser) (*ErrorResponse, error) {
|
||||
defer body.Close()
|
||||
|
||||
var errorResponse ErrorResponse
|
||||
if err := json.NewDecoder(body).Decode(&errorResponse); err != nil {
|
||||
return nil, ErrUnmarshalResponse
|
||||
}
|
||||
|
||||
return &errorResponse, nil
|
||||
}
|
||||
|
||||
// MergeOptions 合并 Elasticsearch 索引的映射和设置
|
||||
func MergeOptions(mapping, settings string) (string, error) {
|
||||
codec := encoding.GetCodec("json")
|
||||
|
||||
body := make(map[string]interface{})
|
||||
|
||||
if mapping != "" {
|
||||
var mappingObj map[string]interface{}
|
||||
if err := codec.Unmarshal([]byte(mapping), &mappingObj); err != nil {
|
||||
log.Errorf("failed to unmarshal mapping: %v", err)
|
||||
return "", err
|
||||
}
|
||||
if existingMappings, ok := mappingObj["mappings"]; ok {
|
||||
body["mappings"] = existingMappings
|
||||
} else {
|
||||
body["mappings"] = mappingObj
|
||||
}
|
||||
}
|
||||
|
||||
if settings != "" {
|
||||
var settingsObj map[string]interface{}
|
||||
if err := codec.Unmarshal([]byte(settings), &settingsObj); err != nil {
|
||||
log.Errorf("failed to unmarshal settings: %v", err)
|
||||
return "", err
|
||||
}
|
||||
// 检查 settings 是否包含 settings 字段
|
||||
if existingSettings, ok := settingsObj["settings"]; ok {
|
||||
body["settings"] = existingSettings
|
||||
} else {
|
||||
body["settings"] = settingsObj
|
||||
}
|
||||
}
|
||||
|
||||
bodyBytes, err := codec.Marshal(body)
|
||||
if err != nil {
|
||||
log.Errorf("failed to marshal request body: %v", err)
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(bodyBytes), nil
|
||||
}
|
||||
|
||||
func ParseQueryString(query string) []string {
|
||||
codec := encoding.GetCodec("json")
|
||||
|
||||
var err error
|
||||
queryMap := make(map[string]string)
|
||||
if err = codec.Unmarshal([]byte(query), &queryMap); err == nil {
|
||||
var queries []string
|
||||
for k, v := range queryMap {
|
||||
queries = append(queries, k+":"+v)
|
||||
}
|
||||
return queries
|
||||
}
|
||||
|
||||
var queryMapArray []map[string]string
|
||||
if err = codec.Unmarshal([]byte(query), &queryMapArray); err == nil {
|
||||
var queries []string
|
||||
for _, item := range queryMapArray {
|
||||
for k, v := range item {
|
||||
queries = append(queries, k+":"+v)
|
||||
}
|
||||
}
|
||||
return queries
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func MakeQueryString(andQuery, orQuery string) string {
|
||||
a := ParseQueryString(andQuery)
|
||||
o := ParseQueryString(orQuery)
|
||||
|
||||
if len(a) == 0 && len(o) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
if len(a) > 0 && len(o) == 0 {
|
||||
return strings.Join(a, " AND ")
|
||||
} else if len(a) == 0 && len(o) > 0 {
|
||||
return strings.Join(o, " OR ")
|
||||
} else if len(a) > 0 && len(o) > 0 {
|
||||
return strings.Join(a, " AND ") + " AND (" + strings.Join(o, " OR ") + ")"
|
||||
} else {
|
||||
return strings.Join(a, " AND ") + " AND " + strings.Join(o, " OR ")
|
||||
}
|
||||
}
|
||||
56
database/influxdb/README.md
Normal file
56
database/influxdb/README.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# InfluxDB
|
||||
|
||||
### Docker部署
|
||||
|
||||
pull image
|
||||
|
||||
```bash
|
||||
docker pull bitnami/influxdb:latest
|
||||
```
|
||||
|
||||
#### 2.x
|
||||
|
||||
```bash
|
||||
docker run -itd \
|
||||
--name influxdb2-server \
|
||||
-p 8086:8086 \
|
||||
-e INFLUXDB_HTTP_AUTH_ENABLED=true \
|
||||
-e INFLUXDB_ADMIN_USER=admin \
|
||||
-e INFLUXDB_ADMIN_USER_PASSWORD=123456789 \
|
||||
-e INFLUXDB_ADMIN_USER_TOKEN=admintoken123 \
|
||||
-e INFLUXDB_DB=my_database \
|
||||
bitnami/influxdb:2.7.11
|
||||
```
|
||||
|
||||
create admin user sql script:
|
||||
|
||||
```sql
|
||||
create user "admin" with password '123456789' with all privileges
|
||||
```
|
||||
|
||||
管理后台: <http://localhost:8086/>
|
||||
|
||||
#### 3.x
|
||||
|
||||
```bash
|
||||
docker run -itd \
|
||||
--name influxdb3-server \
|
||||
-p 8181:8181 \
|
||||
-e INFLUXDB_NODE_ID=0 \
|
||||
-e INFLUXDB_HTTP_PORT_NUMBER=8181 \
|
||||
-e INFLUXDB_HTTP_AUTH_ENABLED=true \
|
||||
-e INFLUXDB_CREATE_ADMIN_TOKEN=yes \
|
||||
-e INFLUXDB_DB=my_database \
|
||||
bitnami/influxdb:latest
|
||||
|
||||
docker run -itd \
|
||||
--name influxdb3-explorer \
|
||||
-p 8888:80 \
|
||||
-p 8889:8888 \
|
||||
quay.io/influxdb/influxdb3-explorer:latest \
|
||||
--mode=admin
|
||||
```
|
||||
|
||||
这个版本分离出来一个管理后台 InfluxDB Explorer:<http://localhost:8888/>
|
||||
|
||||
在管理后台填写:`http://host.docker.internal:8181`
|
||||
@@ -1,29 +1,144 @@
|
||||
package influxdb
|
||||
|
||||
import (
|
||||
"github.com/InfluxCommunity/influxdb3-go/influxdb3"
|
||||
"context"
|
||||
|
||||
"github.com/InfluxCommunity/influxdb3-go/v2/influxdb3"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
func NewInfluxClient(cfg *conf.Bootstrap, l *log.Helper) *influxdb3.Client {
|
||||
type Client struct {
|
||||
cli *influxdb3.Client
|
||||
|
||||
log *log.Helper
|
||||
}
|
||||
|
||||
func NewClient(logger log.Logger, cfg *conf.Bootstrap) (*Client, error) {
|
||||
c := &Client{
|
||||
log: log.NewHelper(log.With(logger, "module", "influxdb-client")),
|
||||
}
|
||||
|
||||
if err := c.createInfluxdbClient(cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// createInfluxdbClient 创建InfluxDB客户端
|
||||
func (c *Client) createInfluxdbClient(cfg *conf.Bootstrap) error {
|
||||
if cfg.Data == nil || cfg.Data.Influxdb == nil {
|
||||
l.Warn("influxdb config is nil")
|
||||
return nil
|
||||
}
|
||||
|
||||
client, err := influxdb3.New(influxdb3.ClientConfig{
|
||||
Host: cfg.Data.Influxdb.Address,
|
||||
Token: cfg.Data.Influxdb.Token,
|
||||
Database: cfg.Data.Influxdb.Bucket,
|
||||
Organization: cfg.Data.Influxdb.Organization,
|
||||
Host: cfg.Data.Influxdb.GetHost(),
|
||||
Token: cfg.Data.Influxdb.GetToken(),
|
||||
Database: cfg.Data.Influxdb.GetDatabase(),
|
||||
Organization: cfg.Data.Influxdb.GetOrganization(),
|
||||
})
|
||||
if err != nil {
|
||||
l.Fatalf("failed opening connection to influxdb: %v", err)
|
||||
return nil
|
||||
c.log.Errorf("failed to create influxdb client: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
return client
|
||||
c.cli = client
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close 关闭InfluxDB客户端
|
||||
func (c *Client) Close() {
|
||||
if c.cli == nil {
|
||||
c.log.Warn("influxdb client is nil, nothing to close")
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.cli.Close(); err != nil {
|
||||
c.log.Errorf("failed to close influxdb client: %v", err)
|
||||
} else {
|
||||
c.log.Info("influxdb client closed successfully")
|
||||
}
|
||||
}
|
||||
|
||||
// Query 查询数据
|
||||
func (c *Client) Query(ctx context.Context, query string) (*influxdb3.QueryIterator, error) {
|
||||
if c.cli == nil {
|
||||
return nil, ErrInfluxDBClientNotInitialized
|
||||
}
|
||||
|
||||
result, err := c.cli.Query(
|
||||
ctx,
|
||||
query,
|
||||
influxdb3.WithQueryType(influxdb3.InfluxQL),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to query data: %v", err)
|
||||
return nil, ErrInfluxDBQueryFailed
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (c *Client) QueryWithParams(
|
||||
ctx context.Context,
|
||||
table string,
|
||||
filters map[string]interface{},
|
||||
operators map[string]string,
|
||||
fields []string,
|
||||
) (*influxdb3.QueryIterator, error) {
|
||||
if c.cli == nil {
|
||||
return nil, ErrInfluxDBClientNotInitialized
|
||||
}
|
||||
|
||||
query := BuildQueryWithParams(table, filters, operators, fields)
|
||||
result, err := c.cli.Query(
|
||||
ctx,
|
||||
query,
|
||||
influxdb3.WithQueryType(influxdb3.InfluxQL),
|
||||
)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to query data: %v", err)
|
||||
return nil, ErrInfluxDBQueryFailed
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
// Insert 插入数据
|
||||
func (c *Client) Insert(ctx context.Context, point *influxdb3.Point) error {
|
||||
if c.cli == nil {
|
||||
return ErrInfluxDBClientNotInitialized
|
||||
}
|
||||
if point == nil {
|
||||
return ErrInvalidPoint
|
||||
}
|
||||
|
||||
points := []*influxdb3.Point{point}
|
||||
if err := c.cli.WritePoints(ctx, points); err != nil {
|
||||
c.log.Errorf("failed to insert data: %v", err)
|
||||
return ErrInsertFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入数据
|
||||
func (c *Client) BatchInsert(ctx context.Context, points []*influxdb3.Point) error {
|
||||
if c.cli == nil {
|
||||
return ErrInfluxDBClientNotInitialized
|
||||
}
|
||||
|
||||
if len(points) == 0 {
|
||||
return ErrNoPointsToInsert
|
||||
}
|
||||
|
||||
if err := c.cli.WritePoints(ctx, points); err != nil {
|
||||
c.log.Errorf("failed to batch insert data: %v", err)
|
||||
return ErrBatchInsertFailed
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
211
database/influxdb/client_test.go
Normal file
211
database/influxdb/client_test.go
Normal file
@@ -0,0 +1,211 @@
|
||||
package influxdb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/InfluxCommunity/influxdb3-go/v2/influxdb3"
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/tx7do/go-utils/trans"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
type Candle struct {
|
||||
Symbol *string
|
||||
Open *float64
|
||||
High *float64
|
||||
Low *float64
|
||||
Close *float64
|
||||
Volume *float64
|
||||
StartTime *timestamppb.Timestamp
|
||||
}
|
||||
|
||||
func (c *Candle) GetSymbol() string {
|
||||
if c.Symbol != nil {
|
||||
return *c.Symbol
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (c *Candle) GetOpen() float64 {
|
||||
if c.Open != nil {
|
||||
return *c.Open
|
||||
}
|
||||
return 0.0
|
||||
}
|
||||
|
||||
func (c *Candle) GetHigh() float64 {
|
||||
if c.High != nil {
|
||||
return *c.High
|
||||
}
|
||||
return 0.0
|
||||
}
|
||||
|
||||
func (c *Candle) GetLow() float64 {
|
||||
if c.Low != nil {
|
||||
return *c.Low
|
||||
}
|
||||
return 0.0
|
||||
}
|
||||
|
||||
func (c *Candle) GetClose() float64 {
|
||||
if c.Close != nil {
|
||||
return *c.Close
|
||||
}
|
||||
return 0.0
|
||||
}
|
||||
|
||||
func (c *Candle) GetVolume() float64 {
|
||||
if c.Volume != nil {
|
||||
return *c.Volume
|
||||
}
|
||||
return 0.0
|
||||
}
|
||||
|
||||
func (c *Candle) GetStartTime() *timestamppb.Timestamp {
|
||||
if c.StartTime != nil {
|
||||
return c.StartTime
|
||||
}
|
||||
return timestamppb.Now()
|
||||
}
|
||||
|
||||
type CandleMapper struct{}
|
||||
|
||||
var candleMapper CandleMapper
|
||||
|
||||
func (m *CandleMapper) ToPoint(data *Candle) *influxdb3.Point {
|
||||
p := influxdb3.NewPoint(
|
||||
"candles",
|
||||
map[string]string{"s": data.GetSymbol()},
|
||||
nil,
|
||||
data.StartTime.AsTime(),
|
||||
)
|
||||
|
||||
p.
|
||||
SetDoubleField("o", data.GetOpen()).
|
||||
SetDoubleField("h", data.GetHigh()).
|
||||
SetDoubleField("l", data.GetLow()).
|
||||
SetDoubleField("c", data.GetClose()).
|
||||
SetDoubleField("v", data.GetVolume())
|
||||
|
||||
return p
|
||||
}
|
||||
|
||||
func (m *CandleMapper) ToData(point *influxdb3.Point) *Candle {
|
||||
symbol, _ := point.GetTag("s")
|
||||
|
||||
return &Candle{
|
||||
Symbol: &symbol,
|
||||
Open: point.GetDoubleField("o"),
|
||||
High: point.GetDoubleField("h"),
|
||||
Low: point.GetDoubleField("l"),
|
||||
Close: point.GetDoubleField("c"),
|
||||
Volume: point.GetDoubleField("v"),
|
||||
StartTime: timestamppb.New(point.Values.Timestamp),
|
||||
}
|
||||
}
|
||||
|
||||
func createTestClient() *Client {
|
||||
cli, _ := NewClient(
|
||||
log.DefaultLogger,
|
||||
&conf.Bootstrap{
|
||||
Data: &conf.Data{
|
||||
Influxdb: &conf.Data_InfluxDB{
|
||||
Host: "http://localhost:8181",
|
||||
Token: "apiv3_yYde4mJo0BYC7Ipi_00ZEex-A8if4swdqTBXiO-lCUDKhsIavHlRCQfo3p_DzI7S34ADHOC7Qxf600VVgW6LQQ",
|
||||
Database: "finances",
|
||||
Organization: "primary",
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
return cli
|
||||
}
|
||||
|
||||
func TestNewClient(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
}
|
||||
|
||||
func TestClient_Insert(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
item := &Candle{
|
||||
StartTime: timestamppb.New(time.Now()),
|
||||
Symbol: trans.Ptr("AAPL"),
|
||||
Open: trans.Ptr(1.0),
|
||||
High: trans.Ptr(2.0),
|
||||
Low: trans.Ptr(3.0),
|
||||
Close: trans.Ptr(4.0),
|
||||
Volume: trans.Ptr(1000.0),
|
||||
}
|
||||
|
||||
point := candleMapper.ToPoint(item)
|
||||
|
||||
err := client.Insert(context.Background(), point)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestClient_BatchInsert(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
items := []*Candle{
|
||||
{
|
||||
StartTime: timestamppb.New(time.Now()),
|
||||
Symbol: trans.Ptr("AAPL"),
|
||||
Open: trans.Ptr(1.0),
|
||||
High: trans.Ptr(2.0),
|
||||
Low: trans.Ptr(3.0),
|
||||
Close: trans.Ptr(4.0),
|
||||
Volume: trans.Ptr(1000.0),
|
||||
},
|
||||
}
|
||||
|
||||
var points []*influxdb3.Point
|
||||
for _, item := range items {
|
||||
point := candleMapper.ToPoint(item)
|
||||
points = append(points, point)
|
||||
}
|
||||
|
||||
err := client.BatchInsert(
|
||||
context.Background(),
|
||||
points,
|
||||
)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
|
||||
func TestClient_Query(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
sql := `SELECT * FROM candles`
|
||||
|
||||
iterator, err := client.Query(ctx, sql)
|
||||
assert.NoError(t, err)
|
||||
|
||||
for iterator.Next() {
|
||||
point, _ := iterator.AsPoints().AsPoint()
|
||||
candle := candleMapper.ToData(point)
|
||||
t.Logf("[%v] Candle: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %f\n",
|
||||
candle.GetStartTime().AsTime().String(),
|
||||
candle.GetSymbol(),
|
||||
candle.GetOpen(), candle.GetHigh(), candle.GetLow(), candle.GetClose(), candle.GetVolume(),
|
||||
)
|
||||
}
|
||||
|
||||
candles, err := Query(ctx, client, sql, &candleMapper)
|
||||
assert.NoError(t, err)
|
||||
for _, candle := range candles {
|
||||
t.Logf("Candle: %s, Open: %f, High: %f, Low: %f, Close: %f, Volume: %f\n",
|
||||
candle.GetSymbol(),
|
||||
candle.GetOpen(), candle.GetHigh(), candle.GetLow(), candle.GetClose(), candle.GetVolume(),
|
||||
)
|
||||
}
|
||||
}
|
||||
25
database/influxdb/errors.go
Normal file
25
database/influxdb/errors.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package influxdb
|
||||
|
||||
import "github.com/go-kratos/kratos/v2/errors"
|
||||
|
||||
var (
|
||||
ErrInfluxDBClientNotInitialized = errors.InternalServer("INFLUXDB_CLIENT_NOT_INITIALIZED", "client not initialized")
|
||||
|
||||
ErrInfluxDBConnectFailed = errors.InternalServer("INFLUXDB_CONNECT_FAILED", "connect failed")
|
||||
|
||||
ErrInfluxDBCreateDatabaseFailed = errors.InternalServer("INFLUXDB_CREATE_DATABASE_FAILED", "database create failed")
|
||||
|
||||
ErrInfluxDBQueryFailed = errors.InternalServer("INFLUXDB_QUERY_FAILED", "query failed")
|
||||
|
||||
ErrClientNotConnected = errors.InternalServer("INFLUXDB_CLIENT_NOT_CONNECTED", "client not connected")
|
||||
|
||||
ErrInvalidPoint = errors.InternalServer("INFLUXDB_INVALID_POINT", "invalid point")
|
||||
|
||||
ErrNoPointsToInsert = errors.InternalServer("INFLUXDB_NO_POINTS_TO_INSERT", "no points to insert")
|
||||
|
||||
ErrEmptyData = errors.InternalServer("INFLUXDB_EMPTY_DATA", "empty data")
|
||||
|
||||
ErrBatchInsertFailed = errors.InternalServer("INFLUXDB_BATCH_INSERT_FAILED", "batch insert failed")
|
||||
|
||||
ErrInsertFailed = errors.InternalServer("INFLUXDB_INSERT_FAILED", "insert failed")
|
||||
)
|
||||
@@ -1,36 +1,42 @@
|
||||
module github.com/tx7do/kratos-bootstrap/database/influxdb
|
||||
|
||||
go 1.23.0
|
||||
go 1.23.10
|
||||
|
||||
toolchain go1.23.3
|
||||
toolchain go1.24.4
|
||||
|
||||
replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/InfluxCommunity/influxdb3-go v0.14.0
|
||||
github.com/InfluxCommunity/influxdb3-go/v2 v2.8.0
|
||||
github.com/go-kratos/kratos/v2 v2.8.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.21
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/tx7do/go-utils v1.1.29
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.27
|
||||
google.golang.org/protobuf v1.36.6
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/apache/arrow/go/v15 v15.0.2 // indirect
|
||||
github.com/apache/arrow-go/v18 v18.3.1 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/frankban/quicktest v1.14.0 // indirect
|
||||
github.com/goccy/go-json v0.10.5 // indirect
|
||||
github.com/google/flatbuffers v25.2.10+incompatible // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/influxdata/line-protocol/v2 v2.2.1 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.11 // indirect
|
||||
github.com/pierrec/lz4/v4 v4.1.22 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/zeebo/xxh3 v1.0.2 // indirect
|
||||
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b // indirect
|
||||
golang.org/x/mod v0.24.0 // indirect
|
||||
golang.org/x/net v0.40.0 // indirect
|
||||
golang.org/x/sync v0.14.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b // indirect
|
||||
golang.org/x/mod v0.25.0 // indirect
|
||||
golang.org/x/net v0.41.0 // indirect
|
||||
golang.org/x/sync v0.15.0 // indirect
|
||||
golang.org/x/sys v0.33.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
golang.org/x/tools v0.33.0 // indirect
|
||||
golang.org/x/text v0.26.0 // indirect
|
||||
golang.org/x/tools v0.34.0 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
|
||||
google.golang.org/grpc v1.72.2 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
|
||||
google.golang.org/grpc v1.73.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
github.com/InfluxCommunity/influxdb3-go v0.14.0 h1:lFEJRZM+hQzuCz36k6YKeE6CE9oKBfKkIO2bYLghar0=
|
||||
github.com/InfluxCommunity/influxdb3-go v0.14.0/go.mod h1:+0XXsEt0XMP0o7WBvDXLCJ8MxmxfgjG3mLrYPRRWsLs=
|
||||
github.com/apache/arrow/go/v15 v15.0.2 h1:60IliRbiyTWCWjERBCkO1W4Qun9svcYoZrSLcyOsMLE=
|
||||
github.com/apache/arrow/go/v15 v15.0.2/go.mod h1:DGXsR3ajT524njufqf95822i+KTh+yea1jass9YXgjA=
|
||||
github.com/InfluxCommunity/influxdb3-go/v2 v2.8.0 h1:auHy7TmHQJVRs+r59k+UIlN9yuY4eFq7d6xrsGSo0E8=
|
||||
github.com/InfluxCommunity/influxdb3-go/v2 v2.8.0/go.mod h1:wccnTQV9OQ9XvW7ttXINSccyzSmaADzYFheoCHW2sCs=
|
||||
github.com/andybalholm/brotli v1.1.1 h1:PR2pgnyFznKEugtsUo0xLdDop5SKXd5Qf5ysW+7XdTA=
|
||||
github.com/andybalholm/brotli v1.1.1/go.mod h1:05ib4cKhjx3OQYUY22hTVd34Bc8upXjOLL2rKwwZBoA=
|
||||
github.com/apache/arrow-go/v18 v18.3.1 h1:oYZT8FqONiK74JhlH3WKVv+2NKYoyZ7C2ioD4Dj3ixk=
|
||||
github.com/apache/arrow-go/v18 v18.3.1/go.mod h1:12QBya5JZT6PnBihi5NJTzbACrDGXYkrgjujz3MRQXU=
|
||||
github.com/apache/thrift v0.21.0 h1:tdPmh/ptjE1IJnhbhrcl2++TauVjy242rkV/UzJChnE=
|
||||
github.com/apache/thrift v0.21.0/go.mod h1:W1H8aR/QRtYNvrPeFXBtobyRkd0/YVhTc6i07XIAgDw=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
@@ -20,13 +24,15 @@ github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
||||
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/flatbuffers v25.2.10+incompatible h1:F3vclr7C3HpB1k9mxCGRMXq6FdUalZ6H/pNX4FP1v0Q=
|
||||
github.com/google/flatbuffers v25.2.10+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/influxdata/line-protocol-corpus v0.0.0-20210519164801-ca6fa5da0184/go.mod h1:03nmhxzZ7Xk2pdG+lmMd7mHDfeVOYFyhOgwO61qWU98=
|
||||
@@ -36,10 +42,12 @@ github.com/influxdata/line-protocol/v2 v2.0.0-20210312151457-c52fdecb625a/go.mod
|
||||
github.com/influxdata/line-protocol/v2 v2.1.0/go.mod h1:QKw43hdUBg3GTk2iC3iyCxksNj7PX9aUSeYOYE/ceHY=
|
||||
github.com/influxdata/line-protocol/v2 v2.2.1 h1:EAPkqJ9Km4uAxtMRgUubJyqAr6zgWM0dznKMLRauQRE=
|
||||
github.com/influxdata/line-protocol/v2 v2.2.1/go.mod h1:DmB3Cnh+3oxmG6LOBIxce4oaL4CPj3OmMPgvauXh+tM=
|
||||
github.com/klauspost/asmfmt v1.3.2 h1:4Ri7ox3EwapiOjCki+hw14RyKk201CN4rzyCJRFLpK4=
|
||||
github.com/klauspost/asmfmt v1.3.2/go.mod h1:AG8TuvYojzulgDAMCnYn50l/5QV3Bs/tp6j0HLHbNSE=
|
||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/klauspost/cpuid/v2 v2.2.11 h1:0OwqZRYI2rFrjS4kvkDnqJkKHdHaRnCm68/DY4OxRzU=
|
||||
github.com/klauspost/cpuid/v2 v2.2.11/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||
@@ -49,6 +57,10 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8 h1:AMFGa4R4MiIpspGNG7Z948v4n35fFGB3RR3G/ry4FWs=
|
||||
github.com/minio/asm2plan9s v0.0.0-20200509001527-cdd76441f9d8/go.mod h1:mC1jAcsrzbxHt8iiaC+zU4b1ylILSosueou12R++wfY=
|
||||
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3 h1:+n/aFZefKZp7spd8DFdX7uMikMLXX4oubIzJF4kv/wI=
|
||||
github.com/minio/c2goasm v0.0.0-20190812172519-36a3d3bbc4f3/go.mod h1:RagcQ7I8IeTMnF8JTXieKnO4Z6JCsikNEzj0DwauVzE=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/pierrec/lz4/v4 v4.1.22 h1:cKFw6uJDK+/gfw5BcDL0JL5aBsAFdsIT18eRtLj7VIU=
|
||||
github.com/pierrec/lz4/v4 v4.1.22/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
|
||||
@@ -57,52 +69,56 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
|
||||
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tx7do/go-utils v1.1.29 h1:kO1JDMVX++ZY4+aXGk3pOtDz5WBPDA3LxhIWkzXkvH8=
|
||||
github.com/tx7do/go-utils v1.1.29/go.mod h1:bmt7c85QmHURtd7h6QOu7k0QKOJTwjJ+cFP29nljdSw=
|
||||
github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ=
|
||||
github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0=
|
||||
github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
|
||||
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA=
|
||||
go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A=
|
||||
go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY=
|
||||
go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI=
|
||||
go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ=
|
||||
go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE=
|
||||
go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A=
|
||||
go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w=
|
||||
go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k=
|
||||
go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE=
|
||||
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b h1:QoALfVG9rhQ/M7vYDScfPdWjGL9dlsVVM5VGh7aKoAA=
|
||||
golang.org/x/exp v0.0.0-20250531010427-b6e5de432a8b/go.mod h1:U6Lno4MTRCDY+Ba7aCcauB9T60gsv5s4ralQzP72ZoQ=
|
||||
golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU=
|
||||
golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY=
|
||||
golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds=
|
||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
go.opentelemetry.io/otel v1.35.0 h1:xKWKPxrxB6OtMCbmMY021CqC45J+3Onta9MqjhnusiQ=
|
||||
go.opentelemetry.io/otel v1.35.0/go.mod h1:UEqy8Zp11hpkUrL73gSlELM0DupHoiq72dR+Zqel/+Y=
|
||||
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
|
||||
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
|
||||
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=
|
||||
go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w=
|
||||
go.opentelemetry.io/otel/trace v1.35.0 h1:dPpEfJu1sDIqruz7BHFG3c7528f6ddfSWfFDVt/xgMs=
|
||||
go.opentelemetry.io/otel/trace v1.35.0/go.mod h1:WUk7DtFp1Aw2MkvqGdwiXYDZZNvA/1J8o6xRXLrIkyc=
|
||||
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b h1:M2rDM6z3Fhozi9O7NWsxAkg/yqS/lQJ6PmkyIV3YP+o=
|
||||
golang.org/x/exp v0.0.0-20250620022241-b7579e27df2b/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
|
||||
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
|
||||
golang.org/x/mod v0.25.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww=
|
||||
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
|
||||
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
|
||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/tools v0.33.0 h1:4qz2S3zmRxbGIhDIAgjxvFutSvH5EfnsYrRBj0UI0bc=
|
||||
golang.org/x/tools v0.33.0/go.mod h1:CIJMaWEY88juyUfo7UbgPqbC8rU2OqfAV1h2Qp0oMYI=
|
||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||
golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo=
|
||||
golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da h1:noIWHXmPHxILtqtCOPIhSt0ABwskkZKjD3bXGnZGpNY=
|
||||
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90=
|
||||
gonum.org/v1/gonum v0.12.0 h1:xKuo6hzt+gMav00meVPUlXwSdoEJP46BR+wdxQEFK2o=
|
||||
gonum.org/v1/gonum v0.12.0/go.mod h1:73TDxJfAAHeA8Mk9mf8NlIppyhQNo5GLTcYeqgo2lvY=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a h1:v2PbRU4K3llS09c7zodFpNePeamkAwG3mPrAery9VeE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||
google.golang.org/grpc v1.72.2 h1:TdbGzwb82ty4OusHWepvFWGLgIbNo1/SUynEN0ssqv8=
|
||||
google.golang.org/grpc v1.72.2/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM=
|
||||
gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk=
|
||||
gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 h1:fc6jSaCT0vBduLYZHYrBBNY4dsWuvgyff9noRNDdBeE=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A=
|
||||
google.golang.org/grpc v1.73.0 h1:VIWSmpI2MegBtTuFt5/JWy2oXxtjJ/e89Z70ImfD2ok=
|
||||
google.golang.org/grpc v1.73.0/go.mod h1:50sbHOUqWoCQGI8V2HQLJM0B+LMlIUjNSZmow7EVBQc=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
|
||||
96
database/influxdb/mapper.go
Normal file
96
database/influxdb/mapper.go
Normal file
@@ -0,0 +1,96 @@
|
||||
package influxdb
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/InfluxCommunity/influxdb3-go/v2/influxdb3"
|
||||
)
|
||||
|
||||
// Mapper 数据转换的接口
|
||||
type Mapper[T any] interface {
|
||||
// ToPoint 将数据转换为InfluxDB的Point格式
|
||||
ToPoint(data *T) *influxdb3.Point
|
||||
|
||||
// ToData 将InfluxDB的Point转换为原始数据
|
||||
ToData(point *influxdb3.Point) *T
|
||||
}
|
||||
|
||||
// Insert 插入数据
|
||||
func Insert[T any](ctx context.Context, c *Client, data *T, mapper Mapper[T]) error {
|
||||
if c.cli == nil {
|
||||
return ErrClientNotConnected
|
||||
}
|
||||
|
||||
if data == nil {
|
||||
return ErrEmptyData
|
||||
}
|
||||
|
||||
point := mapper.ToPoint(data)
|
||||
if point == nil {
|
||||
return ErrInvalidPoint
|
||||
}
|
||||
|
||||
err := c.Insert(ctx, point)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BatchInsert 批量插入数据
|
||||
func BatchInsert[T any](ctx context.Context, c *Client, data []*T, mapper Mapper[T]) error {
|
||||
if c.cli == nil {
|
||||
return ErrClientNotConnected
|
||||
}
|
||||
|
||||
if len(data) == 0 {
|
||||
return ErrEmptyData
|
||||
}
|
||||
|
||||
points := make([]*influxdb3.Point, len(data))
|
||||
for i, d := range data {
|
||||
point := mapper.ToPoint(d)
|
||||
if point == nil {
|
||||
return ErrInvalidPoint
|
||||
}
|
||||
points[i] = point
|
||||
}
|
||||
|
||||
err := c.BatchInsert(ctx, points)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Query 查询数据
|
||||
func Query[T any](ctx context.Context, c *Client, query string, mapper Mapper[T]) ([]*T, error) {
|
||||
if c.cli == nil {
|
||||
return nil, ErrClientNotConnected
|
||||
}
|
||||
|
||||
iterator, err := c.Query(ctx, query)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var dataset []*T
|
||||
|
||||
for iterator.Next() {
|
||||
point, _ := iterator.AsPoints().AsPoint()
|
||||
if point == nil {
|
||||
return nil, ErrInvalidPoint
|
||||
}
|
||||
|
||||
data := mapper.ToData(point)
|
||||
dataset = append(dataset, data)
|
||||
}
|
||||
|
||||
if iterator.Err() != nil {
|
||||
return nil, iterator.Err()
|
||||
}
|
||||
|
||||
return dataset, nil
|
||||
}
|
||||
208
database/influxdb/utils.go
Normal file
208
database/influxdb/utils.go
Normal file
@@ -0,0 +1,208 @@
|
||||
package influxdb
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/InfluxCommunity/influxdb3-go/v2/influxdb3"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
func BuildQuery(
|
||||
table string,
|
||||
filters map[string]interface{},
|
||||
operators map[string]string,
|
||||
fields []string,
|
||||
) (string, []interface{}) {
|
||||
var queryBuilder strings.Builder
|
||||
args := make([]interface{}, 0)
|
||||
|
||||
// 构建 SELECT 语句
|
||||
queryBuilder.WriteString("SELECT ")
|
||||
if len(fields) > 0 {
|
||||
queryBuilder.WriteString(strings.Join(fields, ", "))
|
||||
} else {
|
||||
queryBuilder.WriteString("*")
|
||||
}
|
||||
queryBuilder.WriteString(fmt.Sprintf(" FROM %s", table))
|
||||
|
||||
// 构建 WHERE 条件
|
||||
if len(filters) > 0 {
|
||||
queryBuilder.WriteString(" WHERE ")
|
||||
var conditions []string
|
||||
var operator string
|
||||
for key, value := range filters {
|
||||
operator = "=" // 默认操作符
|
||||
if op, exists := operators[key]; exists {
|
||||
operator = op
|
||||
}
|
||||
conditions = append(conditions, fmt.Sprintf("%s %s ?", key, operator))
|
||||
args = append(args, value)
|
||||
}
|
||||
queryBuilder.WriteString(strings.Join(conditions, " AND "))
|
||||
}
|
||||
|
||||
return queryBuilder.String(), args
|
||||
}
|
||||
|
||||
func GetPointTag(point *influxdb3.Point, name string) *string {
|
||||
if point == nil {
|
||||
return nil
|
||||
}
|
||||
tagValue, ok := point.GetTag(name)
|
||||
if !ok || tagValue == "" {
|
||||
return nil
|
||||
}
|
||||
return &tagValue
|
||||
}
|
||||
|
||||
func GetBoolPointTag(point *influxdb3.Point, name string) *bool {
|
||||
if point == nil {
|
||||
return nil
|
||||
}
|
||||
tagValue, ok := point.GetTag(name)
|
||||
if !ok || tagValue == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
value := tagValue == "true"
|
||||
return &value
|
||||
}
|
||||
|
||||
func GetUint32PointTag(point *influxdb3.Point, name string) *uint32 {
|
||||
if point == nil {
|
||||
return nil
|
||||
}
|
||||
tagValue, ok := point.GetTag(name)
|
||||
if !ok || tagValue == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := strconv.ParseUint(tagValue, 10, 64)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
value32 := uint32(value)
|
||||
return &value32
|
||||
}
|
||||
|
||||
func GetUint64PointTag(point *influxdb3.Point, name string) *uint64 {
|
||||
if point == nil {
|
||||
return nil
|
||||
}
|
||||
tagValue, ok := point.GetTag(name)
|
||||
if !ok || tagValue == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
value, err := strconv.ParseUint(tagValue, 10, 64)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return &value
|
||||
}
|
||||
|
||||
func GetEnumPointTag[T ~int32](point *influxdb3.Point, name string, valueMap map[string]int32) *T {
|
||||
if point == nil {
|
||||
return nil
|
||||
}
|
||||
tagValue, ok := point.GetTag(name)
|
||||
if !ok || tagValue == "" {
|
||||
return nil
|
||||
}
|
||||
enumValue, exists := valueMap[tagValue]
|
||||
if !exists {
|
||||
return nil
|
||||
}
|
||||
|
||||
enumType := T(enumValue)
|
||||
return &enumType
|
||||
}
|
||||
|
||||
func GetTimestampField(point *influxdb3.Point, name string) *timestamppb.Timestamp {
|
||||
if point == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
value := point.GetField(name)
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
if timestamp, ok := value.(*timestamppb.Timestamp); ok {
|
||||
return timestamp
|
||||
}
|
||||
if timeValue, ok := value.(time.Time); ok {
|
||||
return timestamppb.New(timeValue)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func GetUint32Field(point *influxdb3.Point, name string) *uint32 {
|
||||
if point == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
value := point.GetUIntegerField(name)
|
||||
if value == nil {
|
||||
return nil
|
||||
}
|
||||
uint32Value := uint32(*value)
|
||||
if uint32Value == 0 {
|
||||
return nil
|
||||
}
|
||||
return &uint32Value
|
||||
}
|
||||
|
||||
func BoolToString(value *bool) string {
|
||||
if value == nil {
|
||||
return "false"
|
||||
}
|
||||
if *value {
|
||||
return "true"
|
||||
}
|
||||
return "false"
|
||||
}
|
||||
|
||||
func Uint64ToString(value *uint64) string {
|
||||
if value == nil {
|
||||
return "0"
|
||||
}
|
||||
return fmt.Sprintf("%d", *value)
|
||||
}
|
||||
|
||||
func BuildQueryWithParams(
|
||||
table string,
|
||||
filters map[string]interface{},
|
||||
operators map[string]string,
|
||||
fields []string,
|
||||
) string {
|
||||
var queryBuilder strings.Builder
|
||||
|
||||
// 构建 SELECT 语句
|
||||
queryBuilder.WriteString("SELECT ")
|
||||
if len(fields) > 0 {
|
||||
queryBuilder.WriteString(strings.Join(fields, ", "))
|
||||
} else {
|
||||
queryBuilder.WriteString("*")
|
||||
}
|
||||
queryBuilder.WriteString(fmt.Sprintf(" FROM %s", table))
|
||||
|
||||
// 构建 WHERE 条件
|
||||
if len(filters) > 0 {
|
||||
var operator string
|
||||
queryBuilder.WriteString(" WHERE ")
|
||||
var conditions []string
|
||||
for key, value := range filters {
|
||||
operator = "=" // 默认操作符
|
||||
if op, exists := operators[key]; exists {
|
||||
operator = op
|
||||
}
|
||||
conditions = append(conditions, fmt.Sprintf("%s %s %v", key, operator, value))
|
||||
}
|
||||
queryBuilder.WriteString(strings.Join(conditions, " AND "))
|
||||
}
|
||||
|
||||
return queryBuilder.String()
|
||||
}
|
||||
153
database/influxdb/utils_test.go
Normal file
153
database/influxdb/utils_test.go
Normal file
@@ -0,0 +1,153 @@
|
||||
package influxdb
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestBuildQuery(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
table string
|
||||
filters map[string]interface{}
|
||||
operators map[string]string
|
||||
fields []string
|
||||
expectedQuery string
|
||||
expectedArgs []interface{}
|
||||
}{
|
||||
{
|
||||
name: "Basic query with filters and fields",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"s": "AAPL", "o": 150.0},
|
||||
fields: []string{"s", "o", "h", "l", "c", "v"},
|
||||
expectedQuery: "SELECT s, o, h, l, c, v FROM candles WHERE s = ? AND o = ?",
|
||||
expectedArgs: []interface{}{"AAPL", 150.0},
|
||||
},
|
||||
{
|
||||
name: "Query with no filters",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{},
|
||||
fields: []string{"s", "o", "h"},
|
||||
expectedQuery: "SELECT s, o, h FROM candles",
|
||||
expectedArgs: []interface{}{},
|
||||
},
|
||||
{
|
||||
name: "Query with no fields",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"s": "AAPL"},
|
||||
fields: []string{},
|
||||
expectedQuery: "SELECT * FROM candles WHERE s = ?",
|
||||
expectedArgs: []interface{}{"AAPL"},
|
||||
},
|
||||
{
|
||||
name: "Empty table name",
|
||||
table: "",
|
||||
filters: map[string]interface{}{"s": "AAPL"},
|
||||
fields: []string{"s", "o"},
|
||||
expectedQuery: "SELECT s, o FROM WHERE s = ?",
|
||||
expectedArgs: []interface{}{"AAPL"},
|
||||
},
|
||||
{
|
||||
name: "Special characters in filters",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"name": "O'Reilly"},
|
||||
fields: []string{"name"},
|
||||
expectedQuery: "SELECT name FROM candles WHERE name = ?",
|
||||
expectedArgs: []interface{}{"O'Reilly"},
|
||||
},
|
||||
{
|
||||
name: "Query with interval filters",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"time": "now() - interval '15 minutes'"},
|
||||
fields: []string{"*"},
|
||||
operators: map[string]string{"time": ">="},
|
||||
expectedQuery: "SELECT * FROM candles WHERE time >= ?",
|
||||
expectedArgs: []interface{}{"now() - interval '15 minutes'"},
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
query, args := BuildQuery(tt.table, tt.filters, tt.operators, tt.fields)
|
||||
|
||||
if query != tt.expectedQuery {
|
||||
t.Errorf("expected query %s, got %s", tt.expectedQuery, query)
|
||||
}
|
||||
|
||||
if !reflect.DeepEqual(args, tt.expectedArgs) {
|
||||
t.Errorf("expected args %v, got %v", tt.expectedArgs, args)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildQueryWithParams(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
table string
|
||||
filters map[string]interface{}
|
||||
operators map[string]string
|
||||
fields []string
|
||||
expectedQuery string
|
||||
}{
|
||||
{
|
||||
name: "Basic query with filters and fields",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"s": "'AAPL'", "o": 150.0},
|
||||
operators: map[string]string{"o": ">"},
|
||||
fields: []string{"s", "o", "h", "l", "c", "v"},
|
||||
expectedQuery: "SELECT s, o, h, l, c, v FROM candles WHERE s = 'AAPL' AND o > 150",
|
||||
},
|
||||
{
|
||||
name: "Query with no filters",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{},
|
||||
operators: map[string]string{},
|
||||
fields: []string{"s", "o", "h"},
|
||||
expectedQuery: "SELECT s, o, h FROM candles",
|
||||
},
|
||||
{
|
||||
name: "Query with no fields",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"s": "'AAPL'"},
|
||||
operators: map[string]string{},
|
||||
fields: []string{},
|
||||
expectedQuery: "SELECT * FROM candles WHERE s = 'AAPL'",
|
||||
},
|
||||
{
|
||||
name: "Empty table name",
|
||||
table: "",
|
||||
filters: map[string]interface{}{"s": "'AAPL'"},
|
||||
operators: map[string]string{},
|
||||
fields: []string{"s", "o"},
|
||||
expectedQuery: "SELECT s, o FROM WHERE s = 'AAPL'",
|
||||
},
|
||||
{
|
||||
name: "Special characters in filters",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"name": "'O'Reilly'"},
|
||||
operators: map[string]string{},
|
||||
fields: []string{"name"},
|
||||
expectedQuery: "SELECT name FROM candles WHERE name = 'O'Reilly'",
|
||||
},
|
||||
{
|
||||
name: "Query with interval filters",
|
||||
table: "candles",
|
||||
filters: map[string]interface{}{"time": "now() - interval '15 minutes'"},
|
||||
operators: map[string]string{"time": ">="},
|
||||
fields: []string{"*"},
|
||||
expectedQuery: "SELECT * FROM candles WHERE time >= now() - interval '15 minutes'",
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
query := BuildQueryWithParams(tt.table, tt.filters, tt.operators, tt.fields)
|
||||
|
||||
if query != tt.expectedQuery {
|
||||
t.Errorf("expected query %s, got %s", tt.expectedQuery, query)
|
||||
}
|
||||
//t.Log(query)
|
||||
})
|
||||
}
|
||||
}
|
||||
51
database/mongodb/README.md
Normal file
51
database/mongodb/README.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# MongoDB
|
||||
|
||||
## 概念对比
|
||||
|
||||
| MongoDB存储结构 | RDBMS存储结构 |
|
||||
|-------------|-------------|
|
||||
| database | database |
|
||||
| collection | table |
|
||||
| document | row |
|
||||
| field | column |
|
||||
| index | 索引 |
|
||||
| primary key | primary key |
|
||||
|
||||
## Docker部署
|
||||
|
||||
下载镜像:
|
||||
|
||||
```bash
|
||||
docker pull bitnami/mongodb:latest
|
||||
docker pull bitnami/mongodb-exporter:latest
|
||||
```
|
||||
|
||||
带密码安装:
|
||||
|
||||
```bash
|
||||
docker run -itd \
|
||||
--name mongodb-server \
|
||||
-p 27017:27017 \
|
||||
-e MONGODB_ROOT_USER=root \
|
||||
-e MONGODB_ROOT_PASSWORD=123456 \
|
||||
-e MONGODB_USERNAME=test \
|
||||
-e MONGODB_PASSWORD=123456 \
|
||||
-e MONGODB_DATABASE=finances \
|
||||
bitnami/mongodb:latest
|
||||
```
|
||||
|
||||
不带密码安装:
|
||||
|
||||
```bash
|
||||
docker run -itd \
|
||||
--name mongodb-server \
|
||||
-p 27017:27017 \
|
||||
-e ALLOW_EMPTY_PASSWORD=yes \
|
||||
bitnami/mongodb:latest
|
||||
```
|
||||
|
||||
有两点需要注意:
|
||||
|
||||
1. 如果需要映射数据卷,需要把本地路径的所有权改到1001:`sudo chown -R 1001:1001 data/db`,否则会报错:
|
||||
`‘mkdir: cannot create directory ‘/bitnami/mongodb’: Permission denied’`;
|
||||
2. 从MongoDB 5.0开始,有些机器运行会报错:`Illegal instruction`,这是因为机器硬件不支持 **AVX 指令集** 的缘故,没办法,MongoDB降级吧。
|
||||
@@ -2,35 +2,172 @@ package mongodb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
mongoV2 "go.mongodb.org/mongo-driver/v2/mongo"
|
||||
optionsV2 "go.mongodb.org/mongo-driver/v2/mongo/options"
|
||||
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
)
|
||||
|
||||
// NewMongoClient 创建MongoDB客户端
|
||||
func NewMongoClient(ctx context.Context, cfg *conf.Bootstrap, l *log.Helper) *mongo.Client {
|
||||
if cfg.Data == nil || cfg.Data.Mongodb == nil {
|
||||
l.Warn("Mongodb config is nil")
|
||||
return nil
|
||||
}
|
||||
type Client struct {
|
||||
log *log.Helper
|
||||
|
||||
var opts []*options.ClientOptions
|
||||
|
||||
uri := fmt.Sprintf("mongodb://%s:%s@%s",
|
||||
cfg.Data.Mongodb.Username, cfg.Data.Mongodb.Password, cfg.Data.Mongodb.Address,
|
||||
)
|
||||
opts = append(opts, options.Client().ApplyURI(uri))
|
||||
|
||||
cli, err := mongo.Connect(ctx, opts...)
|
||||
if err != nil {
|
||||
l.Fatalf("failed opening connection to mongodb: %v", err)
|
||||
return nil
|
||||
}
|
||||
|
||||
return cli
|
||||
cli *mongoV2.Client
|
||||
database string
|
||||
timeout time.Duration
|
||||
}
|
||||
|
||||
func NewClient(logger log.Logger, cfg *conf.Bootstrap) (*Client, error) {
|
||||
c := &Client{
|
||||
log: log.NewHelper(log.With(logger, "module", "mongodb-client")),
|
||||
}
|
||||
|
||||
if err := c.createMongodbClient(cfg); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return c, nil
|
||||
}
|
||||
|
||||
// createMongodbClient 创建MongoDB客户端
|
||||
func (c *Client) createMongodbClient(cfg *conf.Bootstrap) error {
|
||||
if cfg.Data == nil || cfg.Data.Mongodb == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var opts []*optionsV2.ClientOptions
|
||||
|
||||
if cfg.Data.Mongodb.GetUri() != "" {
|
||||
opts = append(opts, optionsV2.Client().ApplyURI(cfg.Data.Mongodb.GetUri()))
|
||||
}
|
||||
if cfg.Data.Mongodb.GetUsername() != "" && cfg.Data.Mongodb.GetPassword() != "" {
|
||||
credential := optionsV2.Credential{
|
||||
Username: cfg.Data.Mongodb.GetUsername(),
|
||||
Password: cfg.Data.Mongodb.GetPassword(),
|
||||
}
|
||||
|
||||
if cfg.Data.Mongodb.GetPassword() != "" {
|
||||
credential.PasswordSet = true
|
||||
}
|
||||
|
||||
opts = append(opts, optionsV2.Client().SetAuth(credential))
|
||||
}
|
||||
if cfg.Data.Mongodb.ConnectTimeout != nil {
|
||||
opts = append(opts, optionsV2.Client().SetConnectTimeout(cfg.Data.Mongodb.GetConnectTimeout().AsDuration()))
|
||||
}
|
||||
if cfg.Data.Mongodb.ServerSelectionTimeout != nil {
|
||||
opts = append(opts, optionsV2.Client().SetServerSelectionTimeout(cfg.Data.Mongodb.GetServerSelectionTimeout().AsDuration()))
|
||||
}
|
||||
if cfg.Data.Mongodb.Timeout != nil {
|
||||
opts = append(opts, optionsV2.Client().SetTimeout(cfg.Data.Mongodb.GetTimeout().AsDuration()))
|
||||
}
|
||||
|
||||
opts = append(opts, optionsV2.Client().SetBSONOptions(&optionsV2.BSONOptions{
|
||||
UseJSONStructTags: true, // 使用JSON结构标签
|
||||
}))
|
||||
|
||||
cli, err := mongoV2.Connect(opts...)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to create mongodb client: %v", err)
|
||||
return err
|
||||
}
|
||||
|
||||
c.database = cfg.Data.Mongodb.GetDatabase()
|
||||
if cfg.Data.Mongodb.GetTimeout() != nil {
|
||||
c.timeout = cfg.Data.Mongodb.GetTimeout().AsDuration()
|
||||
} else {
|
||||
c.timeout = 10 * time.Second // 默认超时时间
|
||||
}
|
||||
|
||||
c.cli = cli
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Close 关闭MongoDB客户端
|
||||
func (c *Client) Close() {
|
||||
if c.cli == nil {
|
||||
c.log.Warn("mongodb client is already closed or not initialized")
|
||||
return
|
||||
}
|
||||
|
||||
if err := c.cli.Disconnect(context.Background()); err != nil {
|
||||
c.log.Errorf("failed to disconnect mongodb client: %v", err)
|
||||
} else {
|
||||
c.log.Info("mongodb client disconnected successfully")
|
||||
}
|
||||
}
|
||||
|
||||
// CheckConnect 检查MongoDB连接状态
|
||||
func (c *Client) CheckConnect() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
|
||||
defer cancel()
|
||||
|
||||
if err := c.cli.Ping(ctx, nil); err != nil {
|
||||
c.log.Errorf("failed to ping mongodb: %v", err)
|
||||
} else {
|
||||
c.log.Info("mongodb client is connected")
|
||||
}
|
||||
}
|
||||
|
||||
// InsertOne 插入单个文档
|
||||
func (c *Client) InsertOne(ctx context.Context, collection string, document interface{}) (*mongoV2.InsertOneResult, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
||||
defer cancel()
|
||||
|
||||
return c.cli.Database(c.database).Collection(collection).InsertOne(ctx, document)
|
||||
}
|
||||
|
||||
// InsertMany 插入多个文档
|
||||
func (c *Client) InsertMany(ctx context.Context, collection string, documents []interface{}) (*mongoV2.InsertManyResult, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
||||
defer cancel()
|
||||
|
||||
return c.cli.Database(c.database).Collection(collection).InsertMany(ctx, documents)
|
||||
}
|
||||
|
||||
// FindOne 查询单个文档
|
||||
func (c *Client) FindOne(ctx context.Context, collection string, filter interface{}, result interface{}) error {
|
||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
||||
defer cancel()
|
||||
|
||||
return c.cli.Database(c.database).Collection(collection).FindOne(ctx, filter).Decode(result)
|
||||
}
|
||||
|
||||
// Find 查询多个文档
|
||||
func (c *Client) Find(ctx context.Context, collection string, filter interface{}, results interface{}) error {
|
||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
||||
defer cancel()
|
||||
|
||||
cursor, err := c.cli.Database(c.database).Collection(collection).Find(ctx, filter)
|
||||
if err != nil {
|
||||
c.log.Errorf("failed to find documents in collection %s: %v", collection, err)
|
||||
return err
|
||||
}
|
||||
defer func(cursor *mongoV2.Cursor, ctx context.Context) {
|
||||
if err = cursor.Close(ctx); err != nil {
|
||||
c.log.Errorf("failed to close cursor: %v", err)
|
||||
}
|
||||
}(cursor, ctx)
|
||||
|
||||
return cursor.All(ctx, results)
|
||||
}
|
||||
|
||||
// UpdateOne 更新单个文档
|
||||
func (c *Client) UpdateOne(ctx context.Context, collection string, filter, update interface{}) (*mongoV2.UpdateResult, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
||||
defer cancel()
|
||||
|
||||
return c.cli.Database(c.database).Collection(collection).UpdateOne(ctx, filter, update)
|
||||
}
|
||||
|
||||
// DeleteOne 删除单个文档
|
||||
func (c *Client) DeleteOne(ctx context.Context, collection string, filter interface{}) (*mongoV2.DeleteResult, error) {
|
||||
ctx, cancel := context.WithTimeout(ctx, c.timeout)
|
||||
defer cancel()
|
||||
|
||||
return c.cli.Database(c.database).Collection(collection).DeleteOne(ctx, filter)
|
||||
}
|
||||
|
||||
66
database/mongodb/client_test.go
Normal file
66
database/mongodb/client_test.go
Normal file
@@ -0,0 +1,66 @@
|
||||
package mongodb
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/go-kratos/kratos/v2/log"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/tx7do/go-utils/trans"
|
||||
conf "github.com/tx7do/kratos-bootstrap/api/gen/go/conf/v1"
|
||||
"google.golang.org/protobuf/types/known/timestamppb"
|
||||
)
|
||||
|
||||
type Candle struct {
|
||||
Symbol *string `json:"s"`
|
||||
Open *float64 `json:"o"`
|
||||
High *float64 `json:"h"`
|
||||
Low *float64 `json:"l"`
|
||||
Close *float64 `json:"c"`
|
||||
Volume *float64 `json:"v"`
|
||||
StartTime *timestamppb.Timestamp `json:"st"`
|
||||
EndTime *timestamppb.Timestamp `json:"et"`
|
||||
}
|
||||
|
||||
func createTestClient() *Client {
|
||||
cli, _ := NewClient(
|
||||
log.DefaultLogger,
|
||||
&conf.Bootstrap{
|
||||
Data: &conf.Data{
|
||||
Mongodb: &conf.Data_MongoDB{
|
||||
Uri: "mongodb://root:123456@127.0.0.1:27017/?compressors=snappy,zlib,zstd",
|
||||
Database: trans.Ptr("finances"),
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
return cli
|
||||
}
|
||||
|
||||
func TestNewClient(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
client.CheckConnect()
|
||||
}
|
||||
|
||||
func TestInsertOne(t *testing.T) {
|
||||
client := createTestClient()
|
||||
assert.NotNil(t, client)
|
||||
|
||||
ctx := context.Background()
|
||||
|
||||
candle := Candle{
|
||||
StartTime: timestamppb.New(time.Now()),
|
||||
Symbol: trans.Ptr("AAPL"),
|
||||
Open: trans.Ptr(1.0),
|
||||
High: trans.Ptr(2.0),
|
||||
Low: trans.Ptr(3.0),
|
||||
Close: trans.Ptr(4.0),
|
||||
Volume: trans.Ptr(1000.0),
|
||||
}
|
||||
|
||||
_, err := client.InsertOne(ctx, "candles", candle)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
110
database/mongodb/consts.go
Normal file
110
database/mongodb/consts.go
Normal file
@@ -0,0 +1,110 @@
|
||||
package mongodb
|
||||
|
||||
const (
|
||||
// 比较操作符
|
||||
|
||||
OperatorEq = "$eq" // 等于
|
||||
OperatorNe = "$ne" // 不等于
|
||||
OperatorGt = "$gt" // 大于
|
||||
OperatorGte = "$gte" // 大于等于
|
||||
OperatorLt = "$lt" // 小于
|
||||
OperatorLte = "$lte" // 小于等于
|
||||
|
||||
// 逻辑操作符
|
||||
|
||||
OperatorAnd = "$and" // 与
|
||||
OperatorOr = "$or" // 或
|
||||
OperatorNot = "$not" // 非
|
||||
OperatorNor = "$nor" // 非或
|
||||
|
||||
// 元素操作符
|
||||
|
||||
OperatorExists = "$exists" // 是否存在
|
||||
OperatorType = "$type" // 类型
|
||||
|
||||
// 评估操作符
|
||||
|
||||
OperatorExpr = "$expr" // 表达式
|
||||
OperatorJsonSchema = "$jsonSchema" // JSON Schema 验证
|
||||
OperatorMod = "$mod" // 取模
|
||||
OperatorRegex = "$regex" // 正则表达式
|
||||
OperatorText = "$text" // 文本搜索
|
||||
OperatorWhere = "$where" // JavaScript 表达式
|
||||
OperatorSearch = "$search" // 文本搜索
|
||||
|
||||
// 数组操作符
|
||||
|
||||
OperatorAll = "$all" // 匹配所有
|
||||
OperatorElemMatch = "$elemMatch" // 匹配数组中的元素
|
||||
OperatorSize = "$size" // 数组大小
|
||||
|
||||
// 集合操作符
|
||||
|
||||
OperatorIn = "$in" // 包含
|
||||
OperatorNin = "$nin" // 不包含
|
||||
|
||||
// 更新操作符
|
||||
|
||||
OperatorSet = "$set" // 设置字段值
|
||||
OperatorUnset = "$unset" // 删除字段
|
||||
OperatorInc = "$inc" // 增加值
|
||||
OperatorMul = "$mul" // 乘法
|
||||
OperatorRename = "$rename" // 重命名字段
|
||||
OperatorCurrentDate = "$currentDate" // 设置当前日期
|
||||
OperatorAddToSet = "$addToSet" // 添加到集合
|
||||
OperatorPop = "$pop" // 删除数组中的元素
|
||||
OperatorPull = "$pull" // 删除匹配的数组元素
|
||||
OperatorPush = "$push" // 添加数组元素
|
||||
OperatorEach = "$each" // 批量添加数组元素
|
||||
OperatorSlice = "$slice" // 截取数组
|
||||
OperatorSort = "$sort" // 排序数组
|
||||
OperatorPosition = "$position" // 指定数组位置
|
||||
|
||||
// 聚合操作符
|
||||
|
||||
OperatorGroup = "$group" // 分组
|
||||
OperatorMatch = "$match" // 匹配
|
||||
OperatorProject = "$project" // 投影
|
||||
OperatorSortAgg = "$sort" // 排序
|
||||
OperatorLimit = "$limit" // 限制
|
||||
OperatorSkip = "$skip" // 跳过
|
||||
OperatorUnwind = "$unwind" // 拆分数组
|
||||
OperatorLookup = "$lookup" // 关联查询
|
||||
OperatorAddFields = "$addFields" // 添加字段
|
||||
OperatorReplaceRoot = "$replaceRoot" // 替换根字段
|
||||
OperatorCount = "$count" // 计数
|
||||
OperatorFacet = "$facet" // 多面查询
|
||||
OperatorBucket = "$bucket" // 分桶
|
||||
OperatorBucketAuto = "$bucketAuto" // 自动分桶
|
||||
OperatorIndexStats = "$indexStats" // 索引统计
|
||||
OperatorOut = "$out" // 输出
|
||||
OperatorMerge = "$merge" // 合并
|
||||
OperatorSum = "$sum" // 求和
|
||||
OperatorAvg = "$avg" // 平均值
|
||||
OperatorMin = "$min" // 最小值
|
||||
OperatorMax = "$max" // 最大值
|
||||
OperatorFirst = "$first" // 第一个值
|
||||
OperatorLast = "$last" // 最后一个值
|
||||
OperatorStdDevPop = "$stdDevPop" // 总体标准差
|
||||
OperatorStdDevSamp = "$stdDevSamp" // 样本标准差
|
||||
|
||||
// 类型转换操作符
|
||||
|
||||
OperatorToLong = "$toLong" // 转换为 long 类型
|
||||
OperatorToDouble = "$toDouble" // 转换为 double 类型
|
||||
OperatorToDecimal = "$toDecimal" // 转换为 decimal 类型
|
||||
OperatorToString = "$toString" // 转换为 string 类型
|
||||
OperatorToDate = "$toDate" // 转换为 date 类型
|
||||
OperatorToInt = "$toInt" // 转换为 int 类型
|
||||
|
||||
// 地理空间操作符
|
||||
|
||||
OperatorNear = "$near" // 查询距离某点最近的文档
|
||||
OperatorNearSphere = "$nearSphere" // 查询距离某点最近的文档(球面距离)
|
||||
OperatorGeoWithin = "$geoWithin" // 地理范围查询
|
||||
OperatorGeoIntersects = "$geoIntersects" // 地理相交查询
|
||||
|
||||
OperatorGeometry = "$geometry" // 几何图形
|
||||
OperatorMaxDistance = "$maxDistance" // 最大距离
|
||||
OperatorMinDistance = "$minDistance" // 最小距离
|
||||
)
|
||||
1
database/mongodb/errors.go
Normal file
1
database/mongodb/errors.go
Normal file
@@ -0,0 +1 @@
|
||||
package mongodb
|
||||
@@ -8,20 +8,26 @@ replace github.com/tx7do/kratos-bootstrap/api => ../../api
|
||||
|
||||
require (
|
||||
github.com/go-kratos/kratos/v2 v2.8.4
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.21
|
||||
go.mongodb.org/mongo-driver v1.17.3
|
||||
github.com/stretchr/testify v1.10.0
|
||||
github.com/tx7do/go-utils v1.1.29
|
||||
github.com/tx7do/kratos-bootstrap/api v0.0.27
|
||||
go.mongodb.org/mongo-driver/v2 v2.2.2
|
||||
google.golang.org/protobuf v1.36.6
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/golang/snappy v1.0.0 // indirect
|
||||
github.com/google/uuid v1.6.0 // indirect
|
||||
github.com/klauspost/compress v1.18.0 // indirect
|
||||
github.com/montanaflynn/stats v0.7.1 // indirect
|
||||
github.com/kr/text v0.2.0 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
|
||||
github.com/xdg-go/scram v1.1.2 // indirect
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
|
||||
golang.org/x/crypto v0.38.0 // indirect
|
||||
golang.org/x/sync v0.14.0 // indirect
|
||||
golang.org/x/text v0.25.0 // indirect
|
||||
google.golang.org/protobuf v1.36.6 // indirect
|
||||
golang.org/x/crypto v0.39.0 // indirect
|
||||
golang.org/x/sync v0.15.0 // indirect
|
||||
golang.org/x/text v0.26.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/go-kratos/kratos/v2 v2.8.4 h1:eIJLE9Qq9WSoKx+Buy2uPyrahtF/lPh+Xf4MTpxhmjs=
|
||||
@@ -6,10 +7,22 @@ github.com/golang/snappy v1.0.0 h1:Oy607GVXHs7RtbggtPBnr2RmDArIsAefDwvrdWvRhGs=
|
||||
github.com/golang/snappy v1.0.0/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo=
|
||||
github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ=
|
||||
github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE=
|
||||
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
|
||||
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/tx7do/go-utils v1.1.29 h1:kO1JDMVX++ZY4+aXGk3pOtDz5WBPDA3LxhIWkzXkvH8=
|
||||
github.com/tx7do/go-utils v1.1.29/go.mod h1:bmt7c85QmHURtd7h6QOu7k0QKOJTwjJ+cFP29nljdSw=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
|
||||
github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
|
||||
github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY=
|
||||
@@ -19,20 +32,20 @@ github.com/xdg-go/stringprep v1.0.4/go.mod h1:mPGuuIYwz7CmR2bT9j4GbQqutWS1zV24gi
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 h1:ilQV1hzziu+LLM3zUTJ0trRztfwgjqKnBWNtSRkbmwM=
|
||||
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78/go.mod h1:aL8wCCfTfSfmXjznFBSZNN13rSJjlIOI1fUNAtF7rmI=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.mongodb.org/mongo-driver v1.17.3 h1:TQyXhnsWfWtgAhMtOgtYHMTkZIfBTpMTsMnd9ZBeHxQ=
|
||||
go.mongodb.org/mongo-driver v1.17.3/go.mod h1:Hy04i7O2kC4RS06ZrhPRqj/u4DTYkFDAAccj+rVKqgQ=
|
||||
go.mongodb.org/mongo-driver/v2 v2.2.2 h1:9cYuS3fl1Xhqwpfazso10V7BHQD58kCgtzhfAmJYz9c=
|
||||
go.mongodb.org/mongo-driver/v2 v2.2.2/go.mod h1:qQkDMhCGWl3FN509DfdPd4GRBLU/41zqF/k8eTRceps=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
|
||||
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
|
||||
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
|
||||
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
|
||||
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sync v0.15.0 h1:KWH3jNZsfyT6xfAfKiz6MRNmd46ByHDYaZ7KSkCtdW8=
|
||||
golang.org/x/sync v0.15.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -44,11 +57,16 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
|
||||
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
|
||||
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
|
||||
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
||||
229
database/mongodb/query.go
Normal file
229
database/mongodb/query.go
Normal file
@@ -0,0 +1,229 @@
|
||||
package mongodb
|
||||
|
||||
import (
|
||||
bsonV2 "go.mongodb.org/mongo-driver/v2/bson"
|
||||
optionsV2 "go.mongodb.org/mongo-driver/v2/mongo/options"
|
||||
)
|
||||
|
||||
type QueryBuilder struct {
|
||||
filter bsonV2.M
|
||||
opts *optionsV2.FindOptions
|
||||
pipeline []bsonV2.M
|
||||
}
|
||||
|
||||
func NewQuery() *QueryBuilder {
|
||||
return &QueryBuilder{
|
||||
filter: bsonV2.M{},
|
||||
opts: &optionsV2.FindOptions{},
|
||||
}
|
||||
}
|
||||
|
||||
// SetFilter 设置查询过滤条件
|
||||
func (qb *QueryBuilder) SetFilter(filter bsonV2.M) *QueryBuilder {
|
||||
qb.filter = filter
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetOr 设置多个条件的逻辑或
|
||||
func (qb *QueryBuilder) SetOr(conditions []bsonV2.M) *QueryBuilder {
|
||||
qb.filter[OperatorOr] = conditions
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetAnd 设置多个条件的逻辑与
|
||||
func (qb *QueryBuilder) SetAnd(conditions []bsonV2.M) *QueryBuilder {
|
||||
qb.filter[OperatorAnd] = conditions
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetNotEqual 设置字段的不等于条件
|
||||
func (qb *QueryBuilder) SetNotEqual(field string, value interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorNe: value}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetGreaterThan 设置字段的大于条件
|
||||
func (qb *QueryBuilder) SetGreaterThan(field string, value interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorGt: value}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetLessThan 设置字段的小于条件
|
||||
func (qb *QueryBuilder) SetLessThan(field string, value interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorLt: value}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetExists 设置字段是否存在条件
|
||||
func (qb *QueryBuilder) SetExists(field string, exists bool) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorExists: exists}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetType 设置字段的类型条件
|
||||
func (qb *QueryBuilder) SetType(field string, typeValue interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorType: typeValue}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetBetween 设置字段的范围查询条件
|
||||
func (qb *QueryBuilder) SetBetween(field string, start, end interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{
|
||||
OperatorGte: start,
|
||||
OperatorLte: end,
|
||||
}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetIn 设置字段的包含条件
|
||||
func (qb *QueryBuilder) SetIn(field string, values []interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorIn: values}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetNotIn 设置字段的排除条件
|
||||
func (qb *QueryBuilder) SetNotIn(field string, values []interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorNin: values}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetElemMatch 设置数组字段的匹配条件
|
||||
func (qb *QueryBuilder) SetElemMatch(field string, match bsonV2.M) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorElemMatch: match}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetAll 设置字段必须包含所有指定值的条件
|
||||
func (qb *QueryBuilder) SetAll(field string, values []interface{}) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorAll: values}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetSize 设置数组字段的大小条件
|
||||
func (qb *QueryBuilder) SetSize(field string, size int) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorSize: size}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetCurrentDate 设置字段为当前日期
|
||||
func (qb *QueryBuilder) SetCurrentDate(field string) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorCurrentDate: true}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetTextSearch 设置文本搜索条件
|
||||
func (qb *QueryBuilder) SetTextSearch(search string) *QueryBuilder {
|
||||
qb.filter[OperatorText] = bsonV2.M{OperatorSearch: search}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetMod 设置字段的模运算条件
|
||||
func (qb *QueryBuilder) SetMod(field string, divisor, remainder int) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorMod: []int{divisor, remainder}}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetRegex 设置正则表达式查询条件
|
||||
func (qb *QueryBuilder) SetRegex(field string, pattern string) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorRegex: pattern}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetGeoWithin 设置地理位置范围查询条件
|
||||
func (qb *QueryBuilder) SetGeoWithin(field string, geometry bsonV2.M) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorGeoWithin: geometry}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetGeoIntersects 设置地理位置相交查询条件
|
||||
func (qb *QueryBuilder) SetGeoIntersects(field string, geometry bsonV2.M) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{OperatorGeoIntersects: geometry}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetNear 设置地理位置附近查询条件
|
||||
func (qb *QueryBuilder) SetNear(field string, point bsonV2.M, maxDistance, minDistance float64) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{
|
||||
OperatorNear: bsonV2.M{
|
||||
OperatorGeometry: point,
|
||||
OperatorMaxDistance: maxDistance,
|
||||
OperatorMinDistance: minDistance,
|
||||
},
|
||||
}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetNearSphere 设置球面距离附近查询条件
|
||||
func (qb *QueryBuilder) SetNearSphere(field string, point bsonV2.M, maxDistance, minDistance float64) *QueryBuilder {
|
||||
qb.filter[field] = bsonV2.M{
|
||||
OperatorNearSphere: bsonV2.M{
|
||||
OperatorGeometry: point,
|
||||
OperatorMaxDistance: maxDistance,
|
||||
OperatorMinDistance: minDistance,
|
||||
},
|
||||
}
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetLimit 设置查询结果的限制数量
|
||||
func (qb *QueryBuilder) SetLimit(limit int64) *QueryBuilder {
|
||||
if qb.opts == nil {
|
||||
qb.opts = &optionsV2.FindOptions{}
|
||||
}
|
||||
qb.opts.Limit = &limit
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetSort 设置查询结果的排序条件
|
||||
func (qb *QueryBuilder) SetSort(sort bsonV2.D) *QueryBuilder {
|
||||
if qb.opts == nil {
|
||||
qb.opts = &optionsV2.FindOptions{}
|
||||
}
|
||||
qb.opts.Sort = sort
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetSortWithPriority 设置查询结果的排序条件,并指定优先级
|
||||
func (qb *QueryBuilder) SetSortWithPriority(sortFields []bsonV2.E) *QueryBuilder {
|
||||
if qb.opts == nil {
|
||||
qb.opts = &optionsV2.FindOptions{}
|
||||
}
|
||||
qb.opts.Sort = bsonV2.D(sortFields)
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetProjection 设置查询结果的字段投影
|
||||
func (qb *QueryBuilder) SetProjection(projection bsonV2.M) *QueryBuilder {
|
||||
qb.opts.Projection = projection
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetSkip 设置查询结果的跳过数量
|
||||
func (qb *QueryBuilder) SetSkip(skip int64) *QueryBuilder {
|
||||
qb.opts.Skip = &skip
|
||||
return qb
|
||||
}
|
||||
|
||||
// SetPage 设置分页功能,page 从 1 开始,size 为每页的文档数量
|
||||
func (qb *QueryBuilder) SetPage(page, size int64) *QueryBuilder {
|
||||
offset := (page - 1) * size
|
||||
qb.opts.Skip = &offset
|
||||
qb.opts.Limit = &size
|
||||
return qb
|
||||
}
|
||||
|
||||
// AddStage 添加聚合阶段到管道
|
||||
func (qb *QueryBuilder) AddStage(stage bsonV2.M) *QueryBuilder {
|
||||
qb.pipeline = append(qb.pipeline, stage)
|
||||
return qb
|
||||
}
|
||||
|
||||
// BuildPipeline 返回最终的聚合管道
|
||||
func (qb *QueryBuilder) BuildPipeline() []bsonV2.M {
|
||||
return qb.pipeline
|
||||
}
|
||||
|
||||
// Build 返回最终的过滤条件和查询选项
|
||||
func (qb *QueryBuilder) Build() (bsonV2.M, *optionsV2.FindOptions) {
|
||||
return qb.filter, qb.opts
|
||||
}
|
||||
238
database/mongodb/query_test.go
Normal file
238
database/mongodb/query_test.go
Normal file
@@ -0,0 +1,238 @@
|
||||
package mongodb
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
bsonV2 "go.mongodb.org/mongo-driver/v2/bson"
|
||||
)
|
||||
|
||||
func TestQueryBuilder(t *testing.T) {
|
||||
// 创建 QueryBuilder 实例
|
||||
qb := NewQuery()
|
||||
|
||||
// 测试 SetFilter
|
||||
filter := bsonV2.M{"name": "test"}
|
||||
qb.SetFilter(filter)
|
||||
assert.Equal(t, filter, qb.filter)
|
||||
|
||||
// 测试 SetLimit
|
||||
limit := int64(10)
|
||||
qb.SetLimit(limit)
|
||||
assert.NotNil(t, qb.opts.Limit)
|
||||
assert.Equal(t, &limit, qb.opts.Limit)
|
||||
|
||||
// 测试 SetSort
|
||||
sort := bsonV2.D{{Key: "name", Value: 1}}
|
||||
qb.SetSort(sort)
|
||||
assert.NotNil(t, qb.opts.Sort)
|
||||
assert.Equal(t, sort, qb.opts.Sort)
|
||||
|
||||
// 测试 Build
|
||||
finalFilter, finalOpts := qb.Build()
|
||||
assert.Equal(t, filter, finalFilter)
|
||||
assert.Equal(t, qb.opts, finalOpts)
|
||||
}
|
||||
|
||||
func TestQueryBuilderMethods(t *testing.T) {
|
||||
qb := NewQuery()
|
||||
|
||||
// 测试 SetFilter
|
||||
filter := bsonV2.M{"name": "test"}
|
||||
qb.SetFilter(filter)
|
||||
assert.Equal(t, filter, qb.filter)
|
||||
|
||||
// 测试 SetNotEqual
|
||||
qb.SetNotEqual("status", "inactive")
|
||||
assert.Equal(t, bsonV2.M{OperatorNe: "inactive"}, qb.filter["status"])
|
||||
|
||||
// 测试 SetGreaterThan
|
||||
qb.SetGreaterThan("age", 18)
|
||||
assert.Equal(t, bsonV2.M{OperatorGt: 18}, qb.filter["age"])
|
||||
|
||||
// 测试 SetLessThan
|
||||
qb.SetLessThan("age", 30)
|
||||
assert.Equal(t, bsonV2.M{OperatorLt: 30}, qb.filter["age"])
|
||||
|
||||
// 测试 SetExists
|
||||
qb.SetExists("email", true)
|
||||
assert.Equal(t, bsonV2.M{OperatorExists: true}, qb.filter["email"])
|
||||
|
||||
// 测试 SetType
|
||||
qb.SetType("age", "int")
|
||||
assert.Equal(t, bsonV2.M{OperatorType: "int"}, qb.filter["age"])
|
||||
|
||||
// 测试 SetBetween
|
||||
qb.SetBetween("price", 10, 100)
|
||||
assert.Equal(t, bsonV2.M{OperatorGte: 10, OperatorLte: 100}, qb.filter["price"])
|
||||
|
||||
// 测试 SetOr
|
||||
orConditions := []bsonV2.M{
|
||||
{"status": "active"},
|
||||
{"status": "pending"},
|
||||
}
|
||||
qb.SetOr(orConditions)
|
||||
assert.Equal(t, orConditions, qb.filter[OperatorOr])
|
||||
|
||||
// 测试 SetAnd
|
||||
andConditions := []bsonV2.M{
|
||||
{"age": bsonV2.M{OperatorGt: 18}},
|
||||
{"status": "active"},
|
||||
}
|
||||
qb.SetAnd(andConditions)
|
||||
assert.Equal(t, andConditions, qb.filter[OperatorAnd])
|
||||
|
||||
// 测试 SetLimit
|
||||
limit := int64(10)
|
||||
qb.SetLimit(limit)
|
||||
assert.NotNil(t, qb.opts.Limit)
|
||||
assert.Equal(t, &limit, qb.opts.Limit)
|
||||
|
||||
// 测试 SetSort
|
||||
sort := bsonV2.D{{Key: "name", Value: 1}}
|
||||
qb.SetSort(sort)
|
||||
assert.NotNil(t, qb.opts.Sort)
|
||||
assert.Equal(t, sort, qb.opts.Sort)
|
||||
|
||||
// 测试 SetSortWithPriority
|
||||
sortWithPriority := []bsonV2.E{{Key: "priority", Value: -1}, {Key: "name", Value: 1}}
|
||||
qb.SetSortWithPriority(sortWithPriority)
|
||||
assert.Equal(t, bsonV2.D(sortWithPriority), qb.opts.Sort)
|
||||
|
||||
// 测试 SetProjection
|
||||
projection := bsonV2.M{"name": 1, "age": 1}
|
||||
qb.SetProjection(projection)
|
||||
assert.Equal(t, projection, qb.opts.Projection)
|
||||
|
||||
// 测试 SetSkip
|
||||
skip := int64(5)
|
||||
qb.SetSkip(skip)
|
||||
assert.NotNil(t, qb.opts.Skip)
|
||||
assert.Equal(t, &skip, qb.opts.Skip)
|
||||
|
||||
// 测试 SetPage
|
||||
page, size := int64(2), int64(10)
|
||||
qb.SetPage(page, size)
|
||||
assert.Equal(t, &size, qb.opts.Limit)
|
||||
assert.Equal(t, int64(10), *qb.opts.Limit)
|
||||
assert.Equal(t, int64(10), *qb.opts.Skip)
|
||||
|
||||
// 测试 SetRegex
|
||||
qb.SetRegex("name", "^test")
|
||||
assert.Equal(t, bsonV2.M{OperatorRegex: "^test"}, qb.filter["name"])
|
||||
|
||||
// 测试 SetIn
|
||||
qb.SetIn("tags", []interface{}{"tag1", "tag2"})
|
||||
assert.Equal(t, bsonV2.M{OperatorIn: []interface{}{"tag1", "tag2"}}, qb.filter["tags"])
|
||||
|
||||
// 测试 Build
|
||||
finalFilter, finalOpts := qb.Build()
|
||||
assert.Equal(t, qb.filter, finalFilter)
|
||||
assert.Equal(t, qb.opts, finalOpts)
|
||||
}
|
||||
|
||||
func TestSetGeoWithin(t *testing.T) {
|
||||
qb := NewQuery()
|
||||
|
||||
field := "location"
|
||||
geometry := bsonV2.M{"type": "Polygon", "coordinates": []interface{}{
|
||||
[]interface{}{
|
||||
[]float64{40.0, -70.0},
|
||||
[]float64{41.0, -70.0},
|
||||
[]float64{41.0, -71.0},
|
||||
[]float64{40.0, -71.0},
|
||||
[]float64{40.0, -70.0},
|
||||
},
|
||||
}}
|
||||
|
||||
qb.SetGeoWithin(field, geometry)
|
||||
|
||||
expected := bsonV2.M{
|
||||
OperatorGeoWithin: bsonV2.M{
|
||||
OperatorGeometry: geometry,
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, qb.filter[field])
|
||||
}
|
||||
|
||||
func TestSetGeoIntersects(t *testing.T) {
|
||||
qb := NewQuery()
|
||||
|
||||
field := "location"
|
||||
geometry := bsonV2.M{"type": "LineString", "coordinates": [][]float64{
|
||||
{40.0, -70.0},
|
||||
{41.0, -71.0},
|
||||
}}
|
||||
|
||||
qb.SetGeoIntersects(field, geometry)
|
||||
|
||||
expected := bsonV2.M{
|
||||
OperatorGeoIntersects: bsonV2.M{
|
||||
OperatorGeometry: geometry,
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, qb.filter[field])
|
||||
}
|
||||
|
||||
func TestSetNear(t *testing.T) {
|
||||
qb := NewQuery()
|
||||
|
||||
field := "location"
|
||||
point := bsonV2.M{"type": "Point", "coordinates": []float64{40.7128, -74.0060}}
|
||||
maxDistance := 500.0
|
||||
minDistance := 50.0
|
||||
|
||||
qb.SetNear(field, point, maxDistance, minDistance)
|
||||
|
||||
expected := bsonV2.M{
|
||||
OperatorNear: bsonV2.M{
|
||||
OperatorGeometry: point,
|
||||
OperatorMaxDistance: maxDistance,
|
||||
OperatorMinDistance: minDistance,
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, qb.filter[field])
|
||||
}
|
||||
|
||||
func TestSetNearSphere(t *testing.T) {
|
||||
qb := NewQuery()
|
||||
|
||||
field := "location"
|
||||
point := bsonV2.M{"type": "Point", "coordinates": []float64{40.7128, -74.0060}}
|
||||
maxDistance := 1000.0
|
||||
minDistance := 100.0
|
||||
|
||||
qb.SetNearSphere(field, point, maxDistance, minDistance)
|
||||
|
||||
expected := bsonV2.M{
|
||||
OperatorNearSphere: bsonV2.M{
|
||||
OperatorGeometry: point,
|
||||
OperatorMaxDistance: maxDistance,
|
||||
OperatorMinDistance: minDistance,
|
||||
},
|
||||
}
|
||||
|
||||
assert.Equal(t, expected, qb.filter[field])
|
||||
}
|
||||
|
||||
func TestQueryBuilderPipeline(t *testing.T) {
|
||||
// 创建 QueryBuilder 实例
|
||||
qb := NewQuery()
|
||||
|
||||
// 添加聚合阶段
|
||||
matchStage := bsonV2.M{OperatorMatch: bsonV2.M{"status": "active"}}
|
||||
groupStage := bsonV2.M{OperatorGroup: bsonV2.M{"_id": "$category", "count": bsonV2.M{OperatorSum: 1}}}
|
||||
sortStage := bsonV2.M{OperatorSortAgg: bsonV2.M{"count": -1}}
|
||||
|
||||
qb.AddStage(matchStage).AddStage(groupStage).AddStage(sortStage)
|
||||
|
||||
// 构建 Pipeline
|
||||
pipeline := qb.BuildPipeline()
|
||||
|
||||
// 验证 Pipeline
|
||||
expectedPipeline := []bsonV2.M{matchStage, groupStage, sortStage}
|
||||
assert.Equal(t, expectedPipeline, pipeline)
|
||||
}
|
||||
@@ -26,6 +26,7 @@ func NewLogger(cfg *conf.Logger) log.Logger {
|
||||
fallthrough
|
||||
case "text":
|
||||
loggerFormatter = &logrus.TextFormatter{
|
||||
ForceColors: cfg.Logrus.ForceColors,
|
||||
DisableColors: cfg.Logrus.DisableColors,
|
||||
DisableTimestamp: cfg.Logrus.DisableTimestamp,
|
||||
TimestampFormat: cfg.Logrus.TimestampFormat,
|
||||
|
||||
@@ -41,6 +41,9 @@ func NewConfigSource(c *conf.RemoteConfig) config.Source {
|
||||
LogDir: "../../configs/log", // 日志目录
|
||||
NotLoadCacheAtStart: true, // 在启动时不读取本地缓存数据,true--不读取,false--读取
|
||||
UpdateCacheWhenEmpty: true, // 当服务列表为空时是否更新本地缓存,true--更新,false--不更新
|
||||
Username: c.Nacos.Username, //用户名
|
||||
Password: c.Nacos.Password, //密码
|
||||
NamespaceId: c.Nacos.NamespaceId, //命名空间ID
|
||||
}
|
||||
|
||||
nacosClient, err := nacosClients.NewConfigClient(
|
||||
|
||||
11
tag.bat
11
tag.bat
@@ -1,8 +1,8 @@
|
||||
git tag api/v0.0.22 --force
|
||||
git tag api/v0.0.27 --force
|
||||
|
||||
git tag utils/v0.1.4 --force
|
||||
|
||||
git tag cache/redis/v0.0.10 --force
|
||||
git tag cache/redis/v0.0.11 --force
|
||||
git tag oss/minio/v0.0.10 --force
|
||||
git tag logger/v0.0.10 --force
|
||||
git tag rpc/v0.0.14 --force
|
||||
@@ -10,10 +10,11 @@ git tag tracer/v0.0.10 --force
|
||||
|
||||
git tag database/ent/v0.0.10 --force
|
||||
git tag database/gorm/v0.0.10 --force
|
||||
git tag database/mongodb/v0.0.10 --force
|
||||
git tag database/influxdb/v0.0.10 --force
|
||||
git tag database/mongodb/v0.0.12 --force
|
||||
git tag database/influxdb/v0.0.12 --force
|
||||
git tag database/clickhouse/v0.0.14 --force
|
||||
git tag database/elasticsearch/v0.0.12 --force
|
||||
git tag database/cassandra/v0.0.10 --force
|
||||
git tag database/clickhouse/v0.0.10 --force
|
||||
|
||||
git tag registry/v0.1.0 --force
|
||||
git tag registry/consul/v0.1.0 --force
|
||||
|
||||
Reference in New Issue
Block a user