上传db缓存测试代码
This commit is contained in:
parent
cec2f4ced8
commit
7e3a66ff6d
@ -13,6 +13,7 @@ sys:
|
|||||||
Loglevel: 0 #日志文件输出级别
|
Loglevel: 0 #日志文件输出级别
|
||||||
LogMaxSize: 128 #日志文件最大Size
|
LogMaxSize: 128 #日志文件最大Size
|
||||||
LogMaxAge: 7 #日志文件最多保留天数
|
LogMaxAge: 7 #日志文件最多保留天数
|
||||||
|
Debugmode: true
|
||||||
registry: #注册表系统 服务发现
|
registry: #注册表系统 服务发现
|
||||||
RegistryType: 0 #服务发现系统 0 Consul 组件
|
RegistryType: 0 #服务发现系统 0 Consul 组件
|
||||||
Consul_Addr: "10.0.0.9:8500"
|
Consul_Addr: "10.0.0.9:8500"
|
||||||
|
@ -13,6 +13,7 @@ sys:
|
|||||||
Loglevel: 0 #日志文件输出级别
|
Loglevel: 0 #日志文件输出级别
|
||||||
LogMaxSize: 128 #日志文件最大Size
|
LogMaxSize: 128 #日志文件最大Size
|
||||||
LogMaxAge: 7 #日志文件最多保留天数
|
LogMaxAge: 7 #日志文件最多保留天数
|
||||||
|
Debugmode: true
|
||||||
registry: #注册表系统 服务发现
|
registry: #注册表系统 服务发现
|
||||||
RegistryType: 0 #服务发现系统 0 Consul 组件
|
RegistryType: 0 #服务发现系统 0 Consul 组件
|
||||||
Consul_Addr: "10.0.0.9:8500"
|
Consul_Addr: "10.0.0.9:8500"
|
||||||
|
11
pb/proto/user_db.proto
Normal file
11
pb/proto/user_db.proto
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
option go_package = ".;pb";
|
||||||
|
|
||||||
|
message Cache_UserData {
|
||||||
|
uint32 UserId = 1;
|
||||||
|
string SessionId = 2;
|
||||||
|
string GatewayServiceId = 3;
|
||||||
|
string NiceName = 4;
|
||||||
|
string Email = 5;
|
||||||
|
string Password = 6;
|
||||||
|
}
|
@ -4,6 +4,7 @@ option go_package = ".;pb";
|
|||||||
message UserLoginReq {
|
message UserLoginReq {
|
||||||
string Name = 1;
|
string Name = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
message UserLoginResp {
|
message UserLoginResp {
|
||||||
int32 Code = 1;
|
int32 Code = 1;
|
||||||
}
|
}
|
||||||
|
191
pb/user_db.pb.go
Normal file
191
pb/user_db.pb.go
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// protoc-gen-go v1.28.0
|
||||||
|
// protoc v3.20.0
|
||||||
|
// source: user_db.proto
|
||||||
|
|
||||||
|
package pb
|
||||||
|
|
||||||
|
import (
|
||||||
|
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||||
|
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||||
|
reflect "reflect"
|
||||||
|
sync "sync"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Verify that this generated code is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||||
|
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||||
|
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||||
|
)
|
||||||
|
|
||||||
|
type Cache_UserData struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
UserId uint32 `protobuf:"varint,1,opt,name=UserId,proto3" json:"UserId,omitempty"`
|
||||||
|
SessionId string `protobuf:"bytes,2,opt,name=SessionId,proto3" json:"SessionId,omitempty"`
|
||||||
|
GatewayServiceId string `protobuf:"bytes,3,opt,name=GatewayServiceId,proto3" json:"GatewayServiceId,omitempty"`
|
||||||
|
NiceName string `protobuf:"bytes,4,opt,name=NiceName,proto3" json:"NiceName,omitempty"`
|
||||||
|
Email string `protobuf:"bytes,5,opt,name=Email,proto3" json:"Email,omitempty"`
|
||||||
|
Password string `protobuf:"bytes,6,opt,name=Password,proto3" json:"Password,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) Reset() {
|
||||||
|
*x = Cache_UserData{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_user_db_proto_msgTypes[0]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*Cache_UserData) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_user_db_proto_msgTypes[0]
|
||||||
|
if protoimpl.UnsafeEnabled && x != nil {
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
if ms.LoadMessageInfo() == nil {
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
return ms
|
||||||
|
}
|
||||||
|
return mi.MessageOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deprecated: Use Cache_UserData.ProtoReflect.Descriptor instead.
|
||||||
|
func (*Cache_UserData) Descriptor() ([]byte, []int) {
|
||||||
|
return file_user_db_proto_rawDescGZIP(), []int{0}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) GetUserId() uint32 {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) GetSessionId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.SessionId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) GetGatewayServiceId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.GatewayServiceId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) GetNiceName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.NiceName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) GetEmail() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Email
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *Cache_UserData) GetPassword() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Password
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
var File_user_db_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
|
var file_user_db_proto_rawDesc = []byte{
|
||||||
|
0x0a, 0x0d, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
|
||||||
|
0xc0, 0x01, 0x0a, 0x0e, 0x43, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x55, 0x73, 0x65, 0x72, 0x44, 0x61,
|
||||||
|
0x74, 0x61, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||||
|
0x28, 0x0d, 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x65,
|
||||||
|
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53,
|
||||||
|
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65,
|
||||||
|
0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
|
||||||
|
0x28, 0x09, 0x52, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||||
|
0x63, 0x65, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
||||||
|
0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x4e, 0x69, 0x63, 0x65, 0x4e, 0x61, 0x6d, 0x65,
|
||||||
|
0x12, 0x14, 0x0a, 0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52,
|
||||||
|
0x05, 0x45, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||||
|
0x72, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x50, 0x61, 0x73, 0x73, 0x77, 0x6f,
|
||||||
|
0x72, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
|
||||||
|
0x6f, 0x33,
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
file_user_db_proto_rawDescOnce sync.Once
|
||||||
|
file_user_db_proto_rawDescData = file_user_db_proto_rawDesc
|
||||||
|
)
|
||||||
|
|
||||||
|
func file_user_db_proto_rawDescGZIP() []byte {
|
||||||
|
file_user_db_proto_rawDescOnce.Do(func() {
|
||||||
|
file_user_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_user_db_proto_rawDescData)
|
||||||
|
})
|
||||||
|
return file_user_db_proto_rawDescData
|
||||||
|
}
|
||||||
|
|
||||||
|
var file_user_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
|
||||||
|
var file_user_db_proto_goTypes = []interface{}{
|
||||||
|
(*Cache_UserData)(nil), // 0: Cache_UserData
|
||||||
|
}
|
||||||
|
var file_user_db_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
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() { file_user_db_proto_init() }
|
||||||
|
func file_user_db_proto_init() {
|
||||||
|
if File_user_db_proto != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if !protoimpl.UnsafeEnabled {
|
||||||
|
file_user_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*Cache_UserData); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type x struct{}
|
||||||
|
out := protoimpl.TypeBuilder{
|
||||||
|
File: protoimpl.DescBuilder{
|
||||||
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
|
RawDescriptor: file_user_db_proto_rawDesc,
|
||||||
|
NumEnums: 0,
|
||||||
|
NumMessages: 1,
|
||||||
|
NumExtensions: 0,
|
||||||
|
NumServices: 0,
|
||||||
|
},
|
||||||
|
GoTypes: file_user_db_proto_goTypes,
|
||||||
|
DependencyIndexes: file_user_db_proto_depIdxs,
|
||||||
|
MessageInfos: file_user_db_proto_msgTypes,
|
||||||
|
}.Build()
|
||||||
|
File_user_db_proto = out.File
|
||||||
|
file_user_db_proto_rawDesc = nil
|
||||||
|
file_user_db_proto_goTypes = nil
|
||||||
|
file_user_db_proto_depIdxs = nil
|
||||||
|
}
|
@ -26,4 +26,5 @@ def buildProto(pbpath,outpath,pbfile):
|
|||||||
f.write(file_data)
|
f.write(file_data)
|
||||||
|
|
||||||
buildProto('./pb/proto','./pb','comm')
|
buildProto('./pb/proto','./pb','comm')
|
||||||
|
buildProto('./pb/proto','./pb','user_db')
|
||||||
buildProto('./pb/proto','./pb','user_msg')
|
buildProto('./pb/proto','./pb','user_msg')
|
2
sys/cache/core.go
vendored
2
sys/cache/core.go
vendored
@ -5,6 +5,8 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const ()
|
||||||
|
|
||||||
var defsys ISys
|
var defsys ISys
|
||||||
|
|
||||||
func OnInit(config map[string]interface{}, option ...Option) (err error) {
|
func OnInit(config map[string]interface{}, option ...Option) (err error) {
|
||||||
|
16
sys/cache/user.go
vendored
Normal file
16
sys/cache/user.go
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
package cache
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
|
||||||
|
"github.com/liwei1dao/lego/core"
|
||||||
|
)
|
||||||
|
|
||||||
|
const ( //Redis
|
||||||
|
Redis_UserCache core.Redis_Key = "user:%d" //会话列表
|
||||||
|
)
|
||||||
|
|
||||||
|
func (this *Cache) UpdateUserCache(data *pb.Cache_UserData) (err error) {
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user