1 Star 0 Fork 0

赵春 / zcutils-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
basic_asset.pb.go 14.83 KB
一键复制 编辑 原始数据 按行查看 历史
赵春 提交于 2022-12-12 18:30 . 修改protoreflect测试用例
package asset
import (
"gitee.com/zhaochuninhefei/zcutils-go/protobuf/myproto-go/owner"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
anypb "google.golang.org/protobuf/types/known/anypb"
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 BasicAsset_AssetStatus int32
const (
// 未知状态
BasicAsset_UNKNOWN BasicAsset_AssetStatus = 0
// 注册中
BasicAsset_REGISTERING BasicAsset_AssetStatus = 1
// 已注册
BasicAsset_REGISTERED BasicAsset_AssetStatus = 2
// 注册失败
BasicAsset_ERR_REGISTER BasicAsset_AssetStatus = -1
// 变更中
BasicAsset_CHANGING BasicAsset_AssetStatus = 3
// 已变更
BasicAsset_CHANGED BasicAsset_AssetStatus = 4
// 变更失败
BasicAsset_ERR_CHANGE BasicAsset_AssetStatus = -3
// 冻结中
BasicAsset_FREEZING BasicAsset_AssetStatus = 5
// 已冻结
BasicAsset_FROZEN BasicAsset_AssetStatus = 6
// 冻结失败
BasicAsset_ERR_FREEZE BasicAsset_AssetStatus = -5
)
// Enum value maps for BasicAsset_AssetStatus.
var (
BasicAsset_AssetStatus_name = map[int32]string{
0: "UNKNOWN",
1: "REGISTERING",
2: "REGISTERED",
-1: "ERR_REGISTER",
3: "CHANGING",
4: "CHANGED",
-3: "ERR_CHANGE",
5: "FREEZING",
6: "FROZEN",
-5: "ERR_FREEZE",
}
BasicAsset_AssetStatus_value = map[string]int32{
"UNKNOWN": 0,
"REGISTERING": 1,
"REGISTERED": 2,
"ERR_REGISTER": -1,
"CHANGING": 3,
"CHANGED": 4,
"ERR_CHANGE": -3,
"FREEZING": 5,
"FROZEN": 6,
"ERR_FREEZE": -5,
}
)
func (x BasicAsset_AssetStatus) Enum() *BasicAsset_AssetStatus {
p := new(BasicAsset_AssetStatus)
*p = x
return p
}
func (x BasicAsset_AssetStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (BasicAsset_AssetStatus) Descriptor() protoreflect.EnumDescriptor {
return file_asset_basic_asset_proto_enumTypes[0].Descriptor()
}
func (BasicAsset_AssetStatus) Type() protoreflect.EnumType {
return &file_asset_basic_asset_proto_enumTypes[0]
}
func (x BasicAsset_AssetStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use BasicAsset_AssetStatus.Descriptor instead.
func (BasicAsset_AssetStatus) EnumDescriptor() ([]byte, []int) {
return file_asset_basic_asset_proto_rawDescGZIP(), []int{0, 0}
}
// BasicAsset 基础资产
type BasicAsset struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
AssetId int64 `protobuf:"varint,1,opt,name=asset_id,json=assetId,proto3" json:"asset_id,omitempty"`
AssetName string `protobuf:"bytes,2,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"`
AssetPrice int64 `protobuf:"varint,3,opt,name=asset_price,json=assetPrice,proto3" json:"asset_price,omitempty"`
// 注意这里引用owner.proto中的Owner时,前面要加上它的包名owner
AssetOwner *owner.Owner `protobuf:"bytes,4,opt,name=asset_owner,json=assetOwner,proto3" json:"asset_owner,omitempty"`
AssetDesc string `protobuf:"bytes,16,opt,name=asset_desc,json=assetDesc,proto3" json:"asset_desc,omitempty"`
// oneof,只有一个字段会被实际使用
//
// Types that are assignable to AssetNum:
// *BasicAsset_AssetNumStr
// *BasicAsset_AssetNumInt
AssetNum isBasicAsset_AssetNum `protobuf_oneof:"asset_num"`
// 集合字段
Details []*anypb.Any `protobuf:"bytes,19,rep,name=details,proto3" json:"details,omitempty"`
AssetStatus BasicAsset_AssetStatus `protobuf:"varint,5,opt,name=asset_status,json=assetStatus,proto3,enum=asset.BasicAsset_AssetStatus" json:"asset_status,omitempty"`
// 资产构成
AssetComposition map[string]*BasicAsset `protobuf:"bytes,20,rep,name=asset_composition,json=assetComposition,proto3" json:"asset_composition,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
}
func (x *BasicAsset) Reset() {
*x = BasicAsset{}
if protoimpl.UnsafeEnabled {
mi := &file_asset_basic_asset_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *BasicAsset) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*BasicAsset) ProtoMessage() {}
func (x *BasicAsset) ProtoReflect() protoreflect.Message {
mi := &file_asset_basic_asset_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 BasicAsset.ProtoReflect.Descriptor instead.
func (*BasicAsset) Descriptor() ([]byte, []int) {
return file_asset_basic_asset_proto_rawDescGZIP(), []int{0}
}
func (x *BasicAsset) GetAssetId() int64 {
if x != nil {
return x.AssetId
}
return 0
}
func (x *BasicAsset) GetAssetName() string {
if x != nil {
return x.AssetName
}
return ""
}
func (x *BasicAsset) GetAssetPrice() int64 {
if x != nil {
return x.AssetPrice
}
return 0
}
func (x *BasicAsset) GetAssetOwner() *owner.Owner {
if x != nil {
return x.AssetOwner
}
return nil
}
func (x *BasicAsset) GetAssetDesc() string {
if x != nil {
return x.AssetDesc
}
return ""
}
func (m *BasicAsset) GetAssetNum() isBasicAsset_AssetNum {
if m != nil {
return m.AssetNum
}
return nil
}
func (x *BasicAsset) GetAssetNumStr() string {
if x, ok := x.GetAssetNum().(*BasicAsset_AssetNumStr); ok {
return x.AssetNumStr
}
return ""
}
func (x *BasicAsset) GetAssetNumInt() int64 {
if x, ok := x.GetAssetNum().(*BasicAsset_AssetNumInt); ok {
return x.AssetNumInt
}
return 0
}
func (x *BasicAsset) GetDetails() []*anypb.Any {
if x != nil {
return x.Details
}
return nil
}
func (x *BasicAsset) GetAssetStatus() BasicAsset_AssetStatus {
if x != nil {
return x.AssetStatus
}
return BasicAsset_UNKNOWN
}
func (x *BasicAsset) GetAssetComposition() map[string]*BasicAsset {
if x != nil {
return x.AssetComposition
}
return nil
}
type isBasicAsset_AssetNum interface {
isBasicAsset_AssetNum()
}
type BasicAsset_AssetNumStr struct {
AssetNumStr string `protobuf:"bytes,17,opt,name=asset_num_str,json=assetNumStr,proto3,oneof"`
}
type BasicAsset_AssetNumInt struct {
AssetNumInt int64 `protobuf:"varint,18,opt,name=asset_num_int,json=assetNumInt,proto3,oneof"`
}
func (*BasicAsset_AssetNumStr) isBasicAsset_AssetNum() {}
func (*BasicAsset_AssetNumInt) isBasicAsset_AssetNum() {}
var File_asset_basic_asset_proto protoreflect.FileDescriptor
var file_asset_basic_asset_proto_rawDesc = []byte{
0x0a, 0x17, 0x61, 0x73, 0x73, 0x65, 0x74, 0x2f, 0x62, 0x61, 0x73, 0x69, 0x63, 0x5f, 0x61, 0x73,
0x73, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x61, 0x73, 0x73, 0x65, 0x74,
0x1a, 0x11, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x2f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2f, 0x61, 0x6e, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xee,
0x05, 0x0a, 0x0a, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x73, 0x73, 0x65, 0x74, 0x12, 0x19, 0x0a,
0x08, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
0x07, 0x61, 0x73, 0x73, 0x65, 0x74, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65,
0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x73,
0x73, 0x65, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x65, 0x74,
0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x73,
0x73, 0x65, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x0b, 0x61, 0x73, 0x73, 0x65,
0x74, 0x5f, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e,
0x6f, 0x77, 0x6e, 0x65, 0x72, 0x2e, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x52, 0x0a, 0x61, 0x73, 0x73,
0x65, 0x74, 0x4f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x1d, 0x0a, 0x0a, 0x61, 0x73, 0x73, 0x65, 0x74,
0x5f, 0x64, 0x65, 0x73, 0x63, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x73, 0x73,
0x65, 0x74, 0x44, 0x65, 0x73, 0x63, 0x12, 0x24, 0x0a, 0x0d, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f,
0x6e, 0x75, 0x6d, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52,
0x0b, 0x61, 0x73, 0x73, 0x65, 0x74, 0x4e, 0x75, 0x6d, 0x53, 0x74, 0x72, 0x12, 0x24, 0x0a, 0x0d,
0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x5f, 0x69, 0x6e, 0x74, 0x18, 0x12, 0x20,
0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x0b, 0x61, 0x73, 0x73, 0x65, 0x74, 0x4e, 0x75, 0x6d, 0x49,
0x6e, 0x74, 0x12, 0x2e, 0x0a, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x18, 0x13, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x41, 0x6e, 0x79, 0x52, 0x07, 0x64, 0x65, 0x74, 0x61, 0x69,
0x6c, 0x73, 0x12, 0x40, 0x0a, 0x0c, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74,
0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x73, 0x73, 0x65, 0x74, 0x2e, 0x41, 0x73, 0x73, 0x65,
0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0b, 0x61, 0x73, 0x73, 0x65, 0x74, 0x53, 0x74,
0x61, 0x74, 0x75, 0x73, 0x12, 0x54, 0x0a, 0x11, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x63, 0x6f,
0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x27, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x2e, 0x42, 0x61, 0x73, 0x69, 0x63, 0x41, 0x73, 0x73,
0x65, 0x74, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74,
0x69, 0x6f, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x10, 0x61, 0x73, 0x73, 0x65, 0x74, 0x43,
0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x56, 0x0a, 0x15, 0x41, 0x73,
0x73, 0x65, 0x74, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x6e,
0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x27, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x61, 0x73, 0x73, 0x65, 0x74, 0x2e, 0x42, 0x61, 0x73,
0x69, 0x63, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02,
0x38, 0x01, 0x22, 0xbd, 0x01, 0x0a, 0x0b, 0x41, 0x73, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74,
0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12,
0x0f, 0x0a, 0x0b, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x45, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x01,
0x12, 0x0e, 0x0a, 0x0a, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x45, 0x52, 0x45, 0x44, 0x10, 0x02,
0x12, 0x19, 0x0a, 0x0c, 0x45, 0x52, 0x52, 0x5f, 0x52, 0x45, 0x47, 0x49, 0x53, 0x54, 0x45, 0x52,
0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x43,
0x48, 0x41, 0x4e, 0x47, 0x49, 0x4e, 0x47, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x48, 0x41,
0x4e, 0x47, 0x45, 0x44, 0x10, 0x04, 0x12, 0x17, 0x0a, 0x0a, 0x45, 0x52, 0x52, 0x5f, 0x43, 0x48,
0x41, 0x4e, 0x47, 0x45, 0x10, 0xfd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x12,
0x0c, 0x0a, 0x08, 0x46, 0x52, 0x45, 0x45, 0x5a, 0x49, 0x4e, 0x47, 0x10, 0x05, 0x12, 0x0a, 0x0a,
0x06, 0x46, 0x52, 0x4f, 0x5a, 0x45, 0x4e, 0x10, 0x06, 0x12, 0x17, 0x0a, 0x0a, 0x45, 0x52, 0x52,
0x5f, 0x46, 0x52, 0x45, 0x45, 0x5a, 0x45, 0x10, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0x01, 0x42, 0x0b, 0x0a, 0x09, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x6e, 0x75, 0x6d, 0x42,
0x2d, 0x5a, 0x2b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x7a, 0x68,
0x61, 0x6f, 0x63, 0x68, 0x75, 0x6e, 0x69, 0x6e, 0x68, 0x65, 0x66, 0x65, 0x69, 0x2f, 0x6d, 0x79,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x67, 0x6f, 0x2f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_asset_basic_asset_proto_rawDescOnce sync.Once
file_asset_basic_asset_proto_rawDescData = file_asset_basic_asset_proto_rawDesc
)
func file_asset_basic_asset_proto_rawDescGZIP() []byte {
file_asset_basic_asset_proto_rawDescOnce.Do(func() {
file_asset_basic_asset_proto_rawDescData = protoimpl.X.CompressGZIP(file_asset_basic_asset_proto_rawDescData)
})
return file_asset_basic_asset_proto_rawDescData
}
var file_asset_basic_asset_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_asset_basic_asset_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_asset_basic_asset_proto_goTypes = []interface{}{
(BasicAsset_AssetStatus)(0), // 0: asset.BasicAsset.AssetStatus
(*BasicAsset)(nil), // 1: asset.BasicAsset
nil, // 2: asset.BasicAsset.AssetCompositionEntry
(*owner.Owner)(nil), // 3: owner.Owner
(*anypb.Any)(nil), // 4: google.protobuf.Any
}
var file_asset_basic_asset_proto_depIdxs = []int32{
3, // 0: asset.BasicAsset.asset_owner:type_name -> owner.Owner
4, // 1: asset.BasicAsset.details:type_name -> google.protobuf.Any
0, // 2: asset.BasicAsset.asset_status:type_name -> asset.BasicAsset.AssetStatus
2, // 3: asset.BasicAsset.asset_composition:type_name -> asset.BasicAsset.AssetCompositionEntry
1, // 4: asset.BasicAsset.AssetCompositionEntry.value:type_name -> asset.BasicAsset
5, // [5:5] is the sub-list for method output_type
5, // [5:5] is the sub-list for method input_type
5, // [5:5] is the sub-list for extension type_name
5, // [5:5] is the sub-list for extension extendee
0, // [0:5] is the sub-list for field type_name
}
func init() { file_asset_basic_asset_proto_init() }
func file_asset_basic_asset_proto_init() {
if File_asset_basic_asset_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_asset_basic_asset_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*BasicAsset); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
file_asset_basic_asset_proto_msgTypes[0].OneofWrappers = []interface{}{
(*BasicAsset_AssetNumStr)(nil),
(*BasicAsset_AssetNumInt)(nil),
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_asset_basic_asset_proto_rawDesc,
NumEnums: 1,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_asset_basic_asset_proto_goTypes,
DependencyIndexes: file_asset_basic_asset_proto_depIdxs,
EnumInfos: file_asset_basic_asset_proto_enumTypes,
MessageInfos: file_asset_basic_asset_proto_msgTypes,
}.Build()
File_asset_basic_asset_proto = out.File
file_asset_basic_asset_proto_rawDesc = nil
file_asset_basic_asset_proto_goTypes = nil
file_asset_basic_asset_proto_depIdxs = nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/zhaochuninhefei/zcutils-go.git
git@gitee.com:zhaochuninhefei/zcutils-go.git
zhaochuninhefei
zcutils-go
zcutils-go
v0.0.12

搜索帮助

344bd9b3 5694891 D2dac590 5694891