diff --git a/src/go.mod b/src/go.mod index 413d2ab..6629bf7 100644 --- a/src/go.mod +++ b/src/go.mod @@ -8,9 +8,9 @@ require ( github.com/cenkalti/backoff/v4 v4.1.3 github.com/go-redis/redis v6.15.9+incompatible github.com/go-redis/redis/v8 v8.11.5 + github.com/golang/protobuf v1.5.2 github.com/infobloxopen/atlas-app-toolkit v1.2.1 github.com/infobloxopen/protoc-gen-gorm v1.1.0 - github.com/jinzhu/copier v0.3.5 github.com/jinzhu/gorm v1.9.16 github.com/joho/godotenv v1.4.0 github.com/kelseyhightower/envconfig v1.4.0 @@ -20,7 +20,6 @@ require ( go.uber.org/zap v1.21.0 golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b - google.golang.org/protobuf v1.28.1 gorm.io/driver/postgres v1.3.8 gorm.io/gorm v1.23.8 ) @@ -34,7 +33,6 @@ require ( github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect github.com/eapache/queue v1.1.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/protobuf v1.5.2 // indirect github.com/golang/snappy v0.0.4 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.0 // indirect @@ -72,5 +70,6 @@ require ( golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect golang.org/x/text v0.3.7 // indirect google.golang.org/grpc v1.48.0 // indirect + google.golang.org/protobuf v1.28.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/src/models/address.pb.go b/src/models/address.pb.go index 74469d6..fa995a6 100644 --- a/src/models/address.pb.go +++ b/src/models/address.pb.go @@ -1,27 +1,31 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: address.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 Address struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // BlockETL Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address"` IsContract bool `protobuf:"varint,2,opt,name=is_contract,json=isContract,proto3" json:"is_contract"` @@ -46,242 +50,346 @@ type Address struct { // Governance Prep Processed IsPrep bool `protobuf:"varint,13,opt,name=is_prep,json=isPrep,proto3" json:"is_prep"` // Tokens - TokenStandard string `protobuf:"bytes,16,opt,name=token_standard,json=tokenStandard,proto3" json:"token_standard"` - Symbol string `protobuf:"bytes,17,opt,name=symbol,proto3" json:"symbol"` + TokenStandard string `protobuf:"bytes,16,opt,name=token_standard,json=tokenStandard,proto3" json:"token_standard"` + Symbol string `protobuf:"bytes,17,opt,name=symbol,proto3" json:"symbol"` } -func (m *Address) Reset() { *m = Address{} } -func (m *Address) String() string { return proto.CompactTextString(m) } -func (*Address) ProtoMessage() {} -func (*Address) Descriptor() ([]byte, []int) { - return fileDescriptor_982c640dad8fe78e, []int{0} +func (x *Address) Reset() { + *x = Address{} + if protoimpl.UnsafeEnabled { + mi := &file_address_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Address) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Address.Unmarshal(m, b) -} -func (m *Address) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Address.Marshal(b, m, deterministic) +func (x *Address) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Address) XXX_Merge(src proto.Message) { - xxx_messageInfo_Address.Merge(m, src) -} -func (m *Address) XXX_Size() int { - return xxx_messageInfo_Address.Size(m) -} -func (m *Address) XXX_DiscardUnknown() { - xxx_messageInfo_Address.DiscardUnknown(m) + +func (*Address) ProtoMessage() {} + +func (x *Address) ProtoReflect() protoreflect.Message { + mi := &file_address_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) } -var xxx_messageInfo_Address proto.InternalMessageInfo +// Deprecated: Use Address.ProtoReflect.Descriptor instead. +func (*Address) Descriptor() ([]byte, []int) { + return file_address_proto_rawDescGZIP(), []int{0} +} -func (m *Address) GetAddress() string { - if m != nil { - return m.Address +func (x *Address) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *Address) GetIsContract() bool { - if m != nil { - return m.IsContract +func (x *Address) GetIsContract() bool { + if x != nil { + return x.IsContract } return false } -func (m *Address) GetTransactionCount() int64 { - if m != nil { - return m.TransactionCount +func (x *Address) GetTransactionCount() int64 { + if x != nil { + return x.TransactionCount } return 0 } -func (m *Address) GetTransactionInternalCount() int64 { - if m != nil { - return m.TransactionInternalCount +func (x *Address) GetTransactionInternalCount() int64 { + if x != nil { + return x.TransactionInternalCount } return 0 } -func (m *Address) GetLogCount() int64 { - if m != nil { - return m.LogCount +func (x *Address) GetLogCount() int64 { + if x != nil { + return x.LogCount } return 0 } -func (m *Address) GetTokenTransferCount() int64 { - if m != nil { - return m.TokenTransferCount +func (x *Address) GetTokenTransferCount() int64 { + if x != nil { + return x.TokenTransferCount } return 0 } -func (m *Address) GetBalance() float64 { - if m != nil { - return m.Balance +func (x *Address) GetBalance() float64 { + if x != nil { + return x.Balance } return 0 } -func (m *Address) GetType() string { - if m != nil { - return m.Type +func (x *Address) GetType() string { + if x != nil { + return x.Type } return "" } -func (m *Address) GetName() string { - if m != nil { - return m.Name +func (x *Address) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *Address) GetCreatedTimestamp() int64 { - if m != nil { - return m.CreatedTimestamp +func (x *Address) GetCreatedTimestamp() int64 { + if x != nil { + return x.CreatedTimestamp } return 0 } -func (m *Address) GetIsToken() bool { - if m != nil { - return m.IsToken +func (x *Address) GetIsToken() bool { + if x != nil { + return x.IsToken } return false } -func (m *Address) GetIsNft() bool { - if m != nil { - return m.IsNft +func (x *Address) GetIsNft() bool { + if x != nil { + return x.IsNft } return false } -func (m *Address) GetContractUpdatedBlock() int64 { - if m != nil { - return m.ContractUpdatedBlock +func (x *Address) GetContractUpdatedBlock() int64 { + if x != nil { + return x.ContractUpdatedBlock } return 0 } -func (m *Address) GetAuditTxHash() string { - if m != nil { - return m.AuditTxHash +func (x *Address) GetAuditTxHash() string { + if x != nil { + return x.AuditTxHash } return "" } -func (m *Address) GetCodeHash() string { - if m != nil { - return m.CodeHash +func (x *Address) GetCodeHash() string { + if x != nil { + return x.CodeHash } return "" } -func (m *Address) GetDeployTxHash() string { - if m != nil { - return m.DeployTxHash +func (x *Address) GetDeployTxHash() string { + if x != nil { + return x.DeployTxHash } return "" } -func (m *Address) GetContractType() string { - if m != nil { - return m.ContractType +func (x *Address) GetContractType() string { + if x != nil { + return x.ContractType } return "" } -func (m *Address) GetStatus() string { - if m != nil { - return m.Status +func (x *Address) GetStatus() string { + if x != nil { + return x.Status } return "" } -func (m *Address) GetOwner() string { - if m != nil { - return m.Owner +func (x *Address) GetOwner() string { + if x != nil { + return x.Owner } return "" } -func (m *Address) GetIsPrep() bool { - if m != nil { - return m.IsPrep +func (x *Address) GetIsPrep() bool { + if x != nil { + return x.IsPrep } return false } -func (m *Address) GetTokenStandard() string { - if m != nil { - return m.TokenStandard +func (x *Address) GetTokenStandard() string { + if x != nil { + return x.TokenStandard } return "" } -func (m *Address) GetSymbol() string { - if m != nil { - return m.Symbol +func (x *Address) GetSymbol() string { + if x != nil { + return x.Symbol } return "" } -func init() { - proto.RegisterType((*Address)(nil), "models.Address") -} - -func init() { - proto.RegisterFile("address.proto", fileDescriptor_982c640dad8fe78e) -} - -var fileDescriptor_982c640dad8fe78e = []byte{ - // 706 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdd, 0x6e, 0xe2, 0x38, - 0x14, 0xc7, 0x95, 0x96, 0x86, 0x70, 0x5a, 0xba, 0xad, 0x4b, 0xc1, 0x86, 0x7e, 0x50, 0xd4, 0xad, - 0xd0, 0x4a, 0x05, 0xed, 0x47, 0xb5, 0x52, 0x6f, 0xb6, 0x4b, 0xa5, 0xd5, 0xf6, 0x66, 0xb5, 0xf2, - 0x30, 0x37, 0xbd, 0x89, 0x4c, 0x62, 0x20, 0x6a, 0xb0, 0xa3, 0xd8, 0xcc, 0xd0, 0x47, 0x4b, 0x1e, - 0x68, 0x9e, 0x63, 0x14, 0x27, 0xa0, 0xf4, 0x4b, 0x9a, 0x3b, 0x9f, 0xff, 0xf9, 0xf9, 0xef, 0x93, - 0x73, 0x1c, 0x43, 0x9d, 0xf9, 0x7e, 0xcc, 0x95, 0x1a, 0x44, 0xb1, 0xd4, 0x12, 0xd9, 0x0b, 0xe9, - 0xf3, 0x50, 0xb5, 0xef, 0x66, 0x81, 0x9e, 0x2f, 0x27, 0x03, 0x4f, 0x2e, 0x86, 0x81, 0x98, 0xca, - 0x49, 0x28, 0x57, 0x32, 0xe2, 0x62, 0x68, 0x30, 0xef, 0x7a, 0xc6, 0xc5, 0xf5, 0x4c, 0xc6, 0x8b, - 0x3c, 0x1e, 0xca, 0x48, 0x07, 0x52, 0xa8, 0x61, 0x26, 0xe5, 0x4e, 0xbd, 0x6f, 0x35, 0xa8, 0xfe, - 0x9d, 0x7b, 0xa3, 0x1e, 0x54, 0x8b, 0x63, 0xb0, 0xd5, 0xb5, 0xfa, 0xb5, 0x91, 0x93, 0x26, 0xa4, - 0x02, 0x5b, 0x7d, 0x8b, 0xae, 0x13, 0xe8, 0x0e, 0x76, 0x03, 0xe5, 0x7a, 0x52, 0xe8, 0x98, 0x79, - 0x1a, 0x6f, 0x75, 0xad, 0xbe, 0x33, 0x3a, 0x4f, 0x13, 0xd2, 0x01, 0x42, 0x5b, 0x05, 0xe5, 0x06, - 0xfe, 0xca, 0x2d, 0x61, 0x14, 0x02, 0x75, 0x5f, 0xac, 0x11, 0x85, 0x43, 0x1d, 0x33, 0xa1, 0x98, - 0x97, 0x15, 0xe3, 0x7a, 0x72, 0x29, 0x34, 0xde, 0xee, 0x5a, 0xfd, 0xed, 0xd1, 0xcf, 0x69, 0x42, - 0x2e, 0xe0, 0x9c, 0x9e, 0x96, 0x7d, 0xde, 0xc0, 0xf4, 0xa0, 0x24, 0xdd, 0x67, 0x0a, 0x0a, 0xa1, - 0x5d, 0xc6, 0x02, 0xa1, 0x79, 0x2c, 0x58, 0x58, 0x98, 0x57, 0x8c, 0xf9, 0x20, 0x4d, 0xc8, 0x2f, - 0xd0, 0xa7, 0x57, 0x1f, 0x99, 0xbf, 0xdc, 0x45, 0x71, 0x29, 0xf7, 0x50, 0xa4, 0xf2, 0xd3, 0x6e, - 0xa1, 0x16, 0xca, 0x59, 0x61, 0xbe, 0x63, 0xcc, 0x4f, 0xd3, 0x84, 0x10, 0x68, 0xd1, 0xe3, 0xb2, - 0xf9, 0x06, 0xa2, 0x4e, 0x28, 0x67, 0xf9, 0xde, 0x47, 0x68, 0x68, 0xf9, 0xc4, 0x45, 0x7e, 0xf2, - 0x94, 0xc7, 0x85, 0x8d, 0x6d, 0x6c, 0xfa, 0x69, 0x42, 0x2e, 0xa1, 0x47, 0xbb, 0x2f, 0x6a, 0x7c, - 0x87, 0xa7, 0xc8, 0xa8, 0xe3, 0x42, 0xcc, 0xbd, 0x6f, 0xa0, 0x3a, 0x61, 0x21, 0x13, 0x1e, 0xc7, - 0xd5, 0xae, 0xd5, 0xb7, 0x46, 0x9d, 0x34, 0x21, 0x2d, 0x38, 0xa6, 0x47, 0x65, 0xbb, 0x02, 0xa1, - 0x6b, 0x16, 0x21, 0xa8, 0xe8, 0xe7, 0x88, 0x63, 0x27, 0x9b, 0x39, 0x35, 0x6b, 0x74, 0x03, 0x15, - 0xc1, 0x16, 0x1c, 0xd7, 0xcc, 0x3d, 0xb8, 0x48, 0x13, 0x72, 0x0a, 0x1d, 0x4a, 0xca, 0x3e, 0xeb, - 0xe1, 0xba, 0x19, 0x48, 0x0d, 0x9e, 0xcd, 0xd6, 0x8b, 0x39, 0xd3, 0xdc, 0x77, 0x75, 0xb0, 0xe0, - 0x4a, 0xb3, 0x45, 0x84, 0x77, 0x3f, 0x9e, 0xed, 0x1b, 0x98, 0x1e, 0x14, 0xd2, 0x78, 0xad, 0xa0, - 0x3f, 0xc1, 0x09, 0x54, 0xde, 0x04, 0xbc, 0x67, 0xae, 0xdb, 0x49, 0x9a, 0x10, 0x0c, 0x4d, 0xda, - 0x78, 0x75, 0xdd, 0x0c, 0x43, 0xab, 0x81, 0x1a, 0x67, 0x0b, 0xf4, 0x2b, 0xd8, 0x81, 0x72, 0xc5, - 0x54, 0xe3, 0x23, 0xb3, 0xad, 0x9d, 0x26, 0xa4, 0x09, 0x0d, 0x8a, 0x5e, 0x6d, 0x13, 0x53, 0x4d, - 0x77, 0x02, 0xf5, 0xdf, 0x54, 0xa3, 0x3f, 0xa0, 0xb9, 0xf9, 0xac, 0x65, 0xe4, 0x9b, 0xda, 0x26, - 0xa1, 0xf4, 0x9e, 0xf0, 0x7e, 0xf6, 0x11, 0xb4, 0xb1, 0xce, 0x7e, 0xce, 0x93, 0xa3, 0x2c, 0x87, - 0x7a, 0x50, 0x67, 0x4b, 0x3f, 0xd0, 0xae, 0x5e, 0xb9, 0x73, 0xa6, 0xe6, 0xb8, 0x61, 0x3a, 0xb9, - 0x6b, 0xc4, 0xf1, 0xea, 0x5f, 0xa6, 0xe6, 0xa8, 0x03, 0x35, 0x4f, 0xfa, 0x3c, 0xcf, 0x1f, 0x9b, - 0xbc, 0x93, 0x09, 0x26, 0x79, 0x09, 0xfb, 0x3e, 0x8f, 0x42, 0xf9, 0xbc, 0x71, 0x68, 0x1a, 0x62, - 0x2f, 0x57, 0x0b, 0x8b, 0x7f, 0xa0, 0xbe, 0x29, 0xce, 0x0c, 0xec, 0xa7, 0x1f, 0x18, 0x4e, 0x06, - 0xd2, 0xbd, 0x75, 0x38, 0xce, 0x66, 0xfb, 0x1b, 0xd8, 0x4a, 0x33, 0xbd, 0x54, 0x18, 0x8c, 0xc1, - 0xbb, 0x7d, 0xc9, 0x09, 0x5a, 0x90, 0xa8, 0x01, 0x3b, 0xf2, 0xab, 0xe0, 0x31, 0x6e, 0x99, 0xc2, - 0xf2, 0x00, 0xfd, 0x05, 0xd5, 0x40, 0xb9, 0x51, 0xcc, 0x23, 0x5c, 0x37, 0x2d, 0xbe, 0x4a, 0x13, - 0xd2, 0x83, 0x2e, 0x3d, 0x7b, 0xd5, 0xe2, 0x99, 0xfc, 0x92, 0xfd, 0x3f, 0xc2, 0xe3, 0x86, 0xa6, - 0x76, 0xa0, 0xfe, 0x8f, 0x79, 0x84, 0x1e, 0x60, 0x3f, 0xbf, 0xdd, 0x4a, 0x33, 0xe1, 0xb3, 0xd8, - 0xc7, 0x07, 0xa6, 0xa4, 0x5e, 0x9a, 0x90, 0x33, 0x38, 0xa1, 0xed, 0xb7, 0xff, 0xc1, 0x9a, 0xa4, - 0x75, 0x13, 0x7f, 0x2a, 0x42, 0xd4, 0x04, 0x5b, 0x3d, 0x2f, 0x26, 0x32, 0xc4, 0x87, 0xa6, 0xc4, - 0x22, 0xba, 0xb5, 0xd3, 0x84, 0x6c, 0x39, 0xd6, 0x08, 0x1e, 0x9d, 0xc1, 0x30, 0x7f, 0x36, 0x27, - 0xb6, 0x79, 0xfb, 0x7e, 0xff, 0x1e, 0x00, 0x00, 0xff, 0xff, 0xa2, 0x57, 0x06, 0x14, 0x56, 0x05, - 0x00, 0x00, +var File_address_proto protoreflect.FileDescriptor + +var file_address_proto_rawDesc = []byte{ + 0x0a, 0x0d, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, + 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, + 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, + 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, + 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xe6, 0x09, 0x0a, 0x07, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x22, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, + 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x40, 0x0a, 0x0b, 0x69, 0x73, 0x5f, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x42, 0x1f, + 0xba, 0xb9, 0x19, 0x1b, 0x0a, 0x19, 0x52, 0x17, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, + 0x69, 0x64, 0x78, 0x5f, 0x69, 0x73, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x52, + 0x0a, 0x69, 0x73, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x12, 0x52, 0x0a, 0x11, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x42, 0x25, 0xba, 0xb9, 0x19, 0x21, 0x0a, 0x1f, 0x52, 0x1d, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, 0x10, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, + 0x6c, 0x0a, 0x1a, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x03, 0x42, 0x2e, 0xba, 0xb9, 0x19, 0x2a, 0x0a, 0x28, 0x52, 0x26, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x52, 0x18, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3a, 0x0a, + 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, + 0x42, 0x1d, 0xba, 0xb9, 0x19, 0x19, 0x0a, 0x17, 0x52, 0x15, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x6c, 0x6f, 0x67, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x52, + 0x08, 0x6c, 0x6f, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x5a, 0x0a, 0x14, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x42, 0x28, 0xba, 0xb9, 0x19, 0x24, 0x0a, 0x22, 0x52, + 0x20, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x52, 0x12, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x35, 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x01, 0x42, 0x1b, 0xba, 0xb9, 0x19, 0x17, 0x0a, 0x15, 0x52, 0x13, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x62, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, + 0x12, 0x35, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, + 0xba, 0xb9, 0x19, 0x1d, 0x0a, 0x1b, 0x52, 0x19, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, + 0x69, 0x64, 0x78, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, + 0x65, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x52, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0b, 0x20, 0x01, + 0x28, 0x03, 0x42, 0x25, 0xba, 0xb9, 0x19, 0x21, 0x0a, 0x1f, 0x52, 0x1d, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x37, 0x0a, 0x08, 0x69, + 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x08, 0x42, 0x1c, 0xba, + 0xb9, 0x19, 0x18, 0x0a, 0x16, 0x52, 0x14, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, + 0x64, 0x78, 0x5f, 0x69, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x52, 0x07, 0x69, 0x73, 0x54, + 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x31, 0x0a, 0x06, 0x69, 0x73, 0x5f, 0x6e, 0x66, 0x74, 0x18, 0x13, + 0x20, 0x01, 0x28, 0x08, 0x42, 0x1a, 0xba, 0xb9, 0x19, 0x16, 0x0a, 0x14, 0x52, 0x12, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x69, 0x73, 0x5f, 0x6e, 0x66, 0x74, + 0x52, 0x05, 0x69, 0x73, 0x4e, 0x66, 0x74, 0x12, 0x34, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, + 0x61, 0x63, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, + 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x22, 0x0a, + 0x0d, 0x61, 0x75, 0x64, 0x69, 0x74, 0x5f, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x14, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x75, 0x64, 0x69, 0x74, 0x54, 0x78, 0x48, 0x61, 0x73, + 0x68, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x6f, 0x64, 0x65, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x15, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x6f, 0x64, 0x65, 0x48, 0x61, 0x73, 0x68, 0x12, 0x24, + 0x0a, 0x0e, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x5f, 0x74, 0x78, 0x5f, 0x68, 0x61, 0x73, 0x68, + 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x6c, 0x6f, 0x79, 0x54, 0x78, + 0x48, 0x61, 0x73, 0x68, 0x12, 0x46, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x42, 0x21, 0xba, 0xb9, 0x19, + 0x1d, 0x0a, 0x1b, 0x52, 0x19, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x52, 0x0c, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x32, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x1a, 0xba, 0xb9, + 0x19, 0x16, 0x0a, 0x14, 0x52, 0x12, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, + 0x78, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x17, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x07, 0x69, 0x73, 0x5f, 0x70, 0x72, 0x65, + 0x70, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x42, 0x26, 0xba, 0xb9, 0x19, 0x22, 0x0a, 0x20, 0x52, + 0x1e, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x69, 0x73, 0x5f, + 0x67, 0x6f, 0x76, 0x65, 0x72, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x70, 0x72, 0x65, 0x70, 0x52, + 0x06, 0x69, 0x73, 0x50, 0x72, 0x65, 0x70, 0x12, 0x49, 0x0a, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x22, 0xba, 0xb9, 0x19, 0x1e, 0x0a, 0x1c, 0x52, 0x1a, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, + 0x61, 0x72, 0x64, 0x52, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, + 0x72, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x18, 0x11, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x3a, 0x06, 0xba, 0xb9, 0x19, 0x02, + 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_address_proto_rawDescOnce sync.Once + file_address_proto_rawDescData = file_address_proto_rawDesc +) + +func file_address_proto_rawDescGZIP() []byte { + file_address_proto_rawDescOnce.Do(func() { + file_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_address_proto_rawDescData) + }) + return file_address_proto_rawDescData +} + +var file_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_address_proto_goTypes = []interface{}{ + (*Address)(nil), // 0: models.Address +} +var file_address_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_address_proto_init() } +func file_address_proto_init() { + if File_address_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Address); 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_address_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_address_proto_goTypes, + DependencyIndexes: file_address_proto_depIdxs, + MessageInfos: file_address_proto_msgTypes, + }.Build() + File_address_proto = out.File + file_address_proto_rawDesc = nil + file_address_proto_goTypes = nil + file_address_proto_depIdxs = nil } diff --git a/src/models/address.pb.gorm.go b/src/models/address.pb.gorm.go index 99a92d6..5e823d6 100644 --- a/src/models/address.pb.gorm.go +++ b/src/models/address.pb.gorm.go @@ -3,14 +3,13 @@ package models import ( context "context" fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type AddressORM struct { - Address string `gorm:"primary_key"` + Address string `gorm:"primaryKey"` AuditTxHash string Balance float64 `gorm:"index:address_idx_balance"` CodeHash string @@ -152,7 +151,7 @@ func DefaultCreateAddress(ctx context.Context, in *Address, db *gorm.DB) (*Addre return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(AddressORMWithAfterCreate_); ok { @@ -187,9 +186,6 @@ func DefaultReadAddress(ctx context.Context, in *Address, db *gorm.DB) (*Address return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &AddressORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(AddressORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -310,7 +306,7 @@ func DefaultStrictUpdateAddress(ctx context.Context, in *Address, db *gorm.DB) ( return nil, err } } - if err = db.Save(&ormObj).Error; err != nil { + if err = db.Omit().Save(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(AddressORMWithAfterStrictUpdateSave); ok { @@ -520,10 +516,6 @@ func DefaultListAddress(ctx context.Context, db *gorm.DB) ([]*Address, error) { return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &AddressORM{}, &Address{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(AddressORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err diff --git a/src/models/block.pb.go b/src/models/block.pb.go index 9ec5794..1e353f6 100644 --- a/src/models/block.pb.go +++ b/src/models/block.pb.go @@ -1,211 +1,299 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: block.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 Block struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + // Base - Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` - PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id"` - Signature string `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature"` - Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version"` - MerkleRootHash string `protobuf:"bytes,6,opt,name=merkle_root_hash,json=merkleRootHash,proto3" json:"merkle_root_hash"` - Hash string `protobuf:"bytes,7,opt,name=hash,proto3" json:"hash"` - ParentHash string `protobuf:"bytes,8,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash"` - Timestamp int64 `protobuf:"varint,9,opt,name=timestamp,proto3" json:"timestamp"` - TransactionCount int64 `protobuf:"varint,10,opt,name=transaction_count,json=transactionCount,proto3" json:"transaction_count"` - LogCount int64 `protobuf:"varint,11,opt,name=log_count,json=logCount,proto3" json:"log_count"` - TransactionAmount string `protobuf:"bytes,12,opt,name=transaction_amount,json=transactionAmount,proto3" json:"transaction_amount"` - TransactionFees string `protobuf:"bytes,13,opt,name=transaction_fees,json=transactionFees,proto3" json:"transaction_fees"` - FailedTransactionCount int64 `protobuf:"varint,14,opt,name=failed_transaction_count,json=failedTransactionCount,proto3" json:"failed_transaction_count"` - InternalTransactionCount int64 `protobuf:"varint,15,opt,name=internal_transaction_count,json=internalTransactionCount,proto3" json:"internal_transaction_count"` - InternalTransactionAmount string `protobuf:"bytes,16,opt,name=internal_transaction_amount,json=internalTransactionAmount,proto3" json:"internal_transaction_amount"` -} - -func (m *Block) Reset() { *m = Block{} } -func (m *Block) String() string { return proto.CompactTextString(m) } -func (*Block) ProtoMessage() {} -func (*Block) Descriptor() ([]byte, []int) { - return fileDescriptor_8e550b1f5926e92d, []int{0} + Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` + PeerId string `protobuf:"bytes,3,opt,name=peer_id,json=peerId,proto3" json:"peer_id"` + Signature string `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature"` + Version string `protobuf:"bytes,5,opt,name=version,proto3" json:"version"` + MerkleRootHash string `protobuf:"bytes,6,opt,name=merkle_root_hash,json=merkleRootHash,proto3" json:"merkle_root_hash"` + Hash string `protobuf:"bytes,7,opt,name=hash,proto3" json:"hash"` + ParentHash string `protobuf:"bytes,8,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash"` + Timestamp int64 `protobuf:"varint,9,opt,name=timestamp,proto3" json:"timestamp"` + TransactionCount int64 `protobuf:"varint,10,opt,name=transaction_count,json=transactionCount,proto3" json:"transaction_count"` + LogCount int64 `protobuf:"varint,11,opt,name=log_count,json=logCount,proto3" json:"log_count"` + TransactionAmount string `protobuf:"bytes,12,opt,name=transaction_amount,json=transactionAmount,proto3" json:"transaction_amount"` + TransactionFees string `protobuf:"bytes,13,opt,name=transaction_fees,json=transactionFees,proto3" json:"transaction_fees"` + FailedTransactionCount int64 `protobuf:"varint,14,opt,name=failed_transaction_count,json=failedTransactionCount,proto3" json:"failed_transaction_count"` + InternalTransactionCount int64 `protobuf:"varint,15,opt,name=internal_transaction_count,json=internalTransactionCount,proto3" json:"internal_transaction_count"` + InternalTransactionAmount string `protobuf:"bytes,16,opt,name=internal_transaction_amount,json=internalTransactionAmount,proto3" json:"internal_transaction_amount"` } -func (m *Block) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Block.Unmarshal(m, b) -} -func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Block.Marshal(b, m, deterministic) -} -func (m *Block) XXX_Merge(src proto.Message) { - xxx_messageInfo_Block.Merge(m, src) +func (x *Block) Reset() { + *x = Block{} + if protoimpl.UnsafeEnabled { + mi := &file_block_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Block) XXX_Size() int { - return xxx_messageInfo_Block.Size(m) + +func (x *Block) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Block) XXX_DiscardUnknown() { - xxx_messageInfo_Block.DiscardUnknown(m) + +func (*Block) ProtoMessage() {} + +func (x *Block) ProtoReflect() protoreflect.Message { + mi := &file_block_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) } -var xxx_messageInfo_Block proto.InternalMessageInfo +// Deprecated: Use Block.ProtoReflect.Descriptor instead. +func (*Block) Descriptor() ([]byte, []int) { + return file_block_proto_rawDescGZIP(), []int{0} +} -func (m *Block) GetNumber() int64 { - if m != nil { - return m.Number +func (x *Block) GetNumber() int64 { + if x != nil { + return x.Number } return 0 } -func (m *Block) GetPeerId() string { - if m != nil { - return m.PeerId +func (x *Block) GetPeerId() string { + if x != nil { + return x.PeerId } return "" } -func (m *Block) GetSignature() string { - if m != nil { - return m.Signature +func (x *Block) GetSignature() string { + if x != nil { + return x.Signature } return "" } -func (m *Block) GetVersion() string { - if m != nil { - return m.Version +func (x *Block) GetVersion() string { + if x != nil { + return x.Version } return "" } -func (m *Block) GetMerkleRootHash() string { - if m != nil { - return m.MerkleRootHash +func (x *Block) GetMerkleRootHash() string { + if x != nil { + return x.MerkleRootHash } return "" } -func (m *Block) GetHash() string { - if m != nil { - return m.Hash +func (x *Block) GetHash() string { + if x != nil { + return x.Hash } return "" } -func (m *Block) GetParentHash() string { - if m != nil { - return m.ParentHash +func (x *Block) GetParentHash() string { + if x != nil { + return x.ParentHash } return "" } -func (m *Block) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Block) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *Block) GetTransactionCount() int64 { - if m != nil { - return m.TransactionCount +func (x *Block) GetTransactionCount() int64 { + if x != nil { + return x.TransactionCount } return 0 } -func (m *Block) GetLogCount() int64 { - if m != nil { - return m.LogCount +func (x *Block) GetLogCount() int64 { + if x != nil { + return x.LogCount } return 0 } -func (m *Block) GetTransactionAmount() string { - if m != nil { - return m.TransactionAmount +func (x *Block) GetTransactionAmount() string { + if x != nil { + return x.TransactionAmount } return "" } -func (m *Block) GetTransactionFees() string { - if m != nil { - return m.TransactionFees +func (x *Block) GetTransactionFees() string { + if x != nil { + return x.TransactionFees } return "" } -func (m *Block) GetFailedTransactionCount() int64 { - if m != nil { - return m.FailedTransactionCount +func (x *Block) GetFailedTransactionCount() int64 { + if x != nil { + return x.FailedTransactionCount } return 0 } -func (m *Block) GetInternalTransactionCount() int64 { - if m != nil { - return m.InternalTransactionCount +func (x *Block) GetInternalTransactionCount() int64 { + if x != nil { + return x.InternalTransactionCount } return 0 } -func (m *Block) GetInternalTransactionAmount() string { - if m != nil { - return m.InternalTransactionAmount +func (x *Block) GetInternalTransactionAmount() string { + if x != nil { + return x.InternalTransactionAmount } return "" } -func init() { - proto.RegisterType((*Block)(nil), "models.Block") -} - -func init() { - proto.RegisterFile("block.proto", fileDescriptor_8e550b1f5926e92d) -} - -var fileDescriptor_8e550b1f5926e92d = []byte{ - // 438 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0x51, 0x6f, 0xd3, 0x3e, - 0x14, 0xc5, 0xd5, 0xad, 0x4d, 0x93, 0xdb, 0xff, 0x7f, 0xeb, 0x3c, 0x0d, 0x9c, 0x15, 0x89, 0x8a, - 0xa7, 0x22, 0xd4, 0x46, 0x82, 0x17, 0x40, 0x08, 0x41, 0x91, 0x10, 0xbc, 0x46, 0x3c, 0xf1, 0x12, - 0x39, 0x89, 0x9b, 0x5a, 0x4b, 0x7c, 0x23, 0xdb, 0x45, 0xfb, 0x1e, 0x7c, 0x9a, 0xf6, 0xd3, 0xa1, - 0xdc, 0x64, 0x34, 0x62, 0x7d, 0xb3, 0xcf, 0xf9, 0x9d, 0x9b, 0x73, 0x23, 0xc3, 0x24, 0x2d, 0x31, - 0xbb, 0x5b, 0xd5, 0x06, 0x1d, 0x32, 0xaf, 0xc2, 0x5c, 0x96, 0xf6, 0xf6, 0x53, 0xa1, 0xdc, 0x76, - 0x97, 0xae, 0x32, 0xac, 0x22, 0xa5, 0x37, 0x98, 0x96, 0x78, 0x8f, 0xb5, 0xd4, 0x11, 0x61, 0xd9, - 0xb2, 0x90, 0x7a, 0x59, 0xa0, 0xa9, 0xda, 0x7b, 0x84, 0xb5, 0x53, 0xa8, 0x6d, 0xd4, 0x48, 0xed, - 0xa4, 0x17, 0xbf, 0x47, 0x30, 0x5a, 0x37, 0x93, 0xd9, 0x1c, 0x3c, 0xbd, 0xab, 0x52, 0x69, 0xf8, - 0x60, 0x3e, 0x58, 0x9c, 0xaf, 0xfd, 0xc3, 0x3e, 0x1c, 0xc2, 0xd9, 0x62, 0x10, 0x77, 0x3a, 0x7b, - 0x0d, 0xe3, 0x5a, 0x4a, 0x93, 0xa8, 0x9c, 0x9f, 0xcf, 0x07, 0x8b, 0x60, 0x1d, 0x1e, 0xf6, 0xe1, - 0x0d, 0x5c, 0xc7, 0x57, 0xd4, 0x2d, 0x51, 0xf9, 0x7d, 0xd2, 0x01, 0xb1, 0xd7, 0x1c, 0xbe, 0xe7, - 0xec, 0x19, 0x04, 0x56, 0x15, 0x5a, 0xb8, 0x9d, 0x91, 0x7c, 0xd8, 0xa4, 0xe2, 0xa3, 0xc0, 0x38, - 0x8c, 0x7f, 0x49, 0x63, 0x15, 0x6a, 0x3e, 0x22, 0xef, 0xe1, 0xca, 0x16, 0x30, 0xad, 0xa4, 0xb9, - 0x2b, 0x65, 0x62, 0x10, 0x5d, 0xb2, 0x15, 0x76, 0xcb, 0x3d, 0x42, 0x2e, 0x5a, 0x3d, 0x46, 0x74, - 0xdf, 0x84, 0xdd, 0x32, 0x06, 0x43, 0x72, 0xc7, 0xe4, 0xd2, 0x99, 0x3d, 0x87, 0x49, 0x2d, 0x8c, - 0xd4, 0x5d, 0xd0, 0x27, 0x0b, 0x5a, 0x89, 0x42, 0xef, 0x20, 0x70, 0xaa, 0x92, 0xd6, 0x89, 0xaa, - 0xe6, 0x01, 0xed, 0x3b, 0x3b, 0xec, 0xc3, 0xa7, 0x70, 0x13, 0x5f, 0x1f, 0x97, 0xf9, 0x8b, 0xc4, - 0x47, 0x9a, 0xbd, 0x82, 0x2b, 0x67, 0x84, 0xb6, 0x22, 0x6b, 0x7e, 0x66, 0x92, 0xe1, 0x4e, 0x3b, - 0x0e, 0xcd, 0x88, 0x78, 0xda, 0x33, 0xbe, 0x34, 0x3a, 0x9b, 0x41, 0x50, 0x62, 0xd1, 0x41, 0x13, - 0x82, 0xfc, 0x12, 0x8b, 0xd6, 0x5c, 0x02, 0xeb, 0x4f, 0x12, 0x15, 0x51, 0xff, 0x51, 0xd9, 0xfe, - 0x37, 0x3e, 0x93, 0xc1, 0x5e, 0x42, 0x7f, 0x7e, 0xb2, 0x91, 0xd2, 0xf2, 0xff, 0x09, 0xbe, 0xec, - 0xe9, 0x5f, 0xa5, 0xb4, 0xec, 0x2d, 0xf0, 0x8d, 0x50, 0xa5, 0xcc, 0x93, 0xc7, 0x55, 0x2f, 0xa8, - 0xc5, 0x93, 0xd6, 0xff, 0xf1, 0x6f, 0xe1, 0x0f, 0x70, 0xab, 0xb4, 0x93, 0x46, 0x8b, 0xf2, 0x44, - 0xf6, 0x92, 0xb2, 0xfc, 0x81, 0x78, 0x94, 0xfe, 0x08, 0xb3, 0x93, 0xe9, 0x6e, 0xb5, 0x29, 0xb5, - 0x0d, 0x4f, 0xc4, 0xdb, 0x15, 0xdf, 0x7b, 0x87, 0x7d, 0x78, 0xe6, 0x0f, 0xd6, 0xf0, 0xd3, 0x5f, - 0x45, 0xed, 0x1b, 0x4f, 0x3d, 0x7a, 0xa8, 0x6f, 0xfe, 0x04, 0x00, 0x00, 0xff, 0xff, 0x44, 0x41, - 0x77, 0xff, 0x01, 0x03, 0x00, 0x00, +var File_block_proto protoreflect.FileDescriptor + +var file_block_proto_rawDesc = []byte{ + 0x0a, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, + 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x93, 0x05, 0x0a, 0x05, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x12, 0x20, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x06, 0x6e, 0x75, 0x6d, + 0x62, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x19, 0xba, 0xb9, 0x19, 0x15, 0x0a, 0x13, 0x52, 0x11, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x52, + 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, + 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, + 0x28, 0x0a, 0x10, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6d, 0x65, 0x72, 0x6b, 0x6c, + 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x12, 0x0a, 0x04, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x1f, 0x0a, + 0x0b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, 0x39, + 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x09, 0x20, 0x01, 0x28, + 0x03, 0x42, 0x1b, 0xba, 0xb9, 0x19, 0x17, 0x0a, 0x15, 0x52, 0x13, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x43, 0x6f, + 0x75, 0x6e, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x73, 0x12, 0x38, 0x0a, + 0x18, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x16, 0x66, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3c, 0x0a, 0x1a, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x6e, 0x61, 0x6c, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x03, 0x52, 0x18, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x1b, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, + 0x6c, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x19, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x6e, 0x61, 0x6c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x3a, 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, + 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_block_proto_rawDescOnce sync.Once + file_block_proto_rawDescData = file_block_proto_rawDesc +) + +func file_block_proto_rawDescGZIP() []byte { + file_block_proto_rawDescOnce.Do(func() { + file_block_proto_rawDescData = protoimpl.X.CompressGZIP(file_block_proto_rawDescData) + }) + return file_block_proto_rawDescData +} + +var file_block_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_block_proto_goTypes = []interface{}{ + (*Block)(nil), // 0: models.Block +} +var file_block_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_block_proto_init() } +func file_block_proto_init() { + if File_block_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_block_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Block); 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_block_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_block_proto_goTypes, + DependencyIndexes: file_block_proto_depIdxs, + MessageInfos: file_block_proto_msgTypes, + }.Build() + File_block_proto = out.File + file_block_proto_rawDesc = nil + file_block_proto_goTypes = nil + file_block_proto_depIdxs = nil } diff --git a/src/models/block.pb.gorm.go b/src/models/block.pb.gorm.go index 14e0c32..acae7f2 100644 --- a/src/models/block.pb.gorm.go +++ b/src/models/block.pb.gorm.go @@ -3,10 +3,9 @@ package models import ( context "context" fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type BlockORM struct { @@ -16,7 +15,7 @@ type BlockORM struct { InternalTransactionCount int64 LogCount int64 MerkleRootHash string - Number int64 `gorm:"primary_key"` + Number int64 `gorm:"primaryKey"` ParentHash string PeerId string `gorm:"index:block_idx_peer_id"` Signature string @@ -131,7 +130,7 @@ func DefaultCreateBlock(ctx context.Context, in *Block, db *gorm.DB) (*Block, er return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(BlockORMWithAfterCreate_); ok { @@ -166,9 +165,6 @@ func DefaultReadBlock(ctx context.Context, in *Block, db *gorm.DB) (*Block, erro return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &BlockORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(BlockORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -289,7 +285,7 @@ func DefaultStrictUpdateBlock(ctx context.Context, in *Block, db *gorm.DB) (*Blo return nil, err } } - if err = db.Save(&ormObj).Error; err != nil { + if err = db.Omit().Save(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(BlockORMWithAfterStrictUpdateSave); ok { @@ -471,10 +467,6 @@ func DefaultListBlock(ctx context.Context, db *gorm.DB) ([]*Block, error) { return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &BlockORM{}, &Block{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(BlockORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err diff --git a/src/models/block_count.pb.go b/src/models/block_count.pb.go index 07156b3..dcb19d1 100644 --- a/src/models/block_count.pb.go +++ b/src/models/block_count.pb.go @@ -1,90 +1,157 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: block_count.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 BlockCount struct { - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type"` - Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *BlockCount) Reset() { *m = BlockCount{} } -func (m *BlockCount) String() string { return proto.CompactTextString(m) } -func (*BlockCount) ProtoMessage() {} -func (*BlockCount) Descriptor() ([]byte, []int) { - return fileDescriptor_a4403ad2f74f36cf, []int{0} + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type"` + Count int64 `protobuf:"varint,2,opt,name=count,proto3" json:"count"` } -func (m *BlockCount) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BlockCount.Unmarshal(m, b) -} -func (m *BlockCount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BlockCount.Marshal(b, m, deterministic) -} -func (m *BlockCount) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockCount.Merge(m, src) +func (x *BlockCount) Reset() { + *x = BlockCount{} + if protoimpl.UnsafeEnabled { + mi := &file_block_count_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *BlockCount) XXX_Size() int { - return xxx_messageInfo_BlockCount.Size(m) + +func (x *BlockCount) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *BlockCount) XXX_DiscardUnknown() { - xxx_messageInfo_BlockCount.DiscardUnknown(m) + +func (*BlockCount) ProtoMessage() {} + +func (x *BlockCount) ProtoReflect() protoreflect.Message { + mi := &file_block_count_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) } -var xxx_messageInfo_BlockCount proto.InternalMessageInfo +// Deprecated: Use BlockCount.ProtoReflect.Descriptor instead. +func (*BlockCount) Descriptor() ([]byte, []int) { + return file_block_count_proto_rawDescGZIP(), []int{0} +} -func (m *BlockCount) GetType() string { - if m != nil { - return m.Type +func (x *BlockCount) GetType() string { + if x != nil { + return x.Type } return "" } -func (m *BlockCount) GetCount() int64 { - if m != nil { - return m.Count +func (x *BlockCount) GetCount() int64 { + if x != nil { + return x.Count } return 0 } -func init() { - proto.RegisterType((*BlockCount)(nil), "models.BlockCount") +var File_block_count_proto protoreflect.FileDescriptor + +var file_block_count_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, + 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, + 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x48, 0x0a, + 0x0a, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, + 0x02, 0x28, 0x01, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x3a, + 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_block_count_proto_rawDescOnce sync.Once + file_block_count_proto_rawDescData = file_block_count_proto_rawDesc +) + +func file_block_count_proto_rawDescGZIP() []byte { + file_block_count_proto_rawDescOnce.Do(func() { + file_block_count_proto_rawDescData = protoimpl.X.CompressGZIP(file_block_count_proto_rawDescData) + }) + return file_block_count_proto_rawDescData } -func init() { - proto.RegisterFile("block_count.proto", fileDescriptor_a4403ad2f74f36cf) +var file_block_count_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_block_count_proto_goTypes = []interface{}{ + (*BlockCount)(nil), // 0: models.BlockCount +} +var file_block_count_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 } -var fileDescriptor_a4403ad2f74f36cf = []byte{ - // 178 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0xca, 0xc9, 0x4f, - 0xce, 0x8e, 0x4f, 0xce, 0x2f, 0xcd, 0x2b, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcb, - 0xcd, 0x4f, 0x49, 0xcd, 0x29, 0x96, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, - 0xcf, 0xd5, 0xcf, 0xcc, 0x4b, 0xcb, 0x4f, 0xca, 0xc9, 0xaf, 0xc8, 0x2f, 0x48, 0xcd, 0xd3, 0x07, - 0x2b, 0x4b, 0xd6, 0x4d, 0x4f, 0xcd, 0xd3, 0x4d, 0xcf, 0x2f, 0xca, 0x85, 0xf0, 0xf5, 0xf3, 0x0b, - 0x4a, 0x32, 0xf3, 0xf3, 0x8a, 0xf5, 0x41, 0x42, 0x10, 0x93, 0x94, 0x3c, 0xb8, 0xb8, 0x9c, 0x40, - 0xc6, 0x3b, 0x83, 0x4c, 0x17, 0x92, 0xe1, 0x62, 0x29, 0xa9, 0x2c, 0x48, 0x95, 0x60, 0x54, 0x60, - 0xd4, 0xe0, 0x74, 0xe2, 0xd8, 0xb5, 0x53, 0x92, 0x85, 0x8b, 0x49, 0x83, 0x31, 0x08, 0x2c, 0x2a, - 0x24, 0xc2, 0xc5, 0x0a, 0x76, 0x84, 0x04, 0x93, 0x02, 0xa3, 0x06, 0x73, 0x10, 0x84, 0x63, 0xc5, - 0xb6, 0x6b, 0xa7, 0x24, 0x13, 0x07, 0xa3, 0x13, 0x57, 0x14, 0x87, 0x9e, 0x3e, 0xc4, 0x5d, 0x49, - 0x6c, 0x60, 0xc3, 0x8d, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x83, 0x60, 0xcd, 0x43, 0xbb, 0x00, - 0x00, 0x00, +func init() { file_block_count_proto_init() } +func file_block_count_proto_init() { + if File_block_count_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_block_count_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BlockCount); 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_block_count_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_block_count_proto_goTypes, + DependencyIndexes: file_block_count_proto_depIdxs, + MessageInfos: file_block_count_proto_msgTypes, + }.Build() + File_block_count_proto = out.File + file_block_count_proto_rawDesc = nil + file_block_count_proto_goTypes = nil + file_block_count_proto_depIdxs = nil } diff --git a/src/models/block_count.pb.gorm.go b/src/models/block_count.pb.gorm.go index e95bd51..a110753 100644 --- a/src/models/block_count.pb.gorm.go +++ b/src/models/block_count.pb.gorm.go @@ -3,15 +3,14 @@ package models import ( context "context" fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type BlockCountORM struct { Count int64 - Type string `gorm:"primary_key"` + Type string `gorm:"primaryKey"` } // TableName overrides the default tablename generated by GORM @@ -92,7 +91,7 @@ func DefaultCreateBlockCount(ctx context.Context, in *BlockCount, db *gorm.DB) ( return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(BlockCountORMWithAfterCreate_); ok { @@ -127,9 +126,6 @@ func DefaultReadBlockCount(ctx context.Context, in *BlockCount, db *gorm.DB) (*B return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &BlockCountORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(BlockCountORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -250,7 +246,7 @@ func DefaultStrictUpdateBlockCount(ctx context.Context, in *BlockCount, db *gorm return nil, err } } - if err = db.Save(&ormObj).Error; err != nil { + if err = db.Omit().Save(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(BlockCountORMWithAfterStrictUpdateSave); ok { @@ -380,10 +376,6 @@ func DefaultListBlockCount(ctx context.Context, db *gorm.DB) ([]*BlockCount, err return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &BlockCountORM{}, &BlockCount{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(BlockCountORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err diff --git a/src/models/block_etl.pb.go b/src/models/block_etl.pb.go index 62f899d..b7d2958 100644 --- a/src/models/block_etl.pb.go +++ b/src/models/block_etl.pb.go @@ -1,418 +1,571 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: block_etl.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/mwitkow/go-proto-validators" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 BlockETL struct { - Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` - Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash"` - ParentHash string `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash"` - MerkleRootHash string `protobuf:"bytes,4,opt,name=merkle_root_hash,json=merkleRootHash,proto3" json:"merkle_root_hash"` - PeerId string `protobuf:"bytes,5,opt,name=peer_id,json=peerId,proto3" json:"peer_id"` - Signature string `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature"` - Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp"` - Version string `protobuf:"bytes,8,opt,name=version,proto3" json:"version"` - Transactions []*TransactionETL `protobuf:"bytes,9,rep,name=transactions,proto3" json:"transactions"` -} - -func (m *BlockETL) Reset() { *m = BlockETL{} } -func (m *BlockETL) String() string { return proto.CompactTextString(m) } -func (*BlockETL) ProtoMessage() {} -func (*BlockETL) Descriptor() ([]byte, []int) { - return fileDescriptor_7eeb5101d09c56fb, []int{0} -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *BlockETL) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BlockETL.Unmarshal(m, b) -} -func (m *BlockETL) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BlockETL.Marshal(b, m, deterministic) + Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` + Hash string `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash"` + ParentHash string `protobuf:"bytes,3,opt,name=parent_hash,json=parentHash,proto3" json:"parent_hash"` + MerkleRootHash string `protobuf:"bytes,4,opt,name=merkle_root_hash,json=merkleRootHash,proto3" json:"merkle_root_hash"` + PeerId string `protobuf:"bytes,5,opt,name=peer_id,json=peerId,proto3" json:"peer_id"` + Signature string `protobuf:"bytes,6,opt,name=signature,proto3" json:"signature"` + Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp"` + Version string `protobuf:"bytes,8,opt,name=version,proto3" json:"version"` + Transactions []*TransactionETL `protobuf:"bytes,9,rep,name=transactions,proto3" json:"transactions"` } -func (m *BlockETL) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockETL.Merge(m, src) + +func (x *BlockETL) Reset() { + *x = BlockETL{} + if protoimpl.UnsafeEnabled { + mi := &file_block_etl_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *BlockETL) XXX_Size() int { - return xxx_messageInfo_BlockETL.Size(m) + +func (x *BlockETL) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *BlockETL) XXX_DiscardUnknown() { - xxx_messageInfo_BlockETL.DiscardUnknown(m) + +func (*BlockETL) ProtoMessage() {} + +func (x *BlockETL) ProtoReflect() protoreflect.Message { + mi := &file_block_etl_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) } -var xxx_messageInfo_BlockETL proto.InternalMessageInfo +// Deprecated: Use BlockETL.ProtoReflect.Descriptor instead. +func (*BlockETL) Descriptor() ([]byte, []int) { + return file_block_etl_proto_rawDescGZIP(), []int{0} +} -func (m *BlockETL) GetNumber() int64 { - if m != nil { - return m.Number +func (x *BlockETL) GetNumber() int64 { + if x != nil { + return x.Number } return 0 } -func (m *BlockETL) GetHash() string { - if m != nil { - return m.Hash +func (x *BlockETL) GetHash() string { + if x != nil { + return x.Hash } return "" } -func (m *BlockETL) GetParentHash() string { - if m != nil { - return m.ParentHash +func (x *BlockETL) GetParentHash() string { + if x != nil { + return x.ParentHash } return "" } -func (m *BlockETL) GetMerkleRootHash() string { - if m != nil { - return m.MerkleRootHash +func (x *BlockETL) GetMerkleRootHash() string { + if x != nil { + return x.MerkleRootHash } return "" } -func (m *BlockETL) GetPeerId() string { - if m != nil { - return m.PeerId +func (x *BlockETL) GetPeerId() string { + if x != nil { + return x.PeerId } return "" } -func (m *BlockETL) GetSignature() string { - if m != nil { - return m.Signature +func (x *BlockETL) GetSignature() string { + if x != nil { + return x.Signature } return "" } -func (m *BlockETL) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *BlockETL) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *BlockETL) GetVersion() string { - if m != nil { - return m.Version +func (x *BlockETL) GetVersion() string { + if x != nil { + return x.Version } return "" } -func (m *BlockETL) GetTransactions() []*TransactionETL { - if m != nil { - return m.Transactions +func (x *BlockETL) GetTransactions() []*TransactionETL { + if x != nil { + return x.Transactions } return nil } type TransactionETL struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"` - Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp"` - TransactionIndex int64 `protobuf:"varint,3,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` - Nonce string `protobuf:"bytes,4,opt,name=nonce,proto3" json:"nonce"` - Nid string `protobuf:"bytes,5,opt,name=nid,proto3" json:"nid"` - FromAddress string `protobuf:"bytes,6,opt,name=from_address,json=fromAddress,proto3" json:"from_address"` - ToAddress string `protobuf:"bytes,7,opt,name=to_address,json=toAddress,proto3" json:"to_address"` - Value string `protobuf:"bytes,8,opt,name=value,proto3" json:"value"` - Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status"` - StepPrice string `protobuf:"bytes,10,opt,name=step_price,json=stepPrice,proto3" json:"step_price"` - StepUsed string `protobuf:"bytes,11,opt,name=step_used,json=stepUsed,proto3" json:"step_used"` - StepLimit string `protobuf:"bytes,12,opt,name=step_limit,json=stepLimit,proto3" json:"step_limit"` - CumulativeStepUsed string `protobuf:"bytes,13,opt,name=cumulative_step_used,json=cumulativeStepUsed,proto3" json:"cumulative_step_used"` - LogsBloom string `protobuf:"bytes,14,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom"` - Data string `protobuf:"bytes,15,opt,name=data,proto3" json:"data"` - DataType string `protobuf:"bytes,16,opt,name=data_type,json=dataType,proto3" json:"data_type"` - ScoreAddress string `protobuf:"bytes,17,opt,name=score_address,json=scoreAddress,proto3" json:"score_address"` - Signature string `protobuf:"bytes,18,opt,name=signature,proto3" json:"signature"` - Version string `protobuf:"bytes,19,opt,name=version,proto3" json:"version"` - Logs []*LogETL `protobuf:"bytes,20,rep,name=logs,proto3" json:"logs"` -} - -func (m *TransactionETL) Reset() { *m = TransactionETL{} } -func (m *TransactionETL) String() string { return proto.CompactTextString(m) } -func (*TransactionETL) ProtoMessage() {} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"` + Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp"` + TransactionIndex int64 `protobuf:"varint,3,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` + Nonce string `protobuf:"bytes,4,opt,name=nonce,proto3" json:"nonce"` + Nid string `protobuf:"bytes,5,opt,name=nid,proto3" json:"nid"` + FromAddress string `protobuf:"bytes,6,opt,name=from_address,json=fromAddress,proto3" json:"from_address"` + ToAddress string `protobuf:"bytes,7,opt,name=to_address,json=toAddress,proto3" json:"to_address"` + Value string `protobuf:"bytes,8,opt,name=value,proto3" json:"value"` + Status string `protobuf:"bytes,9,opt,name=status,proto3" json:"status"` + StepPrice string `protobuf:"bytes,10,opt,name=step_price,json=stepPrice,proto3" json:"step_price"` + StepUsed string `protobuf:"bytes,11,opt,name=step_used,json=stepUsed,proto3" json:"step_used"` + StepLimit string `protobuf:"bytes,12,opt,name=step_limit,json=stepLimit,proto3" json:"step_limit"` + CumulativeStepUsed string `protobuf:"bytes,13,opt,name=cumulative_step_used,json=cumulativeStepUsed,proto3" json:"cumulative_step_used"` + LogsBloom string `protobuf:"bytes,14,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom"` + Data string `protobuf:"bytes,15,opt,name=data,proto3" json:"data"` + DataType string `protobuf:"bytes,16,opt,name=data_type,json=dataType,proto3" json:"data_type"` + ScoreAddress string `protobuf:"bytes,17,opt,name=score_address,json=scoreAddress,proto3" json:"score_address"` + Signature string `protobuf:"bytes,18,opt,name=signature,proto3" json:"signature"` + Version string `protobuf:"bytes,19,opt,name=version,proto3" json:"version"` + Logs []*LogETL `protobuf:"bytes,20,rep,name=logs,proto3" json:"logs"` +} + +func (x *TransactionETL) Reset() { + *x = TransactionETL{} + if protoimpl.UnsafeEnabled { + mi := &file_block_etl_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TransactionETL) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TransactionETL) ProtoMessage() {} + +func (x *TransactionETL) ProtoReflect() protoreflect.Message { + mi := &file_block_etl_proto_msgTypes[1] + 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 TransactionETL.ProtoReflect.Descriptor instead. func (*TransactionETL) Descriptor() ([]byte, []int) { - return fileDescriptor_7eeb5101d09c56fb, []int{1} + return file_block_etl_proto_rawDescGZIP(), []int{1} } -func (m *TransactionETL) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransactionETL.Unmarshal(m, b) -} -func (m *TransactionETL) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransactionETL.Marshal(b, m, deterministic) -} -func (m *TransactionETL) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionETL.Merge(m, src) -} -func (m *TransactionETL) XXX_Size() int { - return xxx_messageInfo_TransactionETL.Size(m) -} -func (m *TransactionETL) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionETL.DiscardUnknown(m) -} - -var xxx_messageInfo_TransactionETL proto.InternalMessageInfo - -func (m *TransactionETL) GetHash() string { - if m != nil { - return m.Hash +func (x *TransactionETL) GetHash() string { + if x != nil { + return x.Hash } return "" } -func (m *TransactionETL) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *TransactionETL) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *TransactionETL) GetTransactionIndex() int64 { - if m != nil { - return m.TransactionIndex +func (x *TransactionETL) GetTransactionIndex() int64 { + if x != nil { + return x.TransactionIndex } return 0 } -func (m *TransactionETL) GetNonce() string { - if m != nil { - return m.Nonce +func (x *TransactionETL) GetNonce() string { + if x != nil { + return x.Nonce } return "" } -func (m *TransactionETL) GetNid() string { - if m != nil { - return m.Nid +func (x *TransactionETL) GetNid() string { + if x != nil { + return x.Nid } return "" } -func (m *TransactionETL) GetFromAddress() string { - if m != nil { - return m.FromAddress +func (x *TransactionETL) GetFromAddress() string { + if x != nil { + return x.FromAddress } return "" } -func (m *TransactionETL) GetToAddress() string { - if m != nil { - return m.ToAddress +func (x *TransactionETL) GetToAddress() string { + if x != nil { + return x.ToAddress } return "" } -func (m *TransactionETL) GetValue() string { - if m != nil { - return m.Value +func (x *TransactionETL) GetValue() string { + if x != nil { + return x.Value } return "" } -func (m *TransactionETL) GetStatus() string { - if m != nil { - return m.Status +func (x *TransactionETL) GetStatus() string { + if x != nil { + return x.Status } return "" } -func (m *TransactionETL) GetStepPrice() string { - if m != nil { - return m.StepPrice +func (x *TransactionETL) GetStepPrice() string { + if x != nil { + return x.StepPrice } return "" } -func (m *TransactionETL) GetStepUsed() string { - if m != nil { - return m.StepUsed +func (x *TransactionETL) GetStepUsed() string { + if x != nil { + return x.StepUsed } return "" } -func (m *TransactionETL) GetStepLimit() string { - if m != nil { - return m.StepLimit +func (x *TransactionETL) GetStepLimit() string { + if x != nil { + return x.StepLimit } return "" } -func (m *TransactionETL) GetCumulativeStepUsed() string { - if m != nil { - return m.CumulativeStepUsed +func (x *TransactionETL) GetCumulativeStepUsed() string { + if x != nil { + return x.CumulativeStepUsed } return "" } -func (m *TransactionETL) GetLogsBloom() string { - if m != nil { - return m.LogsBloom +func (x *TransactionETL) GetLogsBloom() string { + if x != nil { + return x.LogsBloom } return "" } -func (m *TransactionETL) GetData() string { - if m != nil { - return m.Data +func (x *TransactionETL) GetData() string { + if x != nil { + return x.Data } return "" } -func (m *TransactionETL) GetDataType() string { - if m != nil { - return m.DataType +func (x *TransactionETL) GetDataType() string { + if x != nil { + return x.DataType } return "" } -func (m *TransactionETL) GetScoreAddress() string { - if m != nil { - return m.ScoreAddress +func (x *TransactionETL) GetScoreAddress() string { + if x != nil { + return x.ScoreAddress } return "" } -func (m *TransactionETL) GetSignature() string { - if m != nil { - return m.Signature +func (x *TransactionETL) GetSignature() string { + if x != nil { + return x.Signature } return "" } -func (m *TransactionETL) GetVersion() string { - if m != nil { - return m.Version +func (x *TransactionETL) GetVersion() string { + if x != nil { + return x.Version } return "" } -func (m *TransactionETL) GetLogs() []*LogETL { - if m != nil { - return m.Logs +func (x *TransactionETL) GetLogs() []*LogETL { + if x != nil { + return x.Logs } return nil } type LogETL struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address"` - Indexed []string `protobuf:"bytes,2,rep,name=indexed,proto3" json:"indexed"` - Data []string `protobuf:"bytes,3,rep,name=data,proto3" json:"data"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *LogETL) Reset() { *m = LogETL{} } -func (m *LogETL) String() string { return proto.CompactTextString(m) } -func (*LogETL) ProtoMessage() {} -func (*LogETL) Descriptor() ([]byte, []int) { - return fileDescriptor_7eeb5101d09c56fb, []int{2} + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address"` + Indexed []string `protobuf:"bytes,2,rep,name=indexed,proto3" json:"indexed"` + Data []string `protobuf:"bytes,3,rep,name=data,proto3" json:"data"` } -func (m *LogETL) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_LogETL.Unmarshal(m, b) -} -func (m *LogETL) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_LogETL.Marshal(b, m, deterministic) -} -func (m *LogETL) XXX_Merge(src proto.Message) { - xxx_messageInfo_LogETL.Merge(m, src) +func (x *LogETL) Reset() { + *x = LogETL{} + if protoimpl.UnsafeEnabled { + mi := &file_block_etl_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *LogETL) XXX_Size() int { - return xxx_messageInfo_LogETL.Size(m) + +func (x *LogETL) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *LogETL) XXX_DiscardUnknown() { - xxx_messageInfo_LogETL.DiscardUnknown(m) + +func (*LogETL) ProtoMessage() {} + +func (x *LogETL) ProtoReflect() protoreflect.Message { + mi := &file_block_etl_proto_msgTypes[2] + 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) } -var xxx_messageInfo_LogETL proto.InternalMessageInfo +// Deprecated: Use LogETL.ProtoReflect.Descriptor instead. +func (*LogETL) Descriptor() ([]byte, []int) { + return file_block_etl_proto_rawDescGZIP(), []int{2} +} -func (m *LogETL) GetAddress() string { - if m != nil { - return m.Address +func (x *LogETL) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *LogETL) GetIndexed() []string { - if m != nil { - return m.Indexed +func (x *LogETL) GetIndexed() []string { + if x != nil { + return x.Indexed } return nil } -func (m *LogETL) GetData() []string { - if m != nil { - return m.Data +func (x *LogETL) GetData() []string { + if x != nil { + return x.Data } return nil } -func init() { - proto.RegisterType((*BlockETL)(nil), "models.BlockETL") - proto.RegisterType((*TransactionETL)(nil), "models.TransactionETL") - proto.RegisterType((*LogETL)(nil), "models.LogETL") -} - -func init() { - proto.RegisterFile("block_etl.proto", fileDescriptor_7eeb5101d09c56fb) -} - -var fileDescriptor_7eeb5101d09c56fb = []byte{ - // 667 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0x5d, 0x6f, 0xda, 0x30, - 0x14, 0x1d, 0x04, 0x02, 0x5c, 0x28, 0xa5, 0x1e, 0xaa, 0xac, 0x7d, 0xc1, 0x18, 0x9a, 0xd0, 0x26, - 0x3e, 0xb6, 0x75, 0x95, 0xb6, 0x87, 0x49, 0x43, 0xaa, 0xb4, 0x4a, 0x3c, 0x4c, 0x19, 0x7b, 0xd9, - 0xd4, 0x46, 0x26, 0x71, 0x21, 0x6a, 0x12, 0x47, 0xb1, 0x43, 0x5b, 0x4d, 0xfd, 0x19, 0xdb, 0xdf, - 0x43, 0xe2, 0x97, 0x4c, 0x76, 0x12, 0x20, 0xd5, 0xd6, 0x27, 0x7c, 0xcf, 0x3d, 0xe7, 0xfa, 0x72, - 0x7c, 0x00, 0xf6, 0x67, 0x2e, 0xb3, 0x2e, 0x4d, 0x2a, 0xdc, 0x41, 0x10, 0x32, 0xc1, 0x90, 0xee, - 0x31, 0x9b, 0xba, 0xfc, 0xd1, 0xf1, 0xdc, 0x11, 0x8b, 0x68, 0x36, 0xb0, 0x98, 0x37, 0xf4, 0xae, - 0x1c, 0x71, 0xc9, 0xae, 0x86, 0x73, 0xd6, 0x57, 0xa4, 0xfe, 0x92, 0xb8, 0x8e, 0x4d, 0x04, 0x0b, - 0xf9, 0x70, 0x73, 0x8c, 0xf5, 0x9d, 0x3f, 0x1a, 0x94, 0xc7, 0x72, 0xe6, 0xc9, 0x74, 0x82, 0x9e, - 0x81, 0xee, 0x47, 0xde, 0x8c, 0x86, 0x38, 0xd7, 0xce, 0xf5, 0xb4, 0xb1, 0xbe, 0x5e, 0xb5, 0xf2, - 0x8d, 0x07, 0x46, 0x82, 0xa2, 0x1e, 0x14, 0x16, 0x84, 0x2f, 0x70, 0xbe, 0x9d, 0xeb, 0x55, 0xc6, - 0xcd, 0xf5, 0xaa, 0xd5, 0x80, 0xfa, 0xf9, 0x4f, 0xd2, 0xbf, 0x18, 0xf5, 0x3f, 0x9c, 0xfd, 0x3a, - 0x3e, 0xba, 0xed, 0x1a, 0x8a, 0x81, 0xde, 0x43, 0x35, 0x20, 0x21, 0xf5, 0x85, 0xa9, 0x04, 0xda, - 0x3d, 0x02, 0x88, 0x89, 0x5f, 0xa4, 0xec, 0x13, 0x34, 0x3c, 0x1a, 0x5e, 0xba, 0xd4, 0x0c, 0x19, - 0x4b, 0xb4, 0x85, 0x7b, 0xb4, 0xf5, 0x98, 0x6d, 0x30, 0x16, 0xeb, 0x87, 0x50, 0x0a, 0x28, 0x0d, - 0x4d, 0xc7, 0xc6, 0x45, 0x25, 0x3b, 0x5c, 0xaf, 0x5a, 0x08, 0x1a, 0xe7, 0x8b, 0xeb, 0x8d, 0xf0, - 0x68, 0x74, 0xdb, 0x35, 0x74, 0x49, 0x3b, 0xb5, 0xd1, 0x13, 0xa8, 0x70, 0x67, 0xee, 0x13, 0x11, - 0x85, 0x14, 0xeb, 0x52, 0x62, 0x6c, 0x01, 0xd4, 0x85, 0x8a, 0x70, 0x3c, 0xca, 0x05, 0xf1, 0x02, - 0x5c, 0xca, 0x58, 0xb2, 0x6d, 0x20, 0x0c, 0xa5, 0x25, 0x0d, 0xb9, 0xc3, 0x7c, 0x5c, 0x56, 0x13, - 0xd2, 0x12, 0x7d, 0x84, 0x9a, 0x08, 0x89, 0xcf, 0x89, 0x25, 0x1c, 0xe6, 0x73, 0x5c, 0x69, 0x6b, - 0xbd, 0xea, 0xdb, 0xc3, 0x41, 0xfc, 0x66, 0x83, 0xe9, 0xb6, 0x77, 0x32, 0x9d, 0x18, 0x19, 0x6e, - 0xe7, 0x77, 0x11, 0xea, 0x59, 0x02, 0x7a, 0x95, 0xd8, 0x9f, 0xcb, 0x7c, 0xb5, 0xd1, 0xf5, 0xbf, - 0x1e, 0x20, 0xb3, 0x7a, 0xfe, 0x7f, 0xab, 0xbf, 0x86, 0x83, 0x9d, 0x4b, 0x4d, 0xc7, 0xb7, 0xe9, - 0xb5, 0x7a, 0x2c, 0xcd, 0x68, 0xec, 0x34, 0x4e, 0x25, 0x8e, 0x9a, 0x50, 0xf4, 0x99, 0x6f, 0xd1, - 0xf8, 0x45, 0x8c, 0xb8, 0x40, 0x0d, 0xd0, 0xfc, 0xd4, 0x6e, 0x43, 0x1e, 0xd1, 0x73, 0xa8, 0x5d, - 0x84, 0xcc, 0x33, 0x89, 0x6d, 0x87, 0x94, 0xf3, 0xc4, 0xd6, 0xaa, 0xc4, 0x3e, 0xc7, 0x10, 0x7a, - 0x0a, 0x20, 0xd8, 0x86, 0x50, 0x8a, 0x7d, 0x17, 0x2c, 0x6d, 0x37, 0xa1, 0xb8, 0x24, 0x6e, 0x44, - 0x13, 0x3f, 0xe3, 0x02, 0xbd, 0x04, 0x9d, 0x0b, 0x22, 0x22, 0xe9, 0xa3, 0x34, 0xa0, 0xbe, 0x5e, - 0xb5, 0x00, 0xca, 0xd2, 0x80, 0xd1, 0x9b, 0xb3, 0xae, 0x91, 0x74, 0xe5, 0x70, 0x2e, 0x68, 0x60, - 0x06, 0xa1, 0x63, 0x51, 0x0c, 0xc9, 0xa3, 0x0a, 0x1a, 0x7c, 0x95, 0x00, 0x7a, 0x0c, 0xaa, 0x30, - 0x23, 0x4e, 0x6d, 0x5c, 0x55, 0xdd, 0xb2, 0x04, 0xbe, 0x73, 0x6a, 0x6f, 0xb4, 0xae, 0xe3, 0x39, - 0x02, 0xd7, 0xb6, 0xda, 0x89, 0x04, 0xd0, 0x08, 0x9a, 0x56, 0xe4, 0x45, 0x2e, 0x11, 0xce, 0x92, - 0x9a, 0xdb, 0x31, 0x7b, 0x8a, 0x88, 0xb6, 0xbd, 0x6f, 0x3b, 0x03, 0x5d, 0x36, 0xe7, 0xe6, 0xcc, - 0x65, 0xcc, 0xc3, 0xf5, 0x78, 0xa0, 0x44, 0xc6, 0x12, 0x40, 0x08, 0x0a, 0x36, 0x11, 0x04, 0xef, - 0xab, 0x86, 0x3a, 0xcb, 0x05, 0xe5, 0xa7, 0x29, 0x6e, 0x02, 0x8a, 0x1b, 0xf1, 0x82, 0x12, 0x98, - 0xde, 0x04, 0x14, 0xbd, 0x80, 0x3d, 0x6e, 0xb1, 0x90, 0x6e, 0xcc, 0x3b, 0x50, 0x84, 0x9a, 0x02, - 0x53, 0xff, 0x32, 0xa9, 0x46, 0x77, 0x53, 0xbd, 0x93, 0xd7, 0x87, 0xd9, 0xbc, 0x76, 0xa0, 0x20, - 0x57, 0xc3, 0x4d, 0x95, 0xd3, 0x7a, 0x9a, 0xd3, 0x09, 0x9b, 0xcb, 0x7c, 0xaa, 0x5e, 0x67, 0x01, - 0x7a, 0x5c, 0xa3, 0x11, 0x94, 0xd2, 0x25, 0xb2, 0x89, 0xb4, 0xee, 0xfc, 0xd8, 0x52, 0x9a, 0xbc, - 0x59, 0x45, 0x8c, 0xda, 0x38, 0xdf, 0xd6, 0xe4, 0xcd, 0x49, 0xb9, 0xf1, 0x41, 0x53, 0xb0, 0x3a, - 0x8f, 0xe1, 0x47, 0x79, 0x30, 0x8c, 0x57, 0x98, 0xe9, 0xea, 0xdf, 0xea, 0xdd, 0xdf, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x5b, 0x14, 0x56, 0x85, 0x00, 0x05, 0x00, 0x00, +var File_block_etl_proto protoreflect.FileDescriptor + +var file_block_etl_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x65, 0x74, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6d, 0x77, 0x69, 0x74, 0x6b, 0x6f, 0x77, 0x2f, 0x67, 0x6f, + 0x2d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, + 0x73, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0x96, 0x03, 0x0a, 0x08, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x45, 0x54, 0x4c, 0x12, 0x1e, + 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, + 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x28, + 0x0a, 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x14, 0xe2, 0xdf, + 0x1f, 0x10, 0x0a, 0x0e, 0x5e, 0x5b, 0x61, 0x2d, 0x66, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x36, 0x34, + 0x7d, 0x24, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x61, 0x72, 0x65, + 0x6e, 0x74, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x14, 0xe2, + 0xdf, 0x1f, 0x10, 0x0a, 0x0e, 0x5e, 0x5b, 0x61, 0x2d, 0x66, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x36, + 0x34, 0x7d, 0x24, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x3e, 0x0a, 0x10, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x5f, 0x72, 0x6f, 0x6f, 0x74, 0x5f, 0x68, + 0x61, 0x73, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x14, 0xe2, 0xdf, 0x1f, 0x10, 0x0a, + 0x0e, 0x5e, 0x5b, 0x61, 0x2d, 0x66, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x36, 0x34, 0x7d, 0x24, 0x52, + 0x0e, 0x6d, 0x65, 0x72, 0x6b, 0x6c, 0x65, 0x52, 0x6f, 0x6f, 0x74, 0x48, 0x61, 0x73, 0x68, 0x12, + 0x2f, 0x0a, 0x07, 0x70, 0x65, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x16, 0xe2, 0xdf, 0x1f, 0x12, 0x0a, 0x10, 0x5e, 0x68, 0x78, 0x5b, 0x61, 0x2d, 0x66, 0x30, + 0x2d, 0x39, 0x5d, 0x7b, 0x34, 0x30, 0x7d, 0x24, 0x52, 0x06, 0x70, 0x65, 0x65, 0x72, 0x49, 0x64, + 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x12, 0x24, + 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x03, 0x42, 0x06, 0xe2, 0xdf, 0x1f, 0x02, 0x10, 0x00, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x3a, + 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x09, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x54, 0x4c, 0x52, 0x0c, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x95, 0x05, 0x0a, 0x0e, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x45, 0x54, 0x4c, 0x12, 0x2a, 0x0a, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x16, 0xe2, 0xdf, 0x1f, + 0x12, 0x0a, 0x10, 0x5e, 0x30, 0x78, 0x5b, 0x61, 0x2d, 0x66, 0x30, 0x2d, 0x39, 0x5d, 0x7b, 0x36, + 0x34, 0x7d, 0x24, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x24, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x06, 0xe2, 0xdf, + 0x1f, 0x02, 0x10, 0x00, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, + 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x14, 0x0a, 0x05, + 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x6e, + 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x03, 0x6e, 0x69, 0x64, 0x12, 0x21, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x74, 0x6f, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x26, 0x0a, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0e, 0xe2, 0xdf, + 0x1f, 0x0a, 0x0a, 0x08, 0x5e, 0x30, 0x78, 0x5b, 0x30, 0x31, 0x5d, 0x24, 0x52, 0x06, 0x73, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x70, 0x72, 0x69, + 0x63, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x65, 0x70, 0x50, 0x72, + 0x69, 0x63, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x75, 0x73, 0x65, 0x64, + 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x65, 0x70, 0x55, 0x73, 0x65, 0x64, + 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x65, 0x70, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x12, + 0x30, 0x0a, 0x14, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x73, 0x74, + 0x65, 0x70, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, + 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, 0x74, 0x65, 0x70, 0x55, 0x73, 0x65, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x73, 0x5f, 0x62, 0x6c, 0x6f, 0x6f, 0x6d, 0x18, + 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x6c, 0x6f, 0x6f, 0x6d, + 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, + 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x22, + 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x14, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x4c, 0x6f, 0x67, 0x45, 0x54, 0x4c, 0x52, 0x04, 0x6c, 0x6f, + 0x67, 0x73, 0x22, 0x68, 0x0a, 0x06, 0x4c, 0x6f, 0x67, 0x45, 0x54, 0x4c, 0x12, 0x30, 0x0a, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x16, 0xe2, + 0xdf, 0x1f, 0x12, 0x0a, 0x10, 0x5e, 0x63, 0x78, 0x5b, 0x61, 0x2d, 0x66, 0x30, 0x2d, 0x39, 0x5d, + 0x7b, 0x34, 0x30, 0x7d, 0x24, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x18, + 0x0a, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x0a, 0x5a, 0x08, + 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_block_etl_proto_rawDescOnce sync.Once + file_block_etl_proto_rawDescData = file_block_etl_proto_rawDesc +) + +func file_block_etl_proto_rawDescGZIP() []byte { + file_block_etl_proto_rawDescOnce.Do(func() { + file_block_etl_proto_rawDescData = protoimpl.X.CompressGZIP(file_block_etl_proto_rawDescData) + }) + return file_block_etl_proto_rawDescData +} + +var file_block_etl_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_block_etl_proto_goTypes = []interface{}{ + (*BlockETL)(nil), // 0: models.BlockETL + (*TransactionETL)(nil), // 1: models.TransactionETL + (*LogETL)(nil), // 2: models.LogETL +} +var file_block_etl_proto_depIdxs = []int32{ + 1, // 0: models.BlockETL.transactions:type_name -> models.TransactionETL + 2, // 1: models.TransactionETL.logs:type_name -> models.LogETL + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name +} + +func init() { file_block_etl_proto_init() } +func file_block_etl_proto_init() { + if File_block_etl_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_block_etl_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BlockETL); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_block_etl_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransactionETL); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_block_etl_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LogETL); 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_block_etl_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_block_etl_proto_goTypes, + DependencyIndexes: file_block_etl_proto_depIdxs, + MessageInfos: file_block_etl_proto_msgTypes, + }.Build() + File_block_etl_proto = out.File + file_block_etl_proto_rawDesc = nil + file_block_etl_proto_goTypes = nil + file_block_etl_proto_depIdxs = nil } diff --git a/src/models/block_index.pb.go b/src/models/block_index.pb.go index 9a90bcc..455a2bd 100644 --- a/src/models/block_index.pb.go +++ b/src/models/block_index.pb.go @@ -1,81 +1,148 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: block_index.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 BlockIndex struct { - Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *BlockIndex) Reset() { *m = BlockIndex{} } -func (m *BlockIndex) String() string { return proto.CompactTextString(m) } -func (*BlockIndex) ProtoMessage() {} -func (*BlockIndex) Descriptor() ([]byte, []int) { - return fileDescriptor_b4a72c8d1b448497, []int{0} + Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` } -func (m *BlockIndex) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_BlockIndex.Unmarshal(m, b) -} -func (m *BlockIndex) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_BlockIndex.Marshal(b, m, deterministic) -} -func (m *BlockIndex) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockIndex.Merge(m, src) +func (x *BlockIndex) Reset() { + *x = BlockIndex{} + if protoimpl.UnsafeEnabled { + mi := &file_block_index_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *BlockIndex) XXX_Size() int { - return xxx_messageInfo_BlockIndex.Size(m) + +func (x *BlockIndex) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *BlockIndex) XXX_DiscardUnknown() { - xxx_messageInfo_BlockIndex.DiscardUnknown(m) + +func (*BlockIndex) ProtoMessage() {} + +func (x *BlockIndex) ProtoReflect() protoreflect.Message { + mi := &file_block_index_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) } -var xxx_messageInfo_BlockIndex proto.InternalMessageInfo +// Deprecated: Use BlockIndex.ProtoReflect.Descriptor instead. +func (*BlockIndex) Descriptor() ([]byte, []int) { + return file_block_index_proto_rawDescGZIP(), []int{0} +} -func (m *BlockIndex) GetNumber() int64 { - if m != nil { - return m.Number +func (x *BlockIndex) GetNumber() int64 { + if x != nil { + return x.Number } return 0 } -func init() { - proto.RegisterType((*BlockIndex)(nil), "models.BlockIndex") +var File_block_index_proto protoreflect.FileDescriptor + +var file_block_index_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, + 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, + 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, + 0x0a, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x20, 0x0a, 0x06, 0x6e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, 0xba, 0xb9, 0x19, + 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x3a, 0x06, 0xba, + 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_block_index_proto_rawDescOnce sync.Once + file_block_index_proto_rawDescData = file_block_index_proto_rawDesc +) + +func file_block_index_proto_rawDescGZIP() []byte { + file_block_index_proto_rawDescOnce.Do(func() { + file_block_index_proto_rawDescData = protoimpl.X.CompressGZIP(file_block_index_proto_rawDescData) + }) + return file_block_index_proto_rawDescData } -func init() { - proto.RegisterFile("block_index.proto", fileDescriptor_b4a72c8d1b448497) +var file_block_index_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_block_index_proto_goTypes = []interface{}{ + (*BlockIndex)(nil), // 0: models.BlockIndex +} +var file_block_index_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 } -var fileDescriptor_b4a72c8d1b448497 = []byte{ - // 165 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0xca, 0xc9, 0x4f, - 0xce, 0x8e, 0xcf, 0xcc, 0x4b, 0x49, 0xad, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcb, - 0xcd, 0x4f, 0x49, 0xcd, 0x29, 0x96, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, - 0xcf, 0xd5, 0xcf, 0xcc, 0x4b, 0xcb, 0x4f, 0xca, 0xc9, 0xaf, 0xc8, 0x2f, 0x48, 0xcd, 0xd3, 0x07, - 0x2b, 0x4b, 0xd6, 0x4d, 0x4f, 0xcd, 0xd3, 0x4d, 0xcf, 0x2f, 0xca, 0x85, 0xf0, 0xf5, 0xf3, 0x0b, - 0x4a, 0x32, 0xf3, 0xf3, 0x8a, 0xf5, 0x41, 0x42, 0x10, 0x93, 0x94, 0xcc, 0xb8, 0xb8, 0x9c, 0x40, - 0xc6, 0x7b, 0x82, 0x4c, 0x17, 0x52, 0xe0, 0x62, 0xcb, 0x2b, 0xcd, 0x4d, 0x4a, 0x2d, 0x92, 0x60, - 0x54, 0x60, 0xd4, 0x60, 0x76, 0xe2, 0xd8, 0xb5, 0x53, 0x92, 0x85, 0x8b, 0x49, 0x83, 0x31, 0x08, - 0x2a, 0x6e, 0xc5, 0xb6, 0x6b, 0xa7, 0x24, 0x13, 0x07, 0xa3, 0x13, 0x57, 0x14, 0x87, 0x9e, 0x3e, - 0xc4, 0x15, 0x49, 0x6c, 0x60, 0xa3, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xee, 0xc8, 0xb3, - 0x5d, 0xa9, 0x00, 0x00, 0x00, +func init() { file_block_index_proto_init() } +func file_block_index_proto_init() { + if File_block_index_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_block_index_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BlockIndex); 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_block_index_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_block_index_proto_goTypes, + DependencyIndexes: file_block_index_proto_depIdxs, + MessageInfos: file_block_index_proto_msgTypes, + }.Build() + File_block_index_proto = out.File + file_block_index_proto_rawDesc = nil + file_block_index_proto_goTypes = nil + file_block_index_proto_depIdxs = nil } diff --git a/src/models/block_index.pb.gorm.go b/src/models/block_index.pb.gorm.go index 42f0a7a..6e8b680 100644 --- a/src/models/block_index.pb.gorm.go +++ b/src/models/block_index.pb.gorm.go @@ -3,14 +3,13 @@ package models import ( context "context" fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type BlockIndexORM struct { - Number int64 `gorm:"primary_key"` + Number int64 `gorm:"primaryKey"` } // TableName overrides the default tablename generated by GORM @@ -89,7 +88,7 @@ func DefaultCreateBlockIndex(ctx context.Context, in *BlockIndex, db *gorm.DB) ( return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(BlockIndexORMWithAfterCreate_); ok { @@ -124,9 +123,6 @@ func DefaultReadBlockIndex(ctx context.Context, in *BlockIndex, db *gorm.DB) (*B return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &BlockIndexORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(BlockIndexORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -247,7 +243,7 @@ func DefaultStrictUpdateBlockIndex(ctx context.Context, in *BlockIndex, db *gorm return nil, err } } - if err = db.Save(&ormObj).Error; err != nil { + if err = db.Omit().Save(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(BlockIndexORMWithAfterStrictUpdateSave); ok { @@ -373,10 +369,6 @@ func DefaultListBlockIndex(ctx context.Context, db *gorm.DB) ([]*BlockIndex, err return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &BlockIndexORM{}, &BlockIndex{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(BlockIndexORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err diff --git a/src/models/contract_processed.pb.go b/src/models/contract_processed.pb.go index a3c3301..c94ec4c 100644 --- a/src/models/contract_processed.pb.go +++ b/src/models/contract_processed.pb.go @@ -1,143 +1,215 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: contract_processed.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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) +) // Used for proto and gorm type ContractProcessed struct { - // Address related items - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` - CreatedTimestamp int64 `protobuf:"varint,3,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp"` - Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status"` - IsToken bool `protobuf:"varint,5,opt,name=is_token,json=isToken,proto3" json:"is_token"` - ContractUpdatedBlock int64 `protobuf:"varint,6,opt,name=contract_updated_block,json=contractUpdatedBlock,proto3" json:"contract_updated_block"` - ContractType string `protobuf:"bytes,7,opt,name=contract_type,json=contractType,proto3" json:"contract_type"` - TokenStandard string `protobuf:"bytes,8,opt,name=token_standard,json=tokenStandard,proto3" json:"token_standard"` -} - -func (m *ContractProcessed) Reset() { *m = ContractProcessed{} } -func (m *ContractProcessed) String() string { return proto.CompactTextString(m) } -func (*ContractProcessed) ProtoMessage() {} -func (*ContractProcessed) Descriptor() ([]byte, []int) { - return fileDescriptor_5993f9666cfc1736, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` + CreatedTimestamp int64 `protobuf:"varint,3,opt,name=created_timestamp,json=createdTimestamp,proto3" json:"created_timestamp"` + Status string `protobuf:"bytes,4,opt,name=status,proto3" json:"status"` + IsToken bool `protobuf:"varint,5,opt,name=is_token,json=isToken,proto3" json:"is_token"` + ContractUpdatedBlock int64 `protobuf:"varint,6,opt,name=contract_updated_block,json=contractUpdatedBlock,proto3" json:"contract_updated_block"` + ContractType string `protobuf:"bytes,7,opt,name=contract_type,json=contractType,proto3" json:"contract_type"` + TokenStandard string `protobuf:"bytes,8,opt,name=token_standard,json=tokenStandard,proto3" json:"token_standard"` +} + +func (x *ContractProcessed) Reset() { + *x = ContractProcessed{} + if protoimpl.UnsafeEnabled { + mi := &file_contract_processed_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *ContractProcessed) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_ContractProcessed.Unmarshal(m, b) -} -func (m *ContractProcessed) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_ContractProcessed.Marshal(b, m, deterministic) -} -func (m *ContractProcessed) XXX_Merge(src proto.Message) { - xxx_messageInfo_ContractProcessed.Merge(m, src) +func (x *ContractProcessed) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *ContractProcessed) XXX_Size() int { - return xxx_messageInfo_ContractProcessed.Size(m) -} -func (m *ContractProcessed) XXX_DiscardUnknown() { - xxx_messageInfo_ContractProcessed.DiscardUnknown(m) + +func (*ContractProcessed) ProtoMessage() {} + +func (x *ContractProcessed) ProtoReflect() protoreflect.Message { + mi := &file_contract_processed_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) } -var xxx_messageInfo_ContractProcessed proto.InternalMessageInfo +// Deprecated: Use ContractProcessed.ProtoReflect.Descriptor instead. +func (*ContractProcessed) Descriptor() ([]byte, []int) { + return file_contract_processed_proto_rawDescGZIP(), []int{0} +} -func (m *ContractProcessed) GetAddress() string { - if m != nil { - return m.Address +func (x *ContractProcessed) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *ContractProcessed) GetName() string { - if m != nil { - return m.Name +func (x *ContractProcessed) GetName() string { + if x != nil { + return x.Name } return "" } -func (m *ContractProcessed) GetCreatedTimestamp() int64 { - if m != nil { - return m.CreatedTimestamp +func (x *ContractProcessed) GetCreatedTimestamp() int64 { + if x != nil { + return x.CreatedTimestamp } return 0 } -func (m *ContractProcessed) GetStatus() string { - if m != nil { - return m.Status +func (x *ContractProcessed) GetStatus() string { + if x != nil { + return x.Status } return "" } -func (m *ContractProcessed) GetIsToken() bool { - if m != nil { - return m.IsToken +func (x *ContractProcessed) GetIsToken() bool { + if x != nil { + return x.IsToken } return false } -func (m *ContractProcessed) GetContractUpdatedBlock() int64 { - if m != nil { - return m.ContractUpdatedBlock +func (x *ContractProcessed) GetContractUpdatedBlock() int64 { + if x != nil { + return x.ContractUpdatedBlock } return 0 } -func (m *ContractProcessed) GetContractType() string { - if m != nil { - return m.ContractType +func (x *ContractProcessed) GetContractType() string { + if x != nil { + return x.ContractType } return "" } -func (m *ContractProcessed) GetTokenStandard() string { - if m != nil { - return m.TokenStandard +func (x *ContractProcessed) GetTokenStandard() string { + if x != nil { + return x.TokenStandard } return "" } -func init() { - proto.RegisterType((*ContractProcessed)(nil), "models.ContractProcessed") -} - -func init() { - proto.RegisterFile("contract_processed.proto", fileDescriptor_5993f9666cfc1736) -} - -var fileDescriptor_5993f9666cfc1736 = []byte{ - // 251 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x3c, 0x90, 0xc1, 0x6a, 0xf3, 0x30, - 0x10, 0x84, 0x71, 0x92, 0xdf, 0xf6, 0xbf, 0x34, 0xa5, 0x11, 0x25, 0x6c, 0x6f, 0xa6, 0xa5, 0x60, - 0x28, 0xa4, 0x87, 0xf6, 0x09, 0xd2, 0x17, 0x28, 0xae, 0x7b, 0xe9, 0xc5, 0x28, 0xd6, 0x1e, 0x4c, - 0x62, 0x4b, 0x68, 0x37, 0x87, 0x3c, 0x4f, 0x5f, 0xb4, 0x64, 0x63, 0xe7, 0xa6, 0xf9, 0x66, 0xa4, - 0x41, 0x03, 0xd8, 0xfa, 0x41, 0xa2, 0x6d, 0xa5, 0x09, 0xd1, 0xb7, 0xc4, 0x4c, 0x6e, 0x13, 0xa2, - 0x17, 0x6f, 0xd2, 0xde, 0x3b, 0x3a, 0xf0, 0xe3, 0xef, 0x0c, 0x56, 0x1f, 0x63, 0xe8, 0x73, 0xca, - 0x18, 0x84, 0xcc, 0x3a, 0x17, 0x89, 0x19, 0x93, 0x22, 0x29, 0xff, 0x57, 0x93, 0x34, 0x06, 0x16, - 0x83, 0xed, 0x09, 0x67, 0x8a, 0xf5, 0x6c, 0x5e, 0x60, 0xd5, 0x46, 0xb2, 0x42, 0xae, 0x91, 0xae, - 0x27, 0x16, 0xdb, 0x07, 0x9c, 0x17, 0x49, 0x39, 0xaf, 0xee, 0x46, 0xa3, 0x9e, 0xb8, 0x59, 0x43, - 0xca, 0x62, 0xe5, 0xc8, 0xb8, 0xd0, 0x27, 0x46, 0x65, 0x1e, 0x20, 0xef, 0xb8, 0x11, 0xbf, 0xa7, - 0x01, 0xff, 0x15, 0x49, 0x99, 0x57, 0x59, 0xc7, 0xf5, 0x59, 0x9a, 0x77, 0x58, 0x5f, 0xff, 0x71, - 0x0c, 0x4e, 0x8b, 0x76, 0x07, 0xdf, 0xee, 0x31, 0xd5, 0x92, 0xfb, 0xc9, 0xfd, 0xbe, 0x98, 0xdb, - 0xb3, 0x67, 0x9e, 0x60, 0x79, 0xbd, 0x25, 0xa7, 0x40, 0x98, 0x69, 0xdf, 0xcd, 0x04, 0xeb, 0x53, - 0x20, 0xf3, 0x0c, 0xb7, 0x5a, 0xd9, 0xb0, 0xd8, 0xc1, 0xd9, 0xe8, 0x30, 0xd7, 0xd4, 0x52, 0xe9, - 0xd7, 0x08, 0xb7, 0xf0, 0x93, 0x6f, 0x5e, 0x2f, 0x8b, 0xed, 0x52, 0x1d, 0xf0, 0xed, 0x2f, 0x00, - 0x00, 0xff, 0xff, 0xd1, 0x29, 0xb2, 0x69, 0x5c, 0x01, 0x00, 0x00, +var File_contract_processed_proto protoreflect.FileDescriptor + +var file_contract_processed_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x63, 0x65, + 0x73, 0x73, 0x65, 0x64, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x22, 0xa3, 0x02, 0x0a, 0x11, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x50, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x65, 0x64, 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, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x10, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x19, 0x0a, 0x08, 0x69, + 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, + 0x73, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x34, 0x0a, 0x16, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, + 0x63, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x14, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x23, 0x0a, 0x0d, + 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x73, 0x74, 0x61, 0x6e, 0x64, + 0x61, 0x72, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x53, 0x74, 0x61, 0x6e, 0x64, 0x61, 0x72, 0x64, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_contract_processed_proto_rawDescOnce sync.Once + file_contract_processed_proto_rawDescData = file_contract_processed_proto_rawDesc +) + +func file_contract_processed_proto_rawDescGZIP() []byte { + file_contract_processed_proto_rawDescOnce.Do(func() { + file_contract_processed_proto_rawDescData = protoimpl.X.CompressGZIP(file_contract_processed_proto_rawDescData) + }) + return file_contract_processed_proto_rawDescData +} + +var file_contract_processed_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_contract_processed_proto_goTypes = []interface{}{ + (*ContractProcessed)(nil), // 0: models.ContractProcessed +} +var file_contract_processed_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_contract_processed_proto_init() } +func file_contract_processed_proto_init() { + if File_contract_processed_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_contract_processed_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ContractProcessed); 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_contract_processed_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_contract_processed_proto_goTypes, + DependencyIndexes: file_contract_processed_proto_depIdxs, + MessageInfos: file_contract_processed_proto_msgTypes, + }.Build() + File_contract_processed_proto = out.File + file_contract_processed_proto_rawDesc = nil + file_contract_processed_proto_goTypes = nil + file_contract_processed_proto_depIdxs = nil } diff --git a/src/models/dead_block.pb.go b/src/models/dead_block.pb.go index afa5fa4..afb66fb 100644 --- a/src/models/dead_block.pb.go +++ b/src/models/dead_block.pb.go @@ -1,117 +1,187 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: dead_block.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 DeadBlock struct { - Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic"` - Partition int64 `protobuf:"varint,2,opt,name=partition,proto3" json:"partition"` - Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset"` - Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key"` - Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Topic string `protobuf:"bytes,1,opt,name=topic,proto3" json:"topic"` + Partition int64 `protobuf:"varint,2,opt,name=partition,proto3" json:"partition"` + Offset int64 `protobuf:"varint,3,opt,name=offset,proto3" json:"offset"` + Key string `protobuf:"bytes,4,opt,name=key,proto3" json:"key"` + Value string `protobuf:"bytes,5,opt,name=value,proto3" json:"value"` } -func (m *DeadBlock) Reset() { *m = DeadBlock{} } -func (m *DeadBlock) String() string { return proto.CompactTextString(m) } -func (*DeadBlock) ProtoMessage() {} -func (*DeadBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_10ab1ab1f8727312, []int{0} +func (x *DeadBlock) Reset() { + *x = DeadBlock{} + if protoimpl.UnsafeEnabled { + mi := &file_dead_block_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *DeadBlock) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_DeadBlock.Unmarshal(m, b) -} -func (m *DeadBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_DeadBlock.Marshal(b, m, deterministic) +func (x *DeadBlock) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *DeadBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeadBlock.Merge(m, src) -} -func (m *DeadBlock) XXX_Size() int { - return xxx_messageInfo_DeadBlock.Size(m) -} -func (m *DeadBlock) XXX_DiscardUnknown() { - xxx_messageInfo_DeadBlock.DiscardUnknown(m) + +func (*DeadBlock) ProtoMessage() {} + +func (x *DeadBlock) ProtoReflect() protoreflect.Message { + mi := &file_dead_block_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) } -var xxx_messageInfo_DeadBlock proto.InternalMessageInfo +// Deprecated: Use DeadBlock.ProtoReflect.Descriptor instead. +func (*DeadBlock) Descriptor() ([]byte, []int) { + return file_dead_block_proto_rawDescGZIP(), []int{0} +} -func (m *DeadBlock) GetTopic() string { - if m != nil { - return m.Topic +func (x *DeadBlock) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *DeadBlock) GetPartition() int64 { - if m != nil { - return m.Partition +func (x *DeadBlock) GetPartition() int64 { + if x != nil { + return x.Partition } return 0 } -func (m *DeadBlock) GetOffset() int64 { - if m != nil { - return m.Offset +func (x *DeadBlock) GetOffset() int64 { + if x != nil { + return x.Offset } return 0 } -func (m *DeadBlock) GetKey() string { - if m != nil { - return m.Key +func (x *DeadBlock) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *DeadBlock) GetValue() string { - if m != nil { - return m.Value +func (x *DeadBlock) GetValue() string { + if x != nil { + return x.Value } return "" } -func init() { - proto.RegisterType((*DeadBlock)(nil), "models.DeadBlock") +var File_dead_block_proto protoreflect.FileDescriptor + +var file_dead_block_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x64, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, + 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, + 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, + 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x01, 0x0a, + 0x09, 0x44, 0x65, 0x61, 0x64, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x6f, + 0x70, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, + 0x02, 0x28, 0x01, 0x52, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x26, 0x0a, 0x09, 0x70, 0x61, + 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, 0xba, + 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x0a, 0x06, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x06, 0x6f, 0x66, + 0x66, 0x73, 0x65, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x06, 0xba, 0xb9, + 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { - proto.RegisterFile("dead_block.proto", fileDescriptor_10ab1ab1f8727312) +var ( + file_dead_block_proto_rawDescOnce sync.Once + file_dead_block_proto_rawDescData = file_dead_block_proto_rawDesc +) + +func file_dead_block_proto_rawDescGZIP() []byte { + file_dead_block_proto_rawDescOnce.Do(func() { + file_dead_block_proto_rawDescData = protoimpl.X.CompressGZIP(file_dead_block_proto_rawDescData) + }) + return file_dead_block_proto_rawDescData } -var fileDescriptor_10ab1ab1f8727312 = []byte{ - // 229 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x8f, 0xbf, 0x4e, 0xc3, 0x30, - 0x10, 0xc6, 0xe5, 0xa4, 0x89, 0x92, 0x9b, 0x2a, 0x8b, 0xc1, 0x65, 0x40, 0x11, 0x03, 0xca, 0xd2, - 0x78, 0x60, 0x63, 0x42, 0x11, 0x4f, 0xd0, 0x91, 0x05, 0xe5, 0xcf, 0x25, 0x58, 0x75, 0x7c, 0x56, - 0xe2, 0x22, 0x78, 0x20, 0x1e, 0xa2, 0x7d, 0x3a, 0xe4, 0x18, 0x09, 0xd4, 0xcd, 0xdf, 0xcf, 0x9f, - 0x7e, 0x77, 0x07, 0xdb, 0x1e, 0x9b, 0xfe, 0xad, 0xd5, 0xd4, 0x1d, 0x2b, 0x3b, 0x93, 0x23, 0x9e, - 0x4e, 0xd4, 0xa3, 0x5e, 0x6e, 0x9f, 0x47, 0xe5, 0xde, 0x4f, 0x6d, 0xd5, 0xd1, 0x24, 0x95, 0x19, - 0xa8, 0xd5, 0xf4, 0x49, 0x16, 0x8d, 0x5c, 0x6b, 0xdd, 0x7e, 0x44, 0xb3, 0x1f, 0x69, 0x9e, 0x42, - 0x96, 0x64, 0x9d, 0x22, 0xb3, 0x48, 0x8f, 0x82, 0xe9, 0xfe, 0x9b, 0x41, 0xfe, 0x82, 0x4d, 0x5f, - 0x7b, 0x3b, 0xbf, 0x83, 0xc4, 0x91, 0x55, 0x9d, 0x60, 0x05, 0x2b, 0xf3, 0x3a, 0xbb, 0x9c, 0x77, - 0x1b, 0x88, 0x4a, 0x76, 0x08, 0x98, 0x3f, 0x40, 0x6e, 0x9b, 0xd9, 0x29, 0xaf, 0x11, 0x51, 0xc1, - 0xca, 0xf8, 0x5f, 0xe7, 0xef, 0x8b, 0x17, 0x90, 0xd2, 0x30, 0x2c, 0xe8, 0x44, 0x7c, 0x55, 0xfa, - 0xe5, 0x7c, 0x0b, 0xf1, 0x11, 0xbf, 0xc4, 0xc6, 0xcf, 0x39, 0xf8, 0x27, 0xbf, 0x81, 0xe4, 0xa3, - 0xd1, 0x27, 0x14, 0xc9, 0xca, 0x42, 0x78, 0x4a, 0x2f, 0xe7, 0x5d, 0x94, 0xb1, 0x1a, 0x5e, 0xb3, - 0x4a, 0x86, 0xab, 0xdb, 0x74, 0x5d, 0xfd, 0xf1, 0x27, 0x00, 0x00, 0xff, 0xff, 0x9d, 0xbe, 0xe8, - 0x76, 0x18, 0x01, 0x00, 0x00, +var file_dead_block_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_dead_block_proto_goTypes = []interface{}{ + (*DeadBlock)(nil), // 0: models.DeadBlock +} +var file_dead_block_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_dead_block_proto_init() } +func file_dead_block_proto_init() { + if File_dead_block_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_dead_block_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeadBlock); 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_dead_block_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_dead_block_proto_goTypes, + DependencyIndexes: file_dead_block_proto_depIdxs, + MessageInfos: file_dead_block_proto_msgTypes, + }.Build() + File_dead_block_proto = out.File + file_dead_block_proto_rawDesc = nil + file_dead_block_proto_goTypes = nil + file_dead_block_proto_depIdxs = nil } diff --git a/src/models/dead_block.pb.gorm.go b/src/models/dead_block.pb.gorm.go index 9757a32..8f46c61 100644 --- a/src/models/dead_block.pb.gorm.go +++ b/src/models/dead_block.pb.gorm.go @@ -2,18 +2,16 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type DeadBlockORM struct { Key string - Offset int64 `gorm:"primary_key"` - Partition int64 `gorm:"primary_key"` - Topic string `gorm:"primary_key"` + Offset int64 `gorm:"primaryKey"` + Partition int64 `gorm:"primaryKey"` + Topic string `gorm:"primaryKey"` Value string } @@ -101,7 +99,7 @@ func DefaultCreateDeadBlock(ctx context.Context, in *DeadBlock, db *gorm.DB) (*D return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(DeadBlockORMWithAfterCreate_); ok { @@ -131,14 +129,17 @@ func DefaultReadDeadBlock(ctx context.Context, in *DeadBlock, db *gorm.DB) (*Dea if ormObj.Offset == 0 { return nil, errors.EmptyIdError } + if ormObj.Partition == 0 { + return nil, errors.EmptyIdError + } + if ormObj.Topic == "" { + return nil, errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(DeadBlockORMWithBeforeReadApplyQuery); ok { if db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil { return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &DeadBlockORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(DeadBlockORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -178,6 +179,12 @@ func DefaultDeleteDeadBlock(ctx context.Context, in *DeadBlock, db *gorm.DB) err if ormObj.Offset == 0 { return errors.EmptyIdError } + if ormObj.Partition == 0 { + return errors.EmptyIdError + } + if ormObj.Topic == "" { + return errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(DeadBlockORMWithBeforeDelete_); ok { if db, err = hook.BeforeDelete_(ctx, db); err != nil { return err @@ -200,159 +207,6 @@ type DeadBlockORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteDeadBlockSet(ctx context.Context, in []*DeadBlock, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.Topic == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.Topic) - } - if hook, ok := (interface{}(&DeadBlockORM{})).(DeadBlockORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("topic in (?)", keys).Delete(&DeadBlockORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&DeadBlockORM{})).(DeadBlockORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type DeadBlockORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*DeadBlock, *gorm.DB) (*gorm.DB, error) -} -type DeadBlockORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*DeadBlock, *gorm.DB) error -} - -// DefaultStrictUpdateDeadBlock clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateDeadBlock(ctx context.Context, in *DeadBlock, db *gorm.DB) (*DeadBlock, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateDeadBlock") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &DeadBlockORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("partition=?", ormObj.Partition).First(lockedRow) - if hook, ok := interface{}(&ormObj).(DeadBlockORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(DeadBlockORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(DeadBlockORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type DeadBlockORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type DeadBlockORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type DeadBlockORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchDeadBlock executes a basic gorm update call with patch behavior -func DefaultPatchDeadBlock(ctx context.Context, in *DeadBlock, updateMask *field_mask.FieldMask, db *gorm.DB) (*DeadBlock, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj DeadBlock - var err error - if hook, ok := interface{}(&pbObj).(DeadBlockWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(DeadBlockWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskDeadBlock(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(DeadBlockWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateDeadBlock(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(DeadBlockWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type DeadBlockWithBeforePatchRead interface { - BeforePatchRead(context.Context, *DeadBlock, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type DeadBlockWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *DeadBlock, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type DeadBlockWithBeforePatchSave interface { - BeforePatchSave(context.Context, *DeadBlock, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type DeadBlockWithAfterPatchSave interface { - AfterPatchSave(context.Context, *DeadBlock, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetDeadBlock executes a bulk gorm update call with patch behavior -func DefaultPatchSetDeadBlock(ctx context.Context, objects []*DeadBlock, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*DeadBlock, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*DeadBlock, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchDeadBlock(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskDeadBlock patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskDeadBlock(ctx context.Context, patchee *DeadBlock, patcher *DeadBlock, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*DeadBlock, error) { if patcher == nil { @@ -401,17 +255,13 @@ func DefaultListDeadBlock(ctx context.Context, db *gorm.DB) ([]*DeadBlock, error return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &DeadBlockORM{}, &DeadBlock{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(DeadBlockORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("topic") + db = db.Order("offset, partition, topic") ormResponse := []DeadBlockORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/kafka_job.pb.go b/src/models/kafka_job.pb.go index 5fd6cc6..fa6e39b 100644 --- a/src/models/kafka_job.pb.go +++ b/src/models/kafka_job.pb.go @@ -1,126 +1,198 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: kafka_job.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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) +) // Represents kafka consumer status, create by k9 bash job // CREATE TABLE kafka_jobs ( -// job_id varchar, -// worker_group varchar, -// topic varchar, -// partition bigint, -// stop_offset bigint, -// PRIMARY KEY (job_id, worker_group, topic, partition, stop_offset)); +// +// job_id varchar, +// worker_group varchar, +// topic varchar, +// partition bigint, +// stop_offset bigint, +// PRIMARY KEY (job_id, worker_group, topic, partition, stop_offset)); type KafkaJob struct { - JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id"` - WorkerGroup string `protobuf:"bytes,2,opt,name=worker_group,json=workerGroup,proto3" json:"worker_group"` - Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic"` - Partition uint64 `protobuf:"varint,4,opt,name=partition,proto3" json:"partition"` - StopOffset uint64 `protobuf:"varint,5,opt,name=stop_offset,json=stopOffset,proto3" json:"stop_offset"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + JobId string `protobuf:"bytes,1,opt,name=job_id,json=jobId,proto3" json:"job_id"` + WorkerGroup string `protobuf:"bytes,2,opt,name=worker_group,json=workerGroup,proto3" json:"worker_group"` + Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic"` + Partition uint64 `protobuf:"varint,4,opt,name=partition,proto3" json:"partition"` + StopOffset uint64 `protobuf:"varint,5,opt,name=stop_offset,json=stopOffset,proto3" json:"stop_offset"` } -func (m *KafkaJob) Reset() { *m = KafkaJob{} } -func (m *KafkaJob) String() string { return proto.CompactTextString(m) } -func (*KafkaJob) ProtoMessage() {} -func (*KafkaJob) Descriptor() ([]byte, []int) { - return fileDescriptor_20843d16c2610973, []int{0} +func (x *KafkaJob) Reset() { + *x = KafkaJob{} + if protoimpl.UnsafeEnabled { + mi := &file_kafka_job_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *KafkaJob) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_KafkaJob.Unmarshal(m, b) -} -func (m *KafkaJob) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_KafkaJob.Marshal(b, m, deterministic) +func (x *KafkaJob) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *KafkaJob) XXX_Merge(src proto.Message) { - xxx_messageInfo_KafkaJob.Merge(m, src) -} -func (m *KafkaJob) XXX_Size() int { - return xxx_messageInfo_KafkaJob.Size(m) -} -func (m *KafkaJob) XXX_DiscardUnknown() { - xxx_messageInfo_KafkaJob.DiscardUnknown(m) + +func (*KafkaJob) ProtoMessage() {} + +func (x *KafkaJob) ProtoReflect() protoreflect.Message { + mi := &file_kafka_job_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) } -var xxx_messageInfo_KafkaJob proto.InternalMessageInfo +// Deprecated: Use KafkaJob.ProtoReflect.Descriptor instead. +func (*KafkaJob) Descriptor() ([]byte, []int) { + return file_kafka_job_proto_rawDescGZIP(), []int{0} +} -func (m *KafkaJob) GetJobId() string { - if m != nil { - return m.JobId +func (x *KafkaJob) GetJobId() string { + if x != nil { + return x.JobId } return "" } -func (m *KafkaJob) GetWorkerGroup() string { - if m != nil { - return m.WorkerGroup +func (x *KafkaJob) GetWorkerGroup() string { + if x != nil { + return x.WorkerGroup } return "" } -func (m *KafkaJob) GetTopic() string { - if m != nil { - return m.Topic +func (x *KafkaJob) GetTopic() string { + if x != nil { + return x.Topic } return "" } -func (m *KafkaJob) GetPartition() uint64 { - if m != nil { - return m.Partition +func (x *KafkaJob) GetPartition() uint64 { + if x != nil { + return x.Partition } return 0 } -func (m *KafkaJob) GetStopOffset() uint64 { - if m != nil { - return m.StopOffset +func (x *KafkaJob) GetStopOffset() uint64 { + if x != nil { + return x.StopOffset } return 0 } -func init() { - proto.RegisterType((*KafkaJob)(nil), "models.KafkaJob") +var File_kafka_job_proto protoreflect.FileDescriptor + +var file_kafka_job_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x6b, 0x61, 0x66, 0x6b, 0x61, 0x5f, 0x6a, 0x6f, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, + 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x08, + 0x4b, 0x61, 0x66, 0x6b, 0x61, 0x4a, 0x6f, 0x62, 0x12, 0x1f, 0x0a, 0x06, 0x6a, 0x6f, 0x62, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, + 0x28, 0x01, 0x52, 0x05, 0x6a, 0x6f, 0x62, 0x49, 0x64, 0x12, 0x2b, 0x0a, 0x0c, 0x77, 0x6f, 0x72, + 0x6b, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x0b, 0x77, 0x6f, 0x72, 0x6b, 0x65, + 0x72, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, + 0x05, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x26, 0x0a, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, + 0x02, 0x28, 0x01, 0x52, 0x09, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1f, + 0x0a, 0x0b, 0x73, 0x74, 0x6f, 0x70, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x04, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x70, 0x4f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x3a, + 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { - proto.RegisterFile("kafka_job.proto", fileDescriptor_20843d16c2610973) +var ( + file_kafka_job_proto_rawDescOnce sync.Once + file_kafka_job_proto_rawDescData = file_kafka_job_proto_rawDesc +) + +func file_kafka_job_proto_rawDescGZIP() []byte { + file_kafka_job_proto_rawDescOnce.Do(func() { + file_kafka_job_proto_rawDescData = protoimpl.X.CompressGZIP(file_kafka_job_proto_rawDescData) + }) + return file_kafka_job_proto_rawDescData } -var fileDescriptor_20843d16c2610973 = []byte{ - // 251 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xc1, 0x4a, 0xc3, 0x40, - 0x10, 0x86, 0xd9, 0x9a, 0x84, 0x74, 0x2a, 0x08, 0x7b, 0x4a, 0x3d, 0xd8, 0xe2, 0x41, 0x02, 0xd2, - 0xe4, 0xe0, 0xcd, 0x93, 0xf4, 0x22, 0xea, 0x41, 0xe8, 0xd1, 0x4b, 0xc8, 0x26, 0x9b, 0xb8, 0x49, - 0x93, 0x7f, 0xd9, 0x6c, 0xd1, 0x57, 0x6b, 0xdf, 0xc0, 0xb7, 0x92, 0x4d, 0x0e, 0x4a, 0x8f, 0xf3, - 0xfd, 0x1f, 0x3f, 0x33, 0x43, 0x57, 0x6d, 0x5e, 0xb5, 0x79, 0xd6, 0x40, 0x24, 0xda, 0xc0, 0x82, - 0x07, 0x1d, 0x4a, 0xb9, 0x1f, 0xae, 0x9f, 0x6a, 0x65, 0x3f, 0x0f, 0x22, 0x29, 0xd0, 0xa5, 0xaa, - 0xaf, 0x20, 0xf6, 0xf8, 0x86, 0x96, 0x7d, 0x3a, 0x6a, 0xc5, 0xa6, 0x96, 0xfd, 0xa6, 0x86, 0xe9, - 0xa6, 0x39, 0x85, 0xb6, 0x0a, 0xfd, 0x90, 0x3a, 0x34, 0x35, 0xdd, 0xfe, 0x30, 0x0a, 0xdf, 0x5c, - 0xfb, 0x2b, 0x04, 0x5f, 0x51, 0xd0, 0x40, 0x64, 0xaa, 0x8c, 0xd8, 0x9a, 0xc5, 0xf3, 0x6d, 0x78, - 0x3a, 0x2e, 0x3d, 0x9a, 0xc5, 0x6c, 0xe7, 0x37, 0x10, 0x2f, 0x25, 0xbf, 0xa7, 0xcb, 0x2f, 0x98, - 0x56, 0x9a, 0xac, 0x36, 0x38, 0xe8, 0x68, 0x76, 0xa6, 0x2d, 0xa6, 0xf4, 0xd9, 0x85, 0xfc, 0x86, - 0x7c, 0x0b, 0xad, 0x8a, 0xe8, 0xe2, 0xbc, 0x6c, 0xc4, 0xfc, 0x8e, 0xe6, 0x3a, 0x37, 0x56, 0xb9, - 0x9d, 0x22, 0x6f, 0xcd, 0x62, 0xef, 0x9f, 0xf3, 0x17, 0xf1, 0x15, 0x2d, 0x06, 0x0b, 0x9d, 0xa1, - 0xaa, 0x06, 0x69, 0x23, 0xdf, 0x99, 0x3b, 0x72, 0xe8, 0x7d, 0x24, 0x8f, 0xc1, 0xe9, 0xb8, 0x9c, - 0x85, 0x6c, 0x4b, 0x1f, 0x61, 0x92, 0x4e, 0x9f, 0x11, 0xc1, 0x78, 0xde, 0xc3, 0x6f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xfd, 0x30, 0x0c, 0xfc, 0x3b, 0x01, 0x00, 0x00, +var file_kafka_job_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_kafka_job_proto_goTypes = []interface{}{ + (*KafkaJob)(nil), // 0: models.KafkaJob +} +var file_kafka_job_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_kafka_job_proto_init() } +func file_kafka_job_proto_init() { + if File_kafka_job_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_kafka_job_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KafkaJob); 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_kafka_job_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_kafka_job_proto_goTypes, + DependencyIndexes: file_kafka_job_proto_depIdxs, + MessageInfos: file_kafka_job_proto_msgTypes, + }.Build() + File_kafka_job_proto = out.File + file_kafka_job_proto_rawDesc = nil + file_kafka_job_proto_goTypes = nil + file_kafka_job_proto_depIdxs = nil } diff --git a/src/models/kafka_job.pb.gorm.go b/src/models/kafka_job.pb.gorm.go index e6436ed..30833bc 100644 --- a/src/models/kafka_job.pb.gorm.go +++ b/src/models/kafka_job.pb.gorm.go @@ -2,19 +2,17 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type KafkaJobORM struct { - JobId string `gorm:"primary_key"` - Partition uint64 `gorm:"primary_key"` + JobId string `gorm:"primaryKey"` + Partition uint64 `gorm:"primaryKey"` StopOffset uint64 - Topic string `gorm:"primary_key"` - WorkerGroup string `gorm:"primary_key"` + Topic string `gorm:"primaryKey"` + WorkerGroup string `gorm:"primaryKey"` } // TableName overrides the default tablename generated by GORM @@ -101,7 +99,7 @@ func DefaultCreateKafkaJob(ctx context.Context, in *KafkaJob, db *gorm.DB) (*Kaf return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(KafkaJobORMWithAfterCreate_); ok { @@ -128,17 +126,23 @@ func DefaultReadKafkaJob(ctx context.Context, in *KafkaJob, db *gorm.DB) (*Kafka if err != nil { return nil, err } + if ormObj.JobId == "" { + return nil, errors.EmptyIdError + } if ormObj.Partition == 0 { return nil, errors.EmptyIdError } + if ormObj.Topic == "" { + return nil, errors.EmptyIdError + } + if ormObj.WorkerGroup == "" { + return nil, errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(KafkaJobORMWithBeforeReadApplyQuery); ok { if db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil { return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &KafkaJobORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(KafkaJobORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -178,6 +182,15 @@ func DefaultDeleteKafkaJob(ctx context.Context, in *KafkaJob, db *gorm.DB) error if ormObj.JobId == "" { return errors.EmptyIdError } + if ormObj.Partition == 0 { + return errors.EmptyIdError + } + if ormObj.Topic == "" { + return errors.EmptyIdError + } + if ormObj.WorkerGroup == "" { + return errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(KafkaJobORMWithBeforeDelete_); ok { if db, err = hook.BeforeDelete_(ctx, db); err != nil { return err @@ -200,159 +213,6 @@ type KafkaJobORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteKafkaJobSet(ctx context.Context, in []*KafkaJob, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.JobId == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.JobId) - } - if hook, ok := (interface{}(&KafkaJobORM{})).(KafkaJobORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("job_id in (?)", keys).Delete(&KafkaJobORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&KafkaJobORM{})).(KafkaJobORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type KafkaJobORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*KafkaJob, *gorm.DB) (*gorm.DB, error) -} -type KafkaJobORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*KafkaJob, *gorm.DB) error -} - -// DefaultStrictUpdateKafkaJob clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateKafkaJob(ctx context.Context, in *KafkaJob, db *gorm.DB) (*KafkaJob, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateKafkaJob") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &KafkaJobORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("job_id=?", ormObj.JobId).First(lockedRow) - if hook, ok := interface{}(&ormObj).(KafkaJobORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(KafkaJobORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(KafkaJobORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type KafkaJobORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type KafkaJobORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type KafkaJobORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchKafkaJob executes a basic gorm update call with patch behavior -func DefaultPatchKafkaJob(ctx context.Context, in *KafkaJob, updateMask *field_mask.FieldMask, db *gorm.DB) (*KafkaJob, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj KafkaJob - var err error - if hook, ok := interface{}(&pbObj).(KafkaJobWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(KafkaJobWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskKafkaJob(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(KafkaJobWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateKafkaJob(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(KafkaJobWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type KafkaJobWithBeforePatchRead interface { - BeforePatchRead(context.Context, *KafkaJob, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type KafkaJobWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *KafkaJob, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type KafkaJobWithBeforePatchSave interface { - BeforePatchSave(context.Context, *KafkaJob, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type KafkaJobWithAfterPatchSave interface { - AfterPatchSave(context.Context, *KafkaJob, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetKafkaJob executes a bulk gorm update call with patch behavior -func DefaultPatchSetKafkaJob(ctx context.Context, objects []*KafkaJob, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*KafkaJob, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*KafkaJob, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchKafkaJob(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskKafkaJob patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskKafkaJob(ctx context.Context, patchee *KafkaJob, patcher *KafkaJob, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*KafkaJob, error) { if patcher == nil { @@ -401,17 +261,13 @@ func DefaultListKafkaJob(ctx context.Context, db *gorm.DB) ([]*KafkaJob, error) return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &KafkaJobORM{}, &KafkaJob{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(KafkaJobORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("partition") + db = db.Order("job_id, partition, topic, worker_group") ormResponse := []KafkaJobORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/log.pb.go b/src/models/log.pb.go index 8b88ca7..abe8c8b 100644 --- a/src/models/log.pb.go +++ b/src/models/log.pb.go @@ -1,148 +1,224 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: log.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 Log struct { - TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` - LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address"` - BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` - Method string `protobuf:"bytes,5,opt,name=method,proto3" json:"method"` - Data string `protobuf:"bytes,9,opt,name=data,proto3" json:"data"` - Indexed string `protobuf:"bytes,10,opt,name=indexed,proto3" json:"indexed"` - BlockTimestamp int64 `protobuf:"varint,11,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp"` -} - -func (m *Log) Reset() { *m = Log{} } -func (m *Log) String() string { return proto.CompactTextString(m) } -func (*Log) ProtoMessage() {} -func (*Log) Descriptor() ([]byte, []int) { - return fileDescriptor_a153da538f858886, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` + LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address"` + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` + Method string `protobuf:"bytes,5,opt,name=method,proto3" json:"method"` + Data string `protobuf:"bytes,9,opt,name=data,proto3" json:"data"` + Indexed string `protobuf:"bytes,10,opt,name=indexed,proto3" json:"indexed"` + BlockTimestamp int64 `protobuf:"varint,11,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp"` +} + +func (x *Log) Reset() { + *x = Log{} + if protoimpl.UnsafeEnabled { + mi := &file_log_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Log) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Log.Unmarshal(m, b) -} -func (m *Log) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Log.Marshal(b, m, deterministic) -} -func (m *Log) XXX_Merge(src proto.Message) { - xxx_messageInfo_Log.Merge(m, src) +func (x *Log) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Log) XXX_Size() int { - return xxx_messageInfo_Log.Size(m) -} -func (m *Log) XXX_DiscardUnknown() { - xxx_messageInfo_Log.DiscardUnknown(m) + +func (*Log) ProtoMessage() {} + +func (x *Log) ProtoReflect() protoreflect.Message { + mi := &file_log_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) } -var xxx_messageInfo_Log proto.InternalMessageInfo +// Deprecated: Use Log.ProtoReflect.Descriptor instead. +func (*Log) Descriptor() ([]byte, []int) { + return file_log_proto_rawDescGZIP(), []int{0} +} -func (m *Log) GetTransactionHash() string { - if m != nil { - return m.TransactionHash +func (x *Log) GetTransactionHash() string { + if x != nil { + return x.TransactionHash } return "" } -func (m *Log) GetLogIndex() int64 { - if m != nil { - return m.LogIndex +func (x *Log) GetLogIndex() int64 { + if x != nil { + return x.LogIndex } return 0 } -func (m *Log) GetAddress() string { - if m != nil { - return m.Address +func (x *Log) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *Log) GetBlockNumber() int64 { - if m != nil { - return m.BlockNumber +func (x *Log) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber } return 0 } -func (m *Log) GetMethod() string { - if m != nil { - return m.Method +func (x *Log) GetMethod() string { + if x != nil { + return x.Method } return "" } -func (m *Log) GetData() string { - if m != nil { - return m.Data +func (x *Log) GetData() string { + if x != nil { + return x.Data } return "" } -func (m *Log) GetIndexed() string { - if m != nil { - return m.Indexed +func (x *Log) GetIndexed() string { + if x != nil { + return x.Indexed } return "" } -func (m *Log) GetBlockTimestamp() int64 { - if m != nil { - return m.BlockTimestamp +func (x *Log) GetBlockTimestamp() int64 { + if x != nil { + return x.BlockTimestamp } return 0 } -func init() { - proto.RegisterType((*Log)(nil), "models.Log") -} - -func init() { - proto.RegisterFile("log.proto", fileDescriptor_a153da538f858886) -} - -var fileDescriptor_a153da538f858886 = []byte{ - // 345 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x91, 0x41, 0x6b, 0xdb, 0x40, - 0x10, 0x85, 0x91, 0xec, 0xca, 0xf2, 0xb8, 0xd8, 0xee, 0xb6, 0xb8, 0xab, 0x62, 0x8a, 0x31, 0x94, - 0xea, 0x62, 0x89, 0xd2, 0x5b, 0x2f, 0x0d, 0x3e, 0x25, 0x90, 0xe4, 0xb0, 0xe4, 0x94, 0x8b, 0x58, - 0x69, 0x37, 0x92, 0x88, 0xa4, 0x11, 0xda, 0x35, 0xf8, 0xaf, 0x49, 0x3f, 0x2e, 0x04, 0xad, 0x2c, - 0x30, 0xb9, 0xed, 0x7b, 0xf3, 0xcd, 0xbc, 0x59, 0x06, 0xe6, 0x05, 0xa6, 0x41, 0xdd, 0xa0, 0x46, - 0xe2, 0x94, 0x28, 0x64, 0xa1, 0x7e, 0xdc, 0xa4, 0xb9, 0xce, 0x4e, 0x71, 0x90, 0x60, 0x19, 0xe6, - 0xd5, 0x0b, 0xc6, 0x05, 0x9e, 0xb1, 0x96, 0x55, 0x68, 0xb0, 0xe4, 0x90, 0xca, 0xea, 0x90, 0x62, - 0x53, 0x0e, 0x3a, 0xc4, 0x5a, 0xe7, 0x58, 0xa9, 0xb0, 0xb7, 0x86, 0x49, 0xfb, 0x37, 0x1b, 0x26, - 0xf7, 0x98, 0x92, 0x07, 0x58, 0xeb, 0x86, 0x57, 0x8a, 0x27, 0x3d, 0x12, 0x65, 0x5c, 0x65, 0xd4, - 0xda, 0x59, 0xfe, 0xfc, 0xb8, 0xef, 0x5a, 0xef, 0x27, 0x6c, 0x7d, 0x8b, 0xd1, 0x02, 0xd3, 0x28, - 0x17, 0xe7, 0xe8, 0x23, 0xc9, 0x56, 0x57, 0xce, 0x2d, 0x57, 0x19, 0xf9, 0x65, 0xb6, 0x8d, 0xf2, - 0x4a, 0xc8, 0x33, 0xb5, 0x77, 0x96, 0x3f, 0x39, 0xba, 0x5d, 0xeb, 0x4d, 0xc1, 0xf6, 0x2d, 0xe6, - 0x16, 0x98, 0xde, 0xf5, 0x15, 0xf2, 0x07, 0x66, 0x5c, 0x88, 0x46, 0x2a, 0x45, 0x27, 0x26, 0xec, - 0x7b, 0xd7, 0x7a, 0x5f, 0xe1, 0x0b, 0x5b, 0x8d, 0x51, 0x97, 0x32, 0x1b, 0x39, 0xf2, 0x1f, 0x3e, - 0xc7, 0x05, 0x26, 0xaf, 0x51, 0x75, 0x2a, 0x63, 0xd9, 0xd0, 0xa9, 0x19, 0xbe, 0xed, 0x5a, 0x8f, - 0xc2, 0x86, 0x7d, 0x1b, 0xfb, 0xae, 0x19, 0xb6, 0x30, 0xea, 0xd1, 0x08, 0x12, 0x80, 0x53, 0x4a, - 0x9d, 0xa1, 0xa0, 0x9f, 0x4c, 0xe4, 0xa6, 0x6b, 0x3d, 0x02, 0x6b, 0xb6, 0x1c, 0x5b, 0x87, 0x2a, - 0xbb, 0x50, 0x84, 0xc0, 0x54, 0x70, 0xcd, 0xe9, 0xbc, 0xa7, 0x99, 0x79, 0x13, 0x0a, 0x33, 0xf3, - 0x35, 0x29, 0x28, 0x18, 0x7b, 0x94, 0xe4, 0x37, 0xac, 0x86, 0x68, 0x9d, 0x97, 0x52, 0x69, 0x5e, - 0xd6, 0x74, 0xd1, 0x6f, 0xc8, 0x96, 0xc6, 0x7e, 0x1a, 0xdd, 0x7f, 0x4e, 0xd7, 0x7a, 0xb6, 0x6b, - 0x1d, 0xe1, 0xd9, 0x0d, 0xc2, 0xe1, 0x9c, 0xb1, 0x63, 0x6e, 0xf2, 0xf7, 0x3d, 0x00, 0x00, 0xff, - 0xff, 0xeb, 0x44, 0x95, 0x1f, 0xea, 0x01, 0x00, 0x00, +var File_log_proto protoreflect.FileDescriptor + +var file_log_proto_rawDesc = []byte{ + 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, + 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfe, 0x02, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12, 0x4d, 0x0a, + 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, + 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xba, 0xb9, 0x19, 0x1e, 0x0a, 0x1c, 0x28, + 0x01, 0x52, 0x18, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x52, 0x0f, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x0a, 0x09, + 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, + 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x49, 0x6e, + 0x64, 0x65, 0x78, 0x12, 0x31, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x17, 0xba, 0xb9, 0x19, 0x13, 0x0a, 0x11, 0x52, 0x0f, 0x6c, 0x6f, + 0x67, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3f, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x42, 0x1c, 0xba, 0xb9, + 0x19, 0x18, 0x0a, 0x16, 0x52, 0x14, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, + 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x16, 0xba, 0xb9, 0x19, 0x12, 0x0a, 0x10, 0x52, + 0x0e, 0x6c, 0x6f, 0x67, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x52, + 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, + 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x69, 0x6e, + 0x64, 0x65, 0x78, 0x65, 0x64, 0x12, 0x27, 0x0a, 0x0f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, + 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x3a, 0x06, + 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_log_proto_rawDescOnce sync.Once + file_log_proto_rawDescData = file_log_proto_rawDesc +) + +func file_log_proto_rawDescGZIP() []byte { + file_log_proto_rawDescOnce.Do(func() { + file_log_proto_rawDescData = protoimpl.X.CompressGZIP(file_log_proto_rawDescData) + }) + return file_log_proto_rawDescData +} + +var file_log_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_log_proto_goTypes = []interface{}{ + (*Log)(nil), // 0: models.Log +} +var file_log_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_log_proto_init() } +func file_log_proto_init() { + if File_log_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_log_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Log); 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_log_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_log_proto_goTypes, + DependencyIndexes: file_log_proto_depIdxs, + MessageInfos: file_log_proto_msgTypes, + }.Build() + File_log_proto = out.File + file_log_proto_rawDesc = nil + file_log_proto_goTypes = nil + file_log_proto_depIdxs = nil } diff --git a/src/models/log.pb.gorm.go b/src/models/log.pb.gorm.go index 18cb09e..77d96c6 100644 --- a/src/models/log.pb.gorm.go +++ b/src/models/log.pb.gorm.go @@ -2,11 +2,9 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type LogORM struct { @@ -15,9 +13,9 @@ type LogORM struct { BlockTimestamp int64 Data string Indexed string - LogIndex int64 `gorm:"primary_key"` + LogIndex int64 `gorm:"primaryKey"` Method string `gorm:"index:log_idx_method"` - TransactionHash string `gorm:"primary_key;index:log_idx_transaction_hash"` + TransactionHash string `gorm:"primaryKey;index:log_idx_transaction_hash"` } // TableName overrides the default tablename generated by GORM @@ -110,7 +108,7 @@ func DefaultCreateLog(ctx context.Context, in *Log, db *gorm.DB) (*Log, error) { return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(LogORMWithAfterCreate_); ok { @@ -137,6 +135,9 @@ func DefaultReadLog(ctx context.Context, in *Log, db *gorm.DB) (*Log, error) { if err != nil { return nil, err } + if ormObj.LogIndex == 0 { + return nil, errors.EmptyIdError + } if ormObj.TransactionHash == "" { return nil, errors.EmptyIdError } @@ -145,9 +146,6 @@ func DefaultReadLog(ctx context.Context, in *Log, db *gorm.DB) (*Log, error) { return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &LogORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(LogORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -187,6 +185,9 @@ func DefaultDeleteLog(ctx context.Context, in *Log, db *gorm.DB) error { if ormObj.LogIndex == 0 { return errors.EmptyIdError } + if ormObj.TransactionHash == "" { + return errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(LogORMWithBeforeDelete_); ok { if db, err = hook.BeforeDelete_(ctx, db); err != nil { return err @@ -209,159 +210,6 @@ type LogORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteLogSet(ctx context.Context, in []*Log, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.TransactionHash == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.TransactionHash) - } - if hook, ok := (interface{}(&LogORM{})).(LogORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("transaction_hash in (?)", keys).Delete(&LogORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&LogORM{})).(LogORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type LogORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*Log, *gorm.DB) (*gorm.DB, error) -} -type LogORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*Log, *gorm.DB) error -} - -// DefaultStrictUpdateLog clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateLog(ctx context.Context, in *Log, db *gorm.DB) (*Log, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateLog") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &LogORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("transaction_hash=?", ormObj.TransactionHash).First(lockedRow) - if hook, ok := interface{}(&ormObj).(LogORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(LogORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(LogORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type LogORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type LogORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type LogORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchLog executes a basic gorm update call with patch behavior -func DefaultPatchLog(ctx context.Context, in *Log, updateMask *field_mask.FieldMask, db *gorm.DB) (*Log, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj Log - var err error - if hook, ok := interface{}(&pbObj).(LogWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(LogWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskLog(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(LogWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateLog(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(LogWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type LogWithBeforePatchRead interface { - BeforePatchRead(context.Context, *Log, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type LogWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *Log, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type LogWithBeforePatchSave interface { - BeforePatchSave(context.Context, *Log, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type LogWithAfterPatchSave interface { - AfterPatchSave(context.Context, *Log, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetLog executes a bulk gorm update call with patch behavior -func DefaultPatchSetLog(ctx context.Context, objects []*Log, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*Log, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*Log, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchLog(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskLog patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskLog(ctx context.Context, patchee *Log, patcher *Log, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*Log, error) { if patcher == nil { @@ -422,17 +270,13 @@ func DefaultListLog(ctx context.Context, db *gorm.DB) ([]*Log, error) { return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &LogORM{}, &Log{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(LogORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("transaction_hash") + db = db.Order("log_index, transaction_hash") ormResponse := []LogORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/missing_block.pb.go b/src/models/missing_block.pb.go index 494ac73..6f332c0 100644 --- a/src/models/missing_block.pb.go +++ b/src/models/missing_block.pb.go @@ -1,81 +1,148 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: missing_block.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 MissingBlock struct { - Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *MissingBlock) Reset() { *m = MissingBlock{} } -func (m *MissingBlock) String() string { return proto.CompactTextString(m) } -func (*MissingBlock) ProtoMessage() {} -func (*MissingBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_cd13a7fa3e989aad, []int{0} + Number int64 `protobuf:"varint,1,opt,name=number,proto3" json:"number"` } -func (m *MissingBlock) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_MissingBlock.Unmarshal(m, b) -} -func (m *MissingBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_MissingBlock.Marshal(b, m, deterministic) -} -func (m *MissingBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_MissingBlock.Merge(m, src) +func (x *MissingBlock) Reset() { + *x = MissingBlock{} + if protoimpl.UnsafeEnabled { + mi := &file_missing_block_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *MissingBlock) XXX_Size() int { - return xxx_messageInfo_MissingBlock.Size(m) + +func (x *MissingBlock) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *MissingBlock) XXX_DiscardUnknown() { - xxx_messageInfo_MissingBlock.DiscardUnknown(m) + +func (*MissingBlock) ProtoMessage() {} + +func (x *MissingBlock) ProtoReflect() protoreflect.Message { + mi := &file_missing_block_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) } -var xxx_messageInfo_MissingBlock proto.InternalMessageInfo +// Deprecated: Use MissingBlock.ProtoReflect.Descriptor instead. +func (*MissingBlock) Descriptor() ([]byte, []int) { + return file_missing_block_proto_rawDescGZIP(), []int{0} +} -func (m *MissingBlock) GetNumber() int64 { - if m != nil { - return m.Number +func (x *MissingBlock) GetNumber() int64 { + if x != nil { + return x.Number } return 0 } -func init() { - proto.RegisterType((*MissingBlock)(nil), "models.MissingBlock") +var File_missing_block_proto protoreflect.FileDescriptor + +var file_missing_block_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, + 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, + 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x38, 0x0a, 0x0c, 0x4d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, + 0x20, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x42, + 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x3a, 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, + 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_missing_block_proto_rawDescOnce sync.Once + file_missing_block_proto_rawDescData = file_missing_block_proto_rawDesc +) + +func file_missing_block_proto_rawDescGZIP() []byte { + file_missing_block_proto_rawDescOnce.Do(func() { + file_missing_block_proto_rawDescData = protoimpl.X.CompressGZIP(file_missing_block_proto_rawDescData) + }) + return file_missing_block_proto_rawDescData } -func init() { - proto.RegisterFile("missing_block.proto", fileDescriptor_cd13a7fa3e989aad) +var file_missing_block_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_missing_block_proto_goTypes = []interface{}{ + (*MissingBlock)(nil), // 0: models.MissingBlock +} +var file_missing_block_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 } -var fileDescriptor_cd13a7fa3e989aad = []byte{ - // 167 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xce, 0xcd, 0x2c, 0x2e, - 0xce, 0xcc, 0x4b, 0x8f, 0x4f, 0xca, 0xc9, 0x4f, 0xce, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x62, 0xcb, 0xcd, 0x4f, 0x49, 0xcd, 0x29, 0x96, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, - 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcc, 0x4b, 0xcb, 0x4f, 0xca, 0xc9, 0xaf, 0xc8, 0x2f, 0x48, 0xcd, - 0xd3, 0x07, 0x2b, 0x4b, 0xd6, 0x4d, 0x4f, 0xcd, 0xd3, 0x4d, 0xcf, 0x2f, 0xca, 0x85, 0xf0, 0xf5, - 0xf3, 0x0b, 0x4a, 0x32, 0xf3, 0xf3, 0x8a, 0xf5, 0x41, 0x42, 0x10, 0x93, 0x94, 0x2c, 0xb8, 0x78, - 0x7c, 0x21, 0x16, 0x38, 0x81, 0xcc, 0x17, 0x52, 0xe0, 0x62, 0xcb, 0x2b, 0xcd, 0x4d, 0x4a, 0x2d, - 0x92, 0x60, 0x54, 0x60, 0xd4, 0x60, 0x76, 0xe2, 0xd8, 0xb5, 0x53, 0x92, 0x85, 0x8b, 0x49, 0x83, - 0x31, 0x08, 0x2a, 0x6e, 0xc5, 0xb6, 0x6b, 0xa7, 0x24, 0x13, 0x07, 0xa3, 0x13, 0x57, 0x14, 0x87, - 0x9e, 0x3e, 0xc4, 0x1d, 0x49, 0x6c, 0x60, 0xc3, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x94, - 0x2c, 0x48, 0x66, 0xad, 0x00, 0x00, 0x00, +func init() { file_missing_block_proto_init() } +func file_missing_block_proto_init() { + if File_missing_block_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_missing_block_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MissingBlock); 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_missing_block_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_missing_block_proto_goTypes, + DependencyIndexes: file_missing_block_proto_depIdxs, + MessageInfos: file_missing_block_proto_msgTypes, + }.Build() + File_missing_block_proto = out.File + file_missing_block_proto_rawDesc = nil + file_missing_block_proto_goTypes = nil + file_missing_block_proto_depIdxs = nil } diff --git a/src/models/missing_block.pb.gorm.go b/src/models/missing_block.pb.gorm.go index c70e6a3..eb0d6bb 100644 --- a/src/models/missing_block.pb.gorm.go +++ b/src/models/missing_block.pb.gorm.go @@ -3,14 +3,13 @@ package models import ( context "context" fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type MissingBlockORM struct { - Number int64 `gorm:"primary_key"` + Number int64 `gorm:"primaryKey"` } // TableName overrides the default tablename generated by GORM @@ -89,7 +88,7 @@ func DefaultCreateMissingBlock(ctx context.Context, in *MissingBlock, db *gorm.D return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(MissingBlockORMWithAfterCreate_); ok { @@ -124,9 +123,6 @@ func DefaultReadMissingBlock(ctx context.Context, in *MissingBlock, db *gorm.DB) return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &MissingBlockORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(MissingBlockORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -247,7 +243,7 @@ func DefaultStrictUpdateMissingBlock(ctx context.Context, in *MissingBlock, db * return nil, err } } - if err = db.Save(&ormObj).Error; err != nil { + if err = db.Omit().Save(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(MissingBlockORMWithAfterStrictUpdateSave); ok { @@ -373,10 +369,6 @@ func DefaultListMissingBlock(ctx context.Context, db *gorm.DB) ([]*MissingBlock, return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &MissingBlockORM{}, &MissingBlock{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(MissingBlockORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err diff --git a/src/models/redis_key.pb.go b/src/models/redis_key.pb.go index 943ff03..33ef5fa 100644 --- a/src/models/redis_key.pb.go +++ b/src/models/redis_key.pb.go @@ -1,89 +1,157 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: redis_key.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 RedisKey struct { - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key"` - Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *RedisKey) Reset() { *m = RedisKey{} } -func (m *RedisKey) String() string { return proto.CompactTextString(m) } -func (*RedisKey) ProtoMessage() {} -func (*RedisKey) Descriptor() ([]byte, []int) { - return fileDescriptor_6372d2fc66782fd8, []int{0} + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key"` + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value"` } -func (m *RedisKey) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_RedisKey.Unmarshal(m, b) -} -func (m *RedisKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_RedisKey.Marshal(b, m, deterministic) -} -func (m *RedisKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_RedisKey.Merge(m, src) +func (x *RedisKey) Reset() { + *x = RedisKey{} + if protoimpl.UnsafeEnabled { + mi := &file_redis_key_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *RedisKey) XXX_Size() int { - return xxx_messageInfo_RedisKey.Size(m) + +func (x *RedisKey) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *RedisKey) XXX_DiscardUnknown() { - xxx_messageInfo_RedisKey.DiscardUnknown(m) + +func (*RedisKey) ProtoMessage() {} + +func (x *RedisKey) ProtoReflect() protoreflect.Message { + mi := &file_redis_key_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) } -var xxx_messageInfo_RedisKey proto.InternalMessageInfo +// Deprecated: Use RedisKey.ProtoReflect.Descriptor instead. +func (*RedisKey) Descriptor() ([]byte, []int) { + return file_redis_key_proto_rawDescGZIP(), []int{0} +} -func (m *RedisKey) GetKey() string { - if m != nil { - return m.Key +func (x *RedisKey) GetKey() string { + if x != nil { + return x.Key } return "" } -func (m *RedisKey) GetValue() string { - if m != nil { - return m.Value +func (x *RedisKey) GetValue() string { + if x != nil { + return x.Value } return "" } -func init() { - proto.RegisterType((*RedisKey)(nil), "models.RedisKey") +var File_redis_key_proto protoreflect.FileDescriptor + +var file_redis_key_proto_rawDesc = []byte{ + 0x0a, 0x0f, 0x72, 0x65, 0x64, 0x69, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, + 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x08, 0x52, + 0x65, 0x64, 0x69, 0x73, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 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, 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, + 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_redis_key_proto_rawDescOnce sync.Once + file_redis_key_proto_rawDescData = file_redis_key_proto_rawDesc +) + +func file_redis_key_proto_rawDescGZIP() []byte { + file_redis_key_proto_rawDescOnce.Do(func() { + file_redis_key_proto_rawDescData = protoimpl.X.CompressGZIP(file_redis_key_proto_rawDescData) + }) + return file_redis_key_proto_rawDescData } -func init() { - proto.RegisterFile("redis_key.proto", fileDescriptor_6372d2fc66782fd8) +var file_redis_key_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_redis_key_proto_goTypes = []interface{}{ + (*RedisKey)(nil), // 0: models.RedisKey +} +var file_redis_key_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 } -var fileDescriptor_6372d2fc66782fd8 = []byte{ - // 175 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xe2, 0x2f, 0x4a, 0x4d, 0xc9, - 0x2c, 0x8e, 0xcf, 0x4e, 0xad, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcb, 0xcd, 0x4f, - 0x49, 0xcd, 0x29, 0x96, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, - 0xcf, 0xcc, 0x4b, 0xcb, 0x4f, 0xca, 0xc9, 0xaf, 0xc8, 0x2f, 0x48, 0xcd, 0xd3, 0x07, 0x2b, 0x4b, - 0xd6, 0x4d, 0x4f, 0xcd, 0xd3, 0x4d, 0xcf, 0x2f, 0xca, 0x85, 0xf0, 0xf5, 0xf3, 0x0b, 0x4a, 0x32, - 0xf3, 0xf3, 0x8a, 0xf5, 0x41, 0x42, 0x10, 0x93, 0x94, 0x5c, 0xb8, 0x38, 0x82, 0x40, 0x86, 0x7b, - 0xa7, 0x56, 0x0a, 0x49, 0x71, 0x31, 0x67, 0xa7, 0x56, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, - 0x71, 0xec, 0xda, 0x29, 0xc9, 0xc2, 0xc5, 0xa4, 0xc1, 0x18, 0x04, 0x12, 0x14, 0x12, 0xe1, 0x62, - 0x2d, 0x4b, 0xcc, 0x29, 0x4d, 0x95, 0x60, 0x02, 0xc9, 0x06, 0x41, 0x38, 0x56, 0x6c, 0xbb, 0x76, - 0x4a, 0x32, 0x71, 0x30, 0x3a, 0x71, 0x45, 0x71, 0xe8, 0xe9, 0x43, 0xdc, 0x94, 0xc4, 0x06, 0x36, - 0xd8, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x9b, 0xd4, 0x83, 0xaa, 0xb5, 0x00, 0x00, 0x00, +func init() { file_redis_key_proto_init() } +func file_redis_key_proto_init() { + if File_redis_key_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_redis_key_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RedisKey); 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_redis_key_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_redis_key_proto_goTypes, + DependencyIndexes: file_redis_key_proto_depIdxs, + MessageInfos: file_redis_key_proto_msgTypes, + }.Build() + File_redis_key_proto = out.File + file_redis_key_proto_rawDesc = nil + file_redis_key_proto_goTypes = nil + file_redis_key_proto_depIdxs = nil } diff --git a/src/models/redis_key.pb.gorm.go b/src/models/redis_key.pb.gorm.go index cd6fb8e..9630b22 100644 --- a/src/models/redis_key.pb.gorm.go +++ b/src/models/redis_key.pb.gorm.go @@ -3,14 +3,13 @@ package models import ( context "context" fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type RedisKeyORM struct { - Key string `gorm:"primary_key"` + Key string `gorm:"primaryKey"` Value string } @@ -92,7 +91,7 @@ func DefaultCreateRedisKey(ctx context.Context, in *RedisKey, db *gorm.DB) (*Red return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(RedisKeyORMWithAfterCreate_); ok { @@ -127,9 +126,6 @@ func DefaultReadRedisKey(ctx context.Context, in *RedisKey, db *gorm.DB) (*Redis return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &RedisKeyORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(RedisKeyORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -250,7 +246,7 @@ func DefaultStrictUpdateRedisKey(ctx context.Context, in *RedisKey, db *gorm.DB) return nil, err } } - if err = db.Save(&ormObj).Error; err != nil { + if err = db.Omit().Save(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(RedisKeyORMWithAfterStrictUpdateSave); ok { @@ -380,10 +376,6 @@ func DefaultListRedisKey(ctx context.Context, db *gorm.DB) ([]*RedisKey, error) return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &RedisKeyORM{}, &RedisKey{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(RedisKeyORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err diff --git a/src/models/token_address.pb.go b/src/models/token_address.pb.go index 8c78782..6a06e8b 100644 --- a/src/models/token_address.pb.go +++ b/src/models/token_address.pb.go @@ -1,102 +1,175 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: token_address.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 TokenAddress struct { - Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address"` - TokenContractAddress string `protobuf:"bytes,2,opt,name=token_contract_address,json=tokenContractAddress,proto3" json:"token_contract_address"` - Balance float64 `protobuf:"fixed64,3,opt,name=balance,proto3" json:"balance"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *TokenAddress) Reset() { *m = TokenAddress{} } -func (m *TokenAddress) String() string { return proto.CompactTextString(m) } -func (*TokenAddress) ProtoMessage() {} -func (*TokenAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_b7e686e5317797f7, []int{0} + Address string `protobuf:"bytes,1,opt,name=address,proto3" json:"address"` + TokenContractAddress string `protobuf:"bytes,2,opt,name=token_contract_address,json=tokenContractAddress,proto3" json:"token_contract_address"` + Balance float64 `protobuf:"fixed64,3,opt,name=balance,proto3" json:"balance"` } -func (m *TokenAddress) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TokenAddress.Unmarshal(m, b) -} -func (m *TokenAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TokenAddress.Marshal(b, m, deterministic) -} -func (m *TokenAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_TokenAddress.Merge(m, src) +func (x *TokenAddress) Reset() { + *x = TokenAddress{} + if protoimpl.UnsafeEnabled { + mi := &file_token_address_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TokenAddress) XXX_Size() int { - return xxx_messageInfo_TokenAddress.Size(m) + +func (x *TokenAddress) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TokenAddress) XXX_DiscardUnknown() { - xxx_messageInfo_TokenAddress.DiscardUnknown(m) + +func (*TokenAddress) ProtoMessage() {} + +func (x *TokenAddress) ProtoReflect() protoreflect.Message { + mi := &file_token_address_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) } -var xxx_messageInfo_TokenAddress proto.InternalMessageInfo +// Deprecated: Use TokenAddress.ProtoReflect.Descriptor instead. +func (*TokenAddress) Descriptor() ([]byte, []int) { + return file_token_address_proto_rawDescGZIP(), []int{0} +} -func (m *TokenAddress) GetAddress() string { - if m != nil { - return m.Address +func (x *TokenAddress) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *TokenAddress) GetTokenContractAddress() string { - if m != nil { - return m.TokenContractAddress +func (x *TokenAddress) GetTokenContractAddress() string { + if x != nil { + return x.TokenContractAddress } return "" } -func (m *TokenAddress) GetBalance() float64 { - if m != nil { - return m.Balance +func (x *TokenAddress) GetBalance() float64 { + if x != nil { + return x.Balance } return 0 } -func init() { - proto.RegisterType((*TokenAddress)(nil), "models.TokenAddress") +var File_token_address_proto protoreflect.FileDescriptor + +var file_token_address_proto_rawDesc = []byte{ + 0x0a, 0x13, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, + 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, + 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, + 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0xe1, 0x01, 0x0a, 0x0c, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x12, 0x22, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x12, 0x68, 0x0a, 0x16, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6f, + 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x32, 0xba, 0xb9, 0x19, 0x2e, 0x0a, 0x2c, 0x28, 0x01, 0x52, 0x28, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, + 0x78, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x14, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, + 0x0a, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x01, 0x42, + 0x21, 0xba, 0xb9, 0x19, 0x1d, 0x0a, 0x1b, 0x52, 0x19, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x62, 0x61, 0x6c, 0x61, 0x6e, + 0x63, 0x65, 0x52, 0x07, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x3a, 0x06, 0xba, 0xb9, 0x19, + 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_token_address_proto_rawDescOnce sync.Once + file_token_address_proto_rawDescData = file_token_address_proto_rawDesc +) + +func file_token_address_proto_rawDescGZIP() []byte { + file_token_address_proto_rawDescOnce.Do(func() { + file_token_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_token_address_proto_rawDescData) + }) + return file_token_address_proto_rawDescData } -func init() { - proto.RegisterFile("token_address.proto", fileDescriptor_b7e686e5317797f7) +var file_token_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_token_address_proto_goTypes = []interface{}{ + (*TokenAddress)(nil), // 0: models.TokenAddress +} +var file_token_address_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 } -var fileDescriptor_b7e686e5317797f7 = []byte{ - // 245 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x90, 0x4f, 0x4e, 0x84, 0x30, - 0x14, 0xc6, 0xf3, 0xd0, 0x30, 0xf8, 0xe2, 0x0a, 0x8d, 0xa1, 0x1a, 0x93, 0x71, 0x56, 0x5d, 0x38, - 0x34, 0xd1, 0x9d, 0x6e, 0x14, 0x6f, 0xd0, 0xb8, 0x72, 0x43, 0xa0, 0x54, 0x86, 0x08, 0x7d, 0x04, - 0x6a, 0x32, 0x57, 0x83, 0xdb, 0x78, 0x13, 0x33, 0x14, 0x16, 0xc6, 0x59, 0xf6, 0xeb, 0xf7, 0xe7, - 0xd7, 0xe2, 0x85, 0xa5, 0x2f, 0x6d, 0xd2, 0xac, 0x28, 0x3a, 0xdd, 0xf7, 0x71, 0xdb, 0x91, 0xa5, - 0xd0, 0x6f, 0xa8, 0xd0, 0x75, 0x7f, 0xfd, 0x52, 0x56, 0x76, 0xf7, 0x9d, 0xc7, 0x8a, 0x1a, 0x51, - 0x99, 0x4f, 0xca, 0x6b, 0xda, 0x53, 0xab, 0x8d, 0x98, 0x6c, 0x6a, 0x5b, 0x6a, 0xb3, 0x2d, 0xa9, - 0x6b, 0xdc, 0x59, 0x50, 0x6b, 0x2b, 0x32, 0xbd, 0x38, 0x48, 0xae, 0x69, 0xf3, 0x03, 0x78, 0xfe, - 0x7e, 0x58, 0x78, 0x75, 0x03, 0xe1, 0x06, 0x57, 0xf3, 0x56, 0x04, 0x6b, 0xe0, 0x67, 0x49, 0x30, - 0x0e, 0xec, 0x14, 0x3d, 0x0e, 0x72, 0xb9, 0x08, 0x77, 0x78, 0xe5, 0xa8, 0x14, 0x19, 0xdb, 0x65, - 0xca, 0x2e, 0x78, 0x91, 0x37, 0x45, 0x1e, 0xc6, 0x81, 0xc5, 0x78, 0xcf, 0x41, 0xf2, 0x3f, 0xf4, - 0x69, 0x55, 0xec, 0xd3, 0xe3, 0x49, 0x79, 0x39, 0xe9, 0x6f, 0xb3, 0xbc, 0xd0, 0x3c, 0xe3, 0x2a, - 0xcf, 0xea, 0xcc, 0x28, 0x1d, 0x9d, 0xac, 0x81, 0x43, 0x72, 0x37, 0x0e, 0xec, 0x16, 0x6f, 0x24, - 0xfb, 0x5f, 0x3c, 0x1b, 0xe5, 0x92, 0x78, 0xf2, 0xc7, 0x81, 0x79, 0x01, 0x24, 0xf8, 0x11, 0xc4, - 0xc2, 0xfd, 0x58, 0xee, 0x4f, 0xcf, 0x7e, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x67, 0x4c, 0x2f, - 0x03, 0x57, 0x01, 0x00, 0x00, +func init() { file_token_address_proto_init() } +func file_token_address_proto_init() { + if File_token_address_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_token_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TokenAddress); 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_token_address_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_token_address_proto_goTypes, + DependencyIndexes: file_token_address_proto_depIdxs, + MessageInfos: file_token_address_proto_msgTypes, + }.Build() + File_token_address_proto = out.File + file_token_address_proto_rawDesc = nil + file_token_address_proto_goTypes = nil + file_token_address_proto_depIdxs = nil } diff --git a/src/models/token_address.pb.gorm.go b/src/models/token_address.pb.gorm.go index 023626b..d0c35fd 100644 --- a/src/models/token_address.pb.gorm.go +++ b/src/models/token_address.pb.gorm.go @@ -2,17 +2,15 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type TokenAddressORM struct { - Address string `gorm:"primary_key"` + Address string `gorm:"primaryKey"` Balance float64 `gorm:"index:token_address_idx_balance"` - TokenContractAddress string `gorm:"primary_key;index:token_address_idx_token_contract_address"` + TokenContractAddress string `gorm:"primaryKey;index:token_address_idx_token_contract_address"` } // TableName overrides the default tablename generated by GORM @@ -95,7 +93,7 @@ func DefaultCreateTokenAddress(ctx context.Context, in *TokenAddress, db *gorm.D return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TokenAddressORMWithAfterCreate_); ok { @@ -125,14 +123,14 @@ func DefaultReadTokenAddress(ctx context.Context, in *TokenAddress, db *gorm.DB) if ormObj.Address == "" { return nil, errors.EmptyIdError } + if ormObj.TokenContractAddress == "" { + return nil, errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(TokenAddressORMWithBeforeReadApplyQuery); ok { if db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil { return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &TokenAddressORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TokenAddressORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -172,6 +170,9 @@ func DefaultDeleteTokenAddress(ctx context.Context, in *TokenAddress, db *gorm.D if ormObj.Address == "" { return errors.EmptyIdError } + if ormObj.TokenContractAddress == "" { + return errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(TokenAddressORMWithBeforeDelete_); ok { if db, err = hook.BeforeDelete_(ctx, db); err != nil { return err @@ -194,159 +195,6 @@ type TokenAddressORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteTokenAddressSet(ctx context.Context, in []*TokenAddress, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.Address == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.Address) - } - if hook, ok := (interface{}(&TokenAddressORM{})).(TokenAddressORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("address in (?)", keys).Delete(&TokenAddressORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&TokenAddressORM{})).(TokenAddressORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type TokenAddressORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*TokenAddress, *gorm.DB) (*gorm.DB, error) -} -type TokenAddressORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*TokenAddress, *gorm.DB) error -} - -// DefaultStrictUpdateTokenAddress clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateTokenAddress(ctx context.Context, in *TokenAddress, db *gorm.DB) (*TokenAddress, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateTokenAddress") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &TokenAddressORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("address=?", ormObj.Address).First(lockedRow) - if hook, ok := interface{}(&ormObj).(TokenAddressORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(TokenAddressORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(TokenAddressORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type TokenAddressORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TokenAddressORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TokenAddressORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchTokenAddress executes a basic gorm update call with patch behavior -func DefaultPatchTokenAddress(ctx context.Context, in *TokenAddress, updateMask *field_mask.FieldMask, db *gorm.DB) (*TokenAddress, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj TokenAddress - var err error - if hook, ok := interface{}(&pbObj).(TokenAddressWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(TokenAddressWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskTokenAddress(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(TokenAddressWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateTokenAddress(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(TokenAddressWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type TokenAddressWithBeforePatchRead interface { - BeforePatchRead(context.Context, *TokenAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenAddressWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *TokenAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenAddressWithBeforePatchSave interface { - BeforePatchSave(context.Context, *TokenAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenAddressWithAfterPatchSave interface { - AfterPatchSave(context.Context, *TokenAddress, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetTokenAddress executes a bulk gorm update call with patch behavior -func DefaultPatchSetTokenAddress(ctx context.Context, objects []*TokenAddress, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*TokenAddress, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*TokenAddress, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchTokenAddress(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskTokenAddress patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskTokenAddress(ctx context.Context, patchee *TokenAddress, patcher *TokenAddress, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*TokenAddress, error) { if patcher == nil { @@ -387,17 +235,13 @@ func DefaultListTokenAddress(ctx context.Context, db *gorm.DB) ([]*TokenAddress, return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &TokenAddressORM{}, &TokenAddress{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TokenAddressORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("address") + db = db.Order("address, token_contract_address") ormResponse := []TokenAddressORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/token_transfer.pb.go b/src/models/token_transfer.pb.go index 69da472..b717a4b 100644 --- a/src/models/token_transfer.pb.go +++ b/src/models/token_transfer.pb.go @@ -1,204 +1,299 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: token_transfer.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 TokenTransfer struct { - TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` - LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` - TokenContractAddress string `protobuf:"bytes,3,opt,name=token_contract_address,json=tokenContractAddress,proto3" json:"token_contract_address"` - FromAddress string `protobuf:"bytes,4,opt,name=from_address,json=fromAddress,proto3" json:"from_address"` - ToAddress string `protobuf:"bytes,5,opt,name=to_address,json=toAddress,proto3" json:"to_address"` - BlockNumber int64 `protobuf:"varint,6,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` - Value string `protobuf:"bytes,7,opt,name=value,proto3" json:"value"` - ValueDecimal float64 `protobuf:"fixed64,8,opt,name=value_decimal,json=valueDecimal,proto3" json:"value_decimal"` - BlockTimestamp int64 `protobuf:"varint,9,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp"` - TokenContractName string `protobuf:"bytes,10,opt,name=token_contract_name,json=tokenContractName,proto3" json:"token_contract_name"` - TokenContractSymbol string `protobuf:"bytes,11,opt,name=token_contract_symbol,json=tokenContractSymbol,proto3" json:"token_contract_symbol"` - TransactionFee string `protobuf:"bytes,12,opt,name=transaction_fee,json=transactionFee,proto3" json:"transaction_fee"` - NftId int64 `protobuf:"varint,13,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` - TransactionIndex int64 `protobuf:"varint,14,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` -} - -func (m *TokenTransfer) Reset() { *m = TokenTransfer{} } -func (m *TokenTransfer) String() string { return proto.CompactTextString(m) } -func (*TokenTransfer) ProtoMessage() {} -func (*TokenTransfer) Descriptor() ([]byte, []int) { - return fileDescriptor_4dee5df8e2b2416f, []int{0} -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *TokenTransfer) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TokenTransfer.Unmarshal(m, b) + TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` + LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` + TokenContractAddress string `protobuf:"bytes,3,opt,name=token_contract_address,json=tokenContractAddress,proto3" json:"token_contract_address"` + FromAddress string `protobuf:"bytes,4,opt,name=from_address,json=fromAddress,proto3" json:"from_address"` + ToAddress string `protobuf:"bytes,5,opt,name=to_address,json=toAddress,proto3" json:"to_address"` + BlockNumber int64 `protobuf:"varint,6,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` + Value string `protobuf:"bytes,7,opt,name=value,proto3" json:"value"` + ValueDecimal float64 `protobuf:"fixed64,8,opt,name=value_decimal,json=valueDecimal,proto3" json:"value_decimal"` + BlockTimestamp int64 `protobuf:"varint,9,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp"` + TokenContractName string `protobuf:"bytes,10,opt,name=token_contract_name,json=tokenContractName,proto3" json:"token_contract_name"` + TokenContractSymbol string `protobuf:"bytes,11,opt,name=token_contract_symbol,json=tokenContractSymbol,proto3" json:"token_contract_symbol"` + TransactionFee string `protobuf:"bytes,12,opt,name=transaction_fee,json=transactionFee,proto3" json:"transaction_fee"` + NftId int64 `protobuf:"varint,13,opt,name=nft_id,json=nftId,proto3" json:"nft_id"` + TransactionIndex int64 `protobuf:"varint,14,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` } -func (m *TokenTransfer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TokenTransfer.Marshal(b, m, deterministic) -} -func (m *TokenTransfer) XXX_Merge(src proto.Message) { - xxx_messageInfo_TokenTransfer.Merge(m, src) + +func (x *TokenTransfer) Reset() { + *x = TokenTransfer{} + if protoimpl.UnsafeEnabled { + mi := &file_token_transfer_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TokenTransfer) XXX_Size() int { - return xxx_messageInfo_TokenTransfer.Size(m) + +func (x *TokenTransfer) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TokenTransfer) XXX_DiscardUnknown() { - xxx_messageInfo_TokenTransfer.DiscardUnknown(m) + +func (*TokenTransfer) ProtoMessage() {} + +func (x *TokenTransfer) ProtoReflect() protoreflect.Message { + mi := &file_token_transfer_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) } -var xxx_messageInfo_TokenTransfer proto.InternalMessageInfo +// Deprecated: Use TokenTransfer.ProtoReflect.Descriptor instead. +func (*TokenTransfer) Descriptor() ([]byte, []int) { + return file_token_transfer_proto_rawDescGZIP(), []int{0} +} -func (m *TokenTransfer) GetTransactionHash() string { - if m != nil { - return m.TransactionHash +func (x *TokenTransfer) GetTransactionHash() string { + if x != nil { + return x.TransactionHash } return "" } -func (m *TokenTransfer) GetLogIndex() int64 { - if m != nil { - return m.LogIndex +func (x *TokenTransfer) GetLogIndex() int64 { + if x != nil { + return x.LogIndex } return 0 } -func (m *TokenTransfer) GetTokenContractAddress() string { - if m != nil { - return m.TokenContractAddress +func (x *TokenTransfer) GetTokenContractAddress() string { + if x != nil { + return x.TokenContractAddress } return "" } -func (m *TokenTransfer) GetFromAddress() string { - if m != nil { - return m.FromAddress +func (x *TokenTransfer) GetFromAddress() string { + if x != nil { + return x.FromAddress } return "" } -func (m *TokenTransfer) GetToAddress() string { - if m != nil { - return m.ToAddress +func (x *TokenTransfer) GetToAddress() string { + if x != nil { + return x.ToAddress } return "" } -func (m *TokenTransfer) GetBlockNumber() int64 { - if m != nil { - return m.BlockNumber +func (x *TokenTransfer) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber } return 0 } -func (m *TokenTransfer) GetValue() string { - if m != nil { - return m.Value +func (x *TokenTransfer) GetValue() string { + if x != nil { + return x.Value } return "" } -func (m *TokenTransfer) GetValueDecimal() float64 { - if m != nil { - return m.ValueDecimal +func (x *TokenTransfer) GetValueDecimal() float64 { + if x != nil { + return x.ValueDecimal } return 0 } -func (m *TokenTransfer) GetBlockTimestamp() int64 { - if m != nil { - return m.BlockTimestamp +func (x *TokenTransfer) GetBlockTimestamp() int64 { + if x != nil { + return x.BlockTimestamp } return 0 } -func (m *TokenTransfer) GetTokenContractName() string { - if m != nil { - return m.TokenContractName +func (x *TokenTransfer) GetTokenContractName() string { + if x != nil { + return x.TokenContractName } return "" } -func (m *TokenTransfer) GetTokenContractSymbol() string { - if m != nil { - return m.TokenContractSymbol +func (x *TokenTransfer) GetTokenContractSymbol() string { + if x != nil { + return x.TokenContractSymbol } return "" } -func (m *TokenTransfer) GetTransactionFee() string { - if m != nil { - return m.TransactionFee +func (x *TokenTransfer) GetTransactionFee() string { + if x != nil { + return x.TransactionFee } return "" } -func (m *TokenTransfer) GetNftId() int64 { - if m != nil { - return m.NftId +func (x *TokenTransfer) GetNftId() int64 { + if x != nil { + return x.NftId } return 0 } -func (m *TokenTransfer) GetTransactionIndex() int64 { - if m != nil { - return m.TransactionIndex +func (x *TokenTransfer) GetTransactionIndex() int64 { + if x != nil { + return x.TransactionIndex } return 0 } -func init() { - proto.RegisterType((*TokenTransfer)(nil), "models.TokenTransfer") -} - -func init() { - proto.RegisterFile("token_transfer.proto", fileDescriptor_4dee5df8e2b2416f) -} - -var fileDescriptor_4dee5df8e2b2416f = []byte{ - // 478 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x5d, 0x4f, 0xdb, 0x30, - 0x14, 0x55, 0x0a, 0xed, 0xda, 0xdb, 0x0f, 0x86, 0x81, 0xc9, 0x99, 0x34, 0x51, 0x86, 0x10, 0x9d, - 0x50, 0x1b, 0x6d, 0xbc, 0xed, 0x69, 0x63, 0x68, 0x1a, 0x7b, 0xe0, 0xc1, 0xeb, 0xd3, 0x5e, 0x22, - 0x27, 0x71, 0xd2, 0x88, 0xd8, 0xae, 0x12, 0x77, 0xea, 0x7e, 0x5a, 0xf2, 0xa7, 0xf6, 0x17, 0xa6, - 0x5c, 0x43, 0x95, 0xa2, 0x8a, 0x37, 0xdf, 0xe3, 0x73, 0xcf, 0x39, 0xbe, 0xba, 0x86, 0x63, 0xa3, - 0x1f, 0x84, 0xf2, 0x4d, 0xce, 0x55, 0x11, 0x8b, 0x7c, 0xb6, 0xcc, 0xb5, 0xd1, 0xa4, 0x23, 0x75, - 0x24, 0xb2, 0xe2, 0xed, 0x97, 0x24, 0x35, 0x8b, 0x55, 0x30, 0x0b, 0xb5, 0xf4, 0x52, 0x15, 0xeb, - 0x20, 0xd3, 0x6b, 0xbd, 0x14, 0xca, 0x43, 0x5a, 0x38, 0x4d, 0x84, 0x9a, 0x26, 0x3a, 0x97, 0xb6, - 0xf6, 0xf4, 0xd2, 0xa4, 0x5a, 0x15, 0x5e, 0x0d, 0x59, 0xa5, 0xf7, 0xff, 0xda, 0x30, 0x9c, 0xd7, - 0x16, 0xf3, 0x47, 0x07, 0x72, 0x0d, 0xaf, 0xd1, 0x8d, 0x87, 0x35, 0xd9, 0x5f, 0xf0, 0x62, 0x41, - 0x9d, 0xb1, 0x33, 0xe9, 0xdd, 0x74, 0xab, 0xd2, 0xdd, 0x87, 0xd6, 0xc4, 0x61, 0x07, 0x0d, 0xc6, - 0x0f, 0x5e, 0x2c, 0xc8, 0x05, 0xf4, 0x32, 0x9d, 0xf8, 0xa9, 0x8a, 0xc4, 0x9a, 0xb6, 0xc6, 0xce, - 0x64, 0xaf, 0xc1, 0xee, 0x66, 0x3a, 0xb9, 0xab, 0x6f, 0x48, 0x02, 0x6f, 0xec, 0x7b, 0x42, 0xad, - 0x4c, 0xce, 0x43, 0xe3, 0xf3, 0x28, 0xca, 0x45, 0x51, 0xd0, 0x3d, 0x74, 0xf8, 0x58, 0x95, 0xee, - 0x14, 0xae, 0xd8, 0x87, 0xed, 0x57, 0xfb, 0x69, 0xb4, 0xf6, 0x77, 0x37, 0x32, 0x3b, 0xa0, 0x6f, - 0x8f, 0xf0, 0x57, 0x8b, 0x92, 0x9f, 0x30, 0x88, 0x73, 0x2d, 0x37, 0xf2, 0xfb, 0x28, 0x7f, 0x59, - 0x95, 0xee, 0x39, 0x9c, 0xb1, 0xd3, 0x1d, 0xf2, 0x4d, 0x3a, 0xeb, 0xd7, 0xd5, 0x93, 0xd6, 0x2d, - 0x80, 0xd1, 0x1b, 0xa5, 0x36, 0x2a, 0x5d, 0x54, 0xa5, 0x7b, 0x06, 0xa7, 0xec, 0xdd, 0xce, 0xa0, - 0x1b, 0x9d, 0x9e, 0xd1, 0x8d, 0x44, 0x41, 0xa6, 0xc3, 0x07, 0x5f, 0xad, 0x64, 0x20, 0x72, 0xda, - 0xc1, 0x21, 0xbd, 0x94, 0xa8, 0x49, 0x67, 0x7d, 0xac, 0xee, 0xb1, 0x20, 0xc7, 0xd0, 0xfe, 0xc3, - 0xb3, 0x95, 0xa0, 0xaf, 0xea, 0x30, 0xcc, 0x16, 0xe4, 0x1c, 0x86, 0x78, 0xf0, 0x23, 0x11, 0xa6, - 0x92, 0x67, 0xb4, 0x3b, 0x76, 0x26, 0x0e, 0x1b, 0x20, 0x78, 0x6b, 0x31, 0x72, 0x09, 0x07, 0x56, - 0xd7, 0xa4, 0x52, 0x14, 0x86, 0xcb, 0x25, 0xed, 0xd5, 0x49, 0xd8, 0x08, 0xe1, 0xf9, 0x13, 0x4a, - 0x66, 0x70, 0xf4, 0x6c, 0xe2, 0x8a, 0x4b, 0x41, 0x01, 0x1d, 0x0f, 0xb7, 0x86, 0x7e, 0xcf, 0xa5, - 0x20, 0x9f, 0xe0, 0xe4, 0x19, 0xbf, 0xf8, 0x2b, 0x03, 0x9d, 0xd1, 0x3e, 0x76, 0x1c, 0x6d, 0x75, - 0xfc, 0xc2, 0xab, 0x3a, 0x4c, 0x73, 0xd5, 0x62, 0x21, 0xe8, 0x00, 0xd9, 0xa3, 0x06, 0xfc, 0x5d, - 0x08, 0x72, 0x02, 0x1d, 0x15, 0x1b, 0x3f, 0x8d, 0xe8, 0x10, 0xc3, 0xb6, 0x55, 0x6c, 0xee, 0x22, - 0x72, 0x05, 0x87, 0xcd, 0x7e, 0xbb, 0x7d, 0x23, 0x64, 0x34, 0x77, 0x18, 0x77, 0xef, 0x73, 0xa7, - 0x2a, 0xdd, 0x56, 0xd7, 0xb9, 0x81, 0xdf, 0xdd, 0x99, 0x67, 0xff, 0x4f, 0xd0, 0xc1, 0x4f, 0x70, - 0xfd, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xab, 0x57, 0x87, 0xdc, 0x66, 0x03, 0x00, 0x00, +var File_token_transfer_proto protoreflect.FileDescriptor + +var file_token_transfer_proto_rawDesc = []byte{ + 0x0a, 0x14, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, + 0x6c, 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, + 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x22, 0x9d, 0x06, 0x0a, 0x0d, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x65, 0x72, 0x12, 0x33, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, + 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, + 0x0a, 0x02, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x67, + 0x0a, 0x16, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, + 0xba, 0xb9, 0x19, 0x2d, 0x0a, 0x2b, 0x52, 0x29, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, + 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x52, 0x14, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, + 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4a, 0x0a, 0x0c, 0x66, 0x72, 0x6f, 0x6d, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x27, 0xba, + 0xb9, 0x19, 0x23, 0x0a, 0x21, 0x52, 0x1f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x12, 0x44, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x25, 0xba, 0xb9, 0x19, 0x21, 0x0a, 0x1f, 0x52, + 0x1d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, + 0x69, 0x64, 0x78, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, + 0x74, 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x4a, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, + 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x42, + 0x27, 0xba, 0xb9, 0x19, 0x23, 0x0a, 0x21, 0x52, 0x1f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x07, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x18, 0x08, 0x20, 0x01, + 0x28, 0x01, 0x52, 0x0c, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, + 0x12, 0x27, 0x0a, 0x0f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x09, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2e, 0x0a, 0x13, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x43, 0x6f, 0x6e, + 0x74, 0x72, 0x61, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x5f, 0x73, 0x79, 0x6d, 0x62, + 0x6f, 0x6c, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x13, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x43, + 0x6f, 0x6e, 0x74, 0x72, 0x61, 0x63, 0x74, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x12, 0x27, 0x0a, + 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, + 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x12, 0x15, 0x0a, 0x06, 0x6e, 0x66, 0x74, 0x5f, 0x69, 0x64, + 0x18, 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6e, 0x66, 0x74, 0x49, 0x64, 0x12, 0x59, 0x0a, + 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, + 0x65, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x42, 0x2c, 0xba, 0xb9, 0x19, 0x28, 0x0a, 0x26, + 0x52, 0x24, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, + 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x3a, 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, + 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_token_transfer_proto_rawDescOnce sync.Once + file_token_transfer_proto_rawDescData = file_token_transfer_proto_rawDesc +) + +func file_token_transfer_proto_rawDescGZIP() []byte { + file_token_transfer_proto_rawDescOnce.Do(func() { + file_token_transfer_proto_rawDescData = protoimpl.X.CompressGZIP(file_token_transfer_proto_rawDescData) + }) + return file_token_transfer_proto_rawDescData +} + +var file_token_transfer_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_token_transfer_proto_goTypes = []interface{}{ + (*TokenTransfer)(nil), // 0: models.TokenTransfer +} +var file_token_transfer_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_token_transfer_proto_init() } +func file_token_transfer_proto_init() { + if File_token_transfer_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_token_transfer_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TokenTransfer); 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_token_transfer_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_token_transfer_proto_goTypes, + DependencyIndexes: file_token_transfer_proto_depIdxs, + MessageInfos: file_token_transfer_proto_msgTypes, + }.Build() + File_token_transfer_proto = out.File + file_token_transfer_proto_rawDesc = nil + file_token_transfer_proto_goTypes = nil + file_token_transfer_proto_depIdxs = nil } diff --git a/src/models/token_transfer.pb.gorm.go b/src/models/token_transfer.pb.gorm.go index cee1010..57d6ed0 100644 --- a/src/models/token_transfer.pb.gorm.go +++ b/src/models/token_transfer.pb.gorm.go @@ -2,26 +2,24 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type TokenTransferORM struct { BlockNumber int64 `gorm:"index:token_transfer_idx_block_number"` BlockTimestamp int64 FromAddress string `gorm:"index:token_transfer_idx_from_address"` - LogIndex int64 `gorm:"primary_key"` + LogIndex int64 `gorm:"primaryKey"` NftId int64 ToAddress string `gorm:"index:token_transfer_idx_to_address"` TokenContractAddress string `gorm:"index:token_transfer_idx_token_contract_address"` TokenContractName string TokenContractSymbol string TransactionFee string - TransactionHash string `gorm:"primary_key"` - TransactionIndex int64 + TransactionHash string `gorm:"primaryKey"` + TransactionIndex int64 `gorm:"index:token_transfer_idx_transaction_index"` Value string ValueDecimal float64 } @@ -128,7 +126,7 @@ func DefaultCreateTokenTransfer(ctx context.Context, in *TokenTransfer, db *gorm return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TokenTransferORMWithAfterCreate_); ok { @@ -155,6 +153,9 @@ func DefaultReadTokenTransfer(ctx context.Context, in *TokenTransfer, db *gorm.D if err != nil { return nil, err } + if ormObj.LogIndex == 0 { + return nil, errors.EmptyIdError + } if ormObj.TransactionHash == "" { return nil, errors.EmptyIdError } @@ -163,9 +164,6 @@ func DefaultReadTokenTransfer(ctx context.Context, in *TokenTransfer, db *gorm.D return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &TokenTransferORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TokenTransferORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -202,6 +200,9 @@ func DefaultDeleteTokenTransfer(ctx context.Context, in *TokenTransfer, db *gorm if err != nil { return err } + if ormObj.LogIndex == 0 { + return errors.EmptyIdError + } if ormObj.TransactionHash == "" { return errors.EmptyIdError } @@ -227,159 +228,6 @@ type TokenTransferORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteTokenTransferSet(ctx context.Context, in []*TokenTransfer, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.TransactionHash == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.TransactionHash) - } - if hook, ok := (interface{}(&TokenTransferORM{})).(TokenTransferORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("transaction_hash in (?)", keys).Delete(&TokenTransferORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&TokenTransferORM{})).(TokenTransferORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type TokenTransferORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*TokenTransfer, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*TokenTransfer, *gorm.DB) error -} - -// DefaultStrictUpdateTokenTransfer clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateTokenTransfer(ctx context.Context, in *TokenTransfer, db *gorm.DB) (*TokenTransfer, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateTokenTransfer") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &TokenTransferORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("transaction_hash=?", ormObj.TransactionHash).First(lockedRow) - if hook, ok := interface{}(&ormObj).(TokenTransferORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(TokenTransferORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(TokenTransferORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type TokenTransferORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchTokenTransfer executes a basic gorm update call with patch behavior -func DefaultPatchTokenTransfer(ctx context.Context, in *TokenTransfer, updateMask *field_mask.FieldMask, db *gorm.DB) (*TokenTransfer, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj TokenTransfer - var err error - if hook, ok := interface{}(&pbObj).(TokenTransferWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(TokenTransferWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskTokenTransfer(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(TokenTransferWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateTokenTransfer(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(TokenTransferWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type TokenTransferWithBeforePatchRead interface { - BeforePatchRead(context.Context, *TokenTransfer, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *TokenTransfer, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferWithBeforePatchSave interface { - BeforePatchSave(context.Context, *TokenTransfer, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferWithAfterPatchSave interface { - AfterPatchSave(context.Context, *TokenTransfer, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetTokenTransfer executes a bulk gorm update call with patch behavior -func DefaultPatchSetTokenTransfer(ctx context.Context, objects []*TokenTransfer, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*TokenTransfer, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*TokenTransfer, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchTokenTransfer(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskTokenTransfer patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskTokenTransfer(ctx context.Context, patchee *TokenTransfer, patcher *TokenTransfer, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*TokenTransfer, error) { if patcher == nil { @@ -464,17 +312,13 @@ func DefaultListTokenTransfer(ctx context.Context, db *gorm.DB) ([]*TokenTransfe return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &TokenTransferORM{}, &TokenTransfer{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TokenTransferORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("transaction_hash") + db = db.Order("log_index, transaction_hash") ormResponse := []TokenTransferORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/token_transfer_by_address.pb.go b/src/models/token_transfer_by_address.pb.go index 990437a..9073d3b 100644 --- a/src/models/token_transfer_by_address.pb.go +++ b/src/models/token_transfer_by_address.pb.go @@ -1,121 +1,196 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: token_transfer_by_address.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 TokenTransferByAddress struct { - TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` - LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address"` - BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` - TransactionIndex int64 `protobuf:"varint,5,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` + LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address"` + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` // Requires custom index - See migration script + TransactionIndex int64 `protobuf:"varint,5,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` } -func (m *TokenTransferByAddress) Reset() { *m = TokenTransferByAddress{} } -func (m *TokenTransferByAddress) String() string { return proto.CompactTextString(m) } -func (*TokenTransferByAddress) ProtoMessage() {} -func (*TokenTransferByAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_83377287acf49b12, []int{0} +func (x *TokenTransferByAddress) Reset() { + *x = TokenTransferByAddress{} + if protoimpl.UnsafeEnabled { + mi := &file_token_transfer_by_address_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TokenTransferByAddress) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TokenTransferByAddress.Unmarshal(m, b) -} -func (m *TokenTransferByAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TokenTransferByAddress.Marshal(b, m, deterministic) +func (x *TokenTransferByAddress) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TokenTransferByAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_TokenTransferByAddress.Merge(m, src) -} -func (m *TokenTransferByAddress) XXX_Size() int { - return xxx_messageInfo_TokenTransferByAddress.Size(m) -} -func (m *TokenTransferByAddress) XXX_DiscardUnknown() { - xxx_messageInfo_TokenTransferByAddress.DiscardUnknown(m) + +func (*TokenTransferByAddress) ProtoMessage() {} + +func (x *TokenTransferByAddress) ProtoReflect() protoreflect.Message { + mi := &file_token_transfer_by_address_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) } -var xxx_messageInfo_TokenTransferByAddress proto.InternalMessageInfo +// Deprecated: Use TokenTransferByAddress.ProtoReflect.Descriptor instead. +func (*TokenTransferByAddress) Descriptor() ([]byte, []int) { + return file_token_transfer_by_address_proto_rawDescGZIP(), []int{0} +} -func (m *TokenTransferByAddress) GetTransactionHash() string { - if m != nil { - return m.TransactionHash +func (x *TokenTransferByAddress) GetTransactionHash() string { + if x != nil { + return x.TransactionHash } return "" } -func (m *TokenTransferByAddress) GetLogIndex() int64 { - if m != nil { - return m.LogIndex +func (x *TokenTransferByAddress) GetLogIndex() int64 { + if x != nil { + return x.LogIndex } return 0 } -func (m *TokenTransferByAddress) GetAddress() string { - if m != nil { - return m.Address +func (x *TokenTransferByAddress) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *TokenTransferByAddress) GetBlockNumber() int64 { - if m != nil { - return m.BlockNumber +func (x *TokenTransferByAddress) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber } return 0 } -func (m *TokenTransferByAddress) GetTransactionIndex() int64 { - if m != nil { - return m.TransactionIndex +func (x *TokenTransferByAddress) GetTransactionIndex() int64 { + if x != nil { + return x.TransactionIndex } return 0 } -func init() { - proto.RegisterType((*TokenTransferByAddress)(nil), "models.TokenTransferByAddress") +var File_token_transfer_by_address_proto protoreflect.FileDescriptor + +var file_token_transfer_by_address_proto_rawDesc = []byte{ + 0x0a, 0x1f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, + 0x5f, 0x62, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, + 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, + 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa9, 0x02, 0x0a, 0x16, + 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x42, 0x79, 0x41, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x33, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x0a, 0x09, 0x6c, + 0x6f, 0x67, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, + 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x12, 0x22, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x07, 0x61, + 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, + 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x64, 0x0a, 0x11, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x03, 0x42, 0x37, 0xba, 0xb9, 0x19, 0x33, 0x0a, 0x31, 0x52, 0x2f, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x5f, 0x62, 0x79, 0x5f, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x52, 0x10, 0x74, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x3a, + 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, + 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } -func init() { - proto.RegisterFile("token_transfer_by_address.proto", fileDescriptor_83377287acf49b12) +var ( + file_token_transfer_by_address_proto_rawDescOnce sync.Once + file_token_transfer_by_address_proto_rawDescData = file_token_transfer_by_address_proto_rawDesc +) + +func file_token_transfer_by_address_proto_rawDescGZIP() []byte { + file_token_transfer_by_address_proto_rawDescOnce.Do(func() { + file_token_transfer_by_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_token_transfer_by_address_proto_rawDescData) + }) + return file_token_transfer_by_address_proto_rawDescData } -var fileDescriptor_83377287acf49b12 = []byte{ - // 293 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x50, 0x41, 0x4f, 0xb3, 0x40, - 0x14, 0x0c, 0xb4, 0x5f, 0x3f, 0xba, 0x9a, 0xa8, 0x7b, 0x30, 0xe0, 0xc5, 0xda, 0xc4, 0x84, 0x4b, - 0xd9, 0x18, 0x0e, 0x26, 0x9e, 0x94, 0x93, 0x5e, 0x3c, 0x90, 0x9e, 0xbc, 0x6c, 0x58, 0x76, 0x0b, - 0xa4, 0xb0, 0x8f, 0xec, 0xd2, 0x84, 0xfe, 0x24, 0x7f, 0x02, 0xfc, 0x3a, 0xc3, 0x52, 0x13, 0xa2, - 0xf1, 0xf8, 0xe6, 0xcd, 0x9b, 0x99, 0x37, 0xe8, 0xb6, 0x81, 0xbd, 0x90, 0xb4, 0x51, 0x89, 0xd4, - 0x3b, 0xa1, 0x28, 0x3b, 0xd2, 0x84, 0x73, 0x25, 0xb4, 0x0e, 0x6a, 0x05, 0x0d, 0xe0, 0x45, 0x05, - 0x5c, 0x94, 0xfa, 0xe6, 0x39, 0x2b, 0x9a, 0xfc, 0xc0, 0x82, 0x14, 0x2a, 0x52, 0xc8, 0x1d, 0xb0, - 0x12, 0x5a, 0xa8, 0x85, 0x24, 0x86, 0x96, 0x6e, 0x32, 0x21, 0x37, 0x19, 0xa8, 0x6a, 0x9c, 0x09, - 0xd4, 0x4d, 0x01, 0x52, 0x93, 0x01, 0x1a, 0x95, 0xd6, 0x9f, 0x36, 0xba, 0xde, 0x0e, 0x6e, 0xdb, - 0x93, 0x59, 0x74, 0x7c, 0x19, 0xad, 0x70, 0x88, 0x2e, 0x4d, 0x82, 0x24, 0x1d, 0xae, 0x68, 0x9e, - 0xe8, 0xdc, 0xb5, 0x56, 0x96, 0xbf, 0x8c, 0x9c, 0xbe, 0xf3, 0xe6, 0xc8, 0xf6, 0xad, 0xf8, 0x62, - 0xc2, 0x78, 0x4d, 0x74, 0x8e, 0xef, 0xd1, 0xb2, 0x84, 0x8c, 0x16, 0x92, 0x8b, 0xd6, 0xb5, 0x57, - 0x96, 0x3f, 0x9b, 0xb0, 0x9d, 0x12, 0xb2, 0xb7, 0x61, 0x83, 0xd7, 0xe8, 0xff, 0xe9, 0x23, 0x77, - 0xf6, 0x43, 0xf2, 0x7b, 0x81, 0xef, 0xd0, 0x39, 0x2b, 0x21, 0xdd, 0x53, 0x79, 0xa8, 0x98, 0x50, - 0xee, 0x7c, 0x50, 0x8b, 0xcf, 0x0c, 0xf6, 0x6e, 0x20, 0xcc, 0xd1, 0xd5, 0x34, 0xe2, 0xe8, 0xfa, - 0xcf, 0xb8, 0x3e, 0xf6, 0x9d, 0x17, 0xa2, 0x87, 0x98, 0xfc, 0xd9, 0x25, 0x2d, 0x78, 0x4b, 0x7f, - 0x9d, 0xc7, 0xd3, 0xa7, 0x4d, 0xd8, 0xa7, 0x45, 0xdf, 0x79, 0xb6, 0x63, 0x45, 0xe8, 0xc3, 0x09, - 0xc8, 0xd8, 0x3c, 0x5b, 0x98, 0xfa, 0xc2, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd2, 0xd3, 0x18, - 0xbe, 0xab, 0x01, 0x00, 0x00, +var file_token_transfer_by_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_token_transfer_by_address_proto_goTypes = []interface{}{ + (*TokenTransferByAddress)(nil), // 0: models.TokenTransferByAddress +} +var file_token_transfer_by_address_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_token_transfer_by_address_proto_init() } +func file_token_transfer_by_address_proto_init() { + if File_token_transfer_by_address_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_token_transfer_by_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TokenTransferByAddress); 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_token_transfer_by_address_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_token_transfer_by_address_proto_goTypes, + DependencyIndexes: file_token_transfer_by_address_proto_depIdxs, + MessageInfos: file_token_transfer_by_address_proto_msgTypes, + }.Build() + File_token_transfer_by_address_proto = out.File + file_token_transfer_by_address_proto_rawDesc = nil + file_token_transfer_by_address_proto_goTypes = nil + file_token_transfer_by_address_proto_depIdxs = nil } diff --git a/src/models/token_transfer_by_address.pb.gorm.go b/src/models/token_transfer_by_address.pb.gorm.go index b9f4955..d3d3b3c 100644 --- a/src/models/token_transfer_by_address.pb.gorm.go +++ b/src/models/token_transfer_by_address.pb.gorm.go @@ -2,18 +2,16 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type TokenTransferByAddressORM struct { - Address string `gorm:"primary_key"` + Address string `gorm:"primaryKey"` BlockNumber int64 - LogIndex int64 `gorm:"primary_key"` - TransactionHash string `gorm:"primary_key"` + LogIndex int64 `gorm:"primaryKey"` + TransactionHash string `gorm:"primaryKey"` TransactionIndex int64 `gorm:"index:token_transfer_by_address_idx_transaction_index"` } @@ -101,7 +99,7 @@ func DefaultCreateTokenTransferByAddress(ctx context.Context, in *TokenTransferB return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TokenTransferByAddressORMWithAfterCreate_); ok { @@ -128,6 +126,12 @@ func DefaultReadTokenTransferByAddress(ctx context.Context, in *TokenTransferByA if err != nil { return nil, err } + if ormObj.Address == "" { + return nil, errors.EmptyIdError + } + if ormObj.LogIndex == 0 { + return nil, errors.EmptyIdError + } if ormObj.TransactionHash == "" { return nil, errors.EmptyIdError } @@ -136,9 +140,6 @@ func DefaultReadTokenTransferByAddress(ctx context.Context, in *TokenTransferByA return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &TokenTransferByAddressORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TokenTransferByAddressORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -175,6 +176,12 @@ func DefaultDeleteTokenTransferByAddress(ctx context.Context, in *TokenTransferB if err != nil { return err } + if ormObj.Address == "" { + return errors.EmptyIdError + } + if ormObj.LogIndex == 0 { + return errors.EmptyIdError + } if ormObj.TransactionHash == "" { return errors.EmptyIdError } @@ -200,159 +207,6 @@ type TokenTransferByAddressORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteTokenTransferByAddressSet(ctx context.Context, in []*TokenTransferByAddress, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.TransactionHash == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.TransactionHash) - } - if hook, ok := (interface{}(&TokenTransferByAddressORM{})).(TokenTransferByAddressORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("transaction_hash in (?)", keys).Delete(&TokenTransferByAddressORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&TokenTransferByAddressORM{})).(TokenTransferByAddressORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type TokenTransferByAddressORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*TokenTransferByAddress, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferByAddressORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*TokenTransferByAddress, *gorm.DB) error -} - -// DefaultStrictUpdateTokenTransferByAddress clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateTokenTransferByAddress(ctx context.Context, in *TokenTransferByAddress, db *gorm.DB) (*TokenTransferByAddress, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateTokenTransferByAddress") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &TokenTransferByAddressORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("transaction_hash=?", ormObj.TransactionHash).First(lockedRow) - if hook, ok := interface{}(&ormObj).(TokenTransferByAddressORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(TokenTransferByAddressORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(TokenTransferByAddressORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type TokenTransferByAddressORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferByAddressORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferByAddressORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchTokenTransferByAddress executes a basic gorm update call with patch behavior -func DefaultPatchTokenTransferByAddress(ctx context.Context, in *TokenTransferByAddress, updateMask *field_mask.FieldMask, db *gorm.DB) (*TokenTransferByAddress, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj TokenTransferByAddress - var err error - if hook, ok := interface{}(&pbObj).(TokenTransferByAddressWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(TokenTransferByAddressWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskTokenTransferByAddress(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(TokenTransferByAddressWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateTokenTransferByAddress(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(TokenTransferByAddressWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type TokenTransferByAddressWithBeforePatchRead interface { - BeforePatchRead(context.Context, *TokenTransferByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferByAddressWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *TokenTransferByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferByAddressWithBeforePatchSave interface { - BeforePatchSave(context.Context, *TokenTransferByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TokenTransferByAddressWithAfterPatchSave interface { - AfterPatchSave(context.Context, *TokenTransferByAddress, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetTokenTransferByAddress executes a bulk gorm update call with patch behavior -func DefaultPatchSetTokenTransferByAddress(ctx context.Context, objects []*TokenTransferByAddress, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*TokenTransferByAddress, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*TokenTransferByAddress, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchTokenTransferByAddress(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskTokenTransferByAddress patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskTokenTransferByAddress(ctx context.Context, patchee *TokenTransferByAddress, patcher *TokenTransferByAddress, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*TokenTransferByAddress, error) { if patcher == nil { @@ -401,17 +255,13 @@ func DefaultListTokenTransferByAddress(ctx context.Context, db *gorm.DB) ([]*Tok return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &TokenTransferByAddressORM{}, &TokenTransferByAddress{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TokenTransferByAddressORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("log_index") + db = db.Order("address, log_index, transaction_hash") ormResponse := []TokenTransferByAddressORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/transaction.pb.go b/src/models/transaction.pb.go index f3ab535..597ba21 100644 --- a/src/models/transaction.pb.go +++ b/src/models/transaction.pb.go @@ -1,337 +1,443 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: transaction.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 Transaction struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"` - LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` - Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type"` - Method string `protobuf:"bytes,4,opt,name=method,proto3" json:"method"` - FromAddress string `protobuf:"bytes,5,opt,name=from_address,json=fromAddress,proto3" json:"from_address"` - ToAddress string `protobuf:"bytes,6,opt,name=to_address,json=toAddress,proto3" json:"to_address"` - BlockNumber int64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` - LogCount int64 `protobuf:"varint,8,opt,name=log_count,json=logCount,proto3" json:"log_count"` - Version string `protobuf:"bytes,9,opt,name=version,proto3" json:"version"` - Value string `protobuf:"bytes,10,opt,name=value,proto3" json:"value"` - ValueDecimal float64 `protobuf:"fixed64,11,opt,name=value_decimal,json=valueDecimal,proto3" json:"value_decimal"` - StepLimit string `protobuf:"bytes,12,opt,name=step_limit,json=stepLimit,proto3" json:"step_limit"` - Timestamp int64 `protobuf:"varint,13,opt,name=timestamp,proto3" json:"timestamp"` - BlockTimestamp int64 `protobuf:"varint,14,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp"` - Nid string `protobuf:"bytes,15,opt,name=nid,proto3" json:"nid"` - Nonce string `protobuf:"bytes,16,opt,name=nonce,proto3" json:"nonce"` - TransactionIndex int64 `protobuf:"varint,17,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` - BlockHash string `protobuf:"bytes,18,opt,name=block_hash,json=blockHash,proto3" json:"block_hash"` - TransactionFee string `protobuf:"bytes,19,opt,name=transaction_fee,json=transactionFee,proto3" json:"transaction_fee"` - Signature string `protobuf:"bytes,20,opt,name=signature,proto3" json:"signature"` - DataType string `protobuf:"bytes,21,opt,name=data_type,json=dataType,proto3" json:"data_type"` - Data string `protobuf:"bytes,22,opt,name=data,proto3" json:"data"` - CumulativeStepUsed string `protobuf:"bytes,23,opt,name=cumulative_step_used,json=cumulativeStepUsed,proto3" json:"cumulative_step_used"` - StepUsed string `protobuf:"bytes,24,opt,name=step_used,json=stepUsed,proto3" json:"step_used"` - StepPrice string `protobuf:"bytes,25,opt,name=step_price,json=stepPrice,proto3" json:"step_price"` - ScoreAddress string `protobuf:"bytes,26,opt,name=score_address,json=scoreAddress,proto3" json:"score_address"` - LogsBloom string `protobuf:"bytes,27,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom"` - Status string `protobuf:"bytes,28,opt,name=status,proto3" json:"status"` - TransactionType int32 `protobuf:"varint,29,opt,name=transaction_type,json=transactionType,proto3" json:"transaction_type"` -} - -func (m *Transaction) Reset() { *m = Transaction{} } -func (m *Transaction) String() string { return proto.CompactTextString(m) } -func (*Transaction) ProtoMessage() {} -func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_2cc4e03d2c28c490, []int{0} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"` + LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` + Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type"` + Method string `protobuf:"bytes,4,opt,name=method,proto3" json:"method"` + FromAddress string `protobuf:"bytes,5,opt,name=from_address,json=fromAddress,proto3" json:"from_address"` + ToAddress string `protobuf:"bytes,6,opt,name=to_address,json=toAddress,proto3" json:"to_address"` + BlockNumber int64 `protobuf:"varint,7,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` + LogCount int64 `protobuf:"varint,8,opt,name=log_count,json=logCount,proto3" json:"log_count"` + Version string `protobuf:"bytes,9,opt,name=version,proto3" json:"version"` + Value string `protobuf:"bytes,10,opt,name=value,proto3" json:"value"` + ValueDecimal float64 `protobuf:"fixed64,11,opt,name=value_decimal,json=valueDecimal,proto3" json:"value_decimal"` + StepLimit string `protobuf:"bytes,12,opt,name=step_limit,json=stepLimit,proto3" json:"step_limit"` + Timestamp int64 `protobuf:"varint,13,opt,name=timestamp,proto3" json:"timestamp"` + BlockTimestamp int64 `protobuf:"varint,14,opt,name=block_timestamp,json=blockTimestamp,proto3" json:"block_timestamp"` + Nid string `protobuf:"bytes,15,opt,name=nid,proto3" json:"nid"` + Nonce string `protobuf:"bytes,16,opt,name=nonce,proto3" json:"nonce"` + TransactionIndex int64 `protobuf:"varint,17,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index"` + BlockHash string `protobuf:"bytes,18,opt,name=block_hash,json=blockHash,proto3" json:"block_hash"` + TransactionFee string `protobuf:"bytes,19,opt,name=transaction_fee,json=transactionFee,proto3" json:"transaction_fee"` + Signature string `protobuf:"bytes,20,opt,name=signature,proto3" json:"signature"` + DataType string `protobuf:"bytes,21,opt,name=data_type,json=dataType,proto3" json:"data_type"` + Data string `protobuf:"bytes,22,opt,name=data,proto3" json:"data"` + CumulativeStepUsed string `protobuf:"bytes,23,opt,name=cumulative_step_used,json=cumulativeStepUsed,proto3" json:"cumulative_step_used"` + StepUsed string `protobuf:"bytes,24,opt,name=step_used,json=stepUsed,proto3" json:"step_used"` + StepPrice string `protobuf:"bytes,25,opt,name=step_price,json=stepPrice,proto3" json:"step_price"` + ScoreAddress string `protobuf:"bytes,26,opt,name=score_address,json=scoreAddress,proto3" json:"score_address"` + LogsBloom string `protobuf:"bytes,27,opt,name=logs_bloom,json=logsBloom,proto3" json:"logs_bloom"` + Status string `protobuf:"bytes,28,opt,name=status,proto3" json:"status"` + TransactionType int32 `protobuf:"varint,29,opt,name=transaction_type,json=transactionType,proto3" json:"transaction_type"` +} + +func (x *Transaction) Reset() { + *x = Transaction{} + if protoimpl.UnsafeEnabled { + mi := &file_transaction_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *Transaction) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_Transaction.Unmarshal(m, b) -} -func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) -} -func (m *Transaction) XXX_Merge(src proto.Message) { - xxx_messageInfo_Transaction.Merge(m, src) +func (x *Transaction) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *Transaction) XXX_Size() int { - return xxx_messageInfo_Transaction.Size(m) -} -func (m *Transaction) XXX_DiscardUnknown() { - xxx_messageInfo_Transaction.DiscardUnknown(m) + +func (*Transaction) ProtoMessage() {} + +func (x *Transaction) ProtoReflect() protoreflect.Message { + mi := &file_transaction_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) } -var xxx_messageInfo_Transaction proto.InternalMessageInfo +// Deprecated: Use Transaction.ProtoReflect.Descriptor instead. +func (*Transaction) Descriptor() ([]byte, []int) { + return file_transaction_proto_rawDescGZIP(), []int{0} +} -func (m *Transaction) GetHash() string { - if m != nil { - return m.Hash +func (x *Transaction) GetHash() string { + if x != nil { + return x.Hash } return "" } -func (m *Transaction) GetLogIndex() int64 { - if m != nil { - return m.LogIndex +func (x *Transaction) GetLogIndex() int64 { + if x != nil { + return x.LogIndex } return 0 } -func (m *Transaction) GetType() string { - if m != nil { - return m.Type +func (x *Transaction) GetType() string { + if x != nil { + return x.Type } return "" } -func (m *Transaction) GetMethod() string { - if m != nil { - return m.Method +func (x *Transaction) GetMethod() string { + if x != nil { + return x.Method } return "" } -func (m *Transaction) GetFromAddress() string { - if m != nil { - return m.FromAddress +func (x *Transaction) GetFromAddress() string { + if x != nil { + return x.FromAddress } return "" } -func (m *Transaction) GetToAddress() string { - if m != nil { - return m.ToAddress +func (x *Transaction) GetToAddress() string { + if x != nil { + return x.ToAddress } return "" } -func (m *Transaction) GetBlockNumber() int64 { - if m != nil { - return m.BlockNumber +func (x *Transaction) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber } return 0 } -func (m *Transaction) GetLogCount() int64 { - if m != nil { - return m.LogCount +func (x *Transaction) GetLogCount() int64 { + if x != nil { + return x.LogCount } return 0 } -func (m *Transaction) GetVersion() string { - if m != nil { - return m.Version +func (x *Transaction) GetVersion() string { + if x != nil { + return x.Version } return "" } -func (m *Transaction) GetValue() string { - if m != nil { - return m.Value +func (x *Transaction) GetValue() string { + if x != nil { + return x.Value } return "" } -func (m *Transaction) GetValueDecimal() float64 { - if m != nil { - return m.ValueDecimal +func (x *Transaction) GetValueDecimal() float64 { + if x != nil { + return x.ValueDecimal } return 0 } -func (m *Transaction) GetStepLimit() string { - if m != nil { - return m.StepLimit +func (x *Transaction) GetStepLimit() string { + if x != nil { + return x.StepLimit } return "" } -func (m *Transaction) GetTimestamp() int64 { - if m != nil { - return m.Timestamp +func (x *Transaction) GetTimestamp() int64 { + if x != nil { + return x.Timestamp } return 0 } -func (m *Transaction) GetBlockTimestamp() int64 { - if m != nil { - return m.BlockTimestamp +func (x *Transaction) GetBlockTimestamp() int64 { + if x != nil { + return x.BlockTimestamp } return 0 } -func (m *Transaction) GetNid() string { - if m != nil { - return m.Nid +func (x *Transaction) GetNid() string { + if x != nil { + return x.Nid } return "" } -func (m *Transaction) GetNonce() string { - if m != nil { - return m.Nonce +func (x *Transaction) GetNonce() string { + if x != nil { + return x.Nonce } return "" } -func (m *Transaction) GetTransactionIndex() int64 { - if m != nil { - return m.TransactionIndex +func (x *Transaction) GetTransactionIndex() int64 { + if x != nil { + return x.TransactionIndex } return 0 } -func (m *Transaction) GetBlockHash() string { - if m != nil { - return m.BlockHash +func (x *Transaction) GetBlockHash() string { + if x != nil { + return x.BlockHash } return "" } -func (m *Transaction) GetTransactionFee() string { - if m != nil { - return m.TransactionFee +func (x *Transaction) GetTransactionFee() string { + if x != nil { + return x.TransactionFee } return "" } -func (m *Transaction) GetSignature() string { - if m != nil { - return m.Signature +func (x *Transaction) GetSignature() string { + if x != nil { + return x.Signature } return "" } -func (m *Transaction) GetDataType() string { - if m != nil { - return m.DataType +func (x *Transaction) GetDataType() string { + if x != nil { + return x.DataType } return "" } -func (m *Transaction) GetData() string { - if m != nil { - return m.Data +func (x *Transaction) GetData() string { + if x != nil { + return x.Data } return "" } -func (m *Transaction) GetCumulativeStepUsed() string { - if m != nil { - return m.CumulativeStepUsed +func (x *Transaction) GetCumulativeStepUsed() string { + if x != nil { + return x.CumulativeStepUsed } return "" } -func (m *Transaction) GetStepUsed() string { - if m != nil { - return m.StepUsed +func (x *Transaction) GetStepUsed() string { + if x != nil { + return x.StepUsed } return "" } -func (m *Transaction) GetStepPrice() string { - if m != nil { - return m.StepPrice +func (x *Transaction) GetStepPrice() string { + if x != nil { + return x.StepPrice } return "" } -func (m *Transaction) GetScoreAddress() string { - if m != nil { - return m.ScoreAddress +func (x *Transaction) GetScoreAddress() string { + if x != nil { + return x.ScoreAddress } return "" } -func (m *Transaction) GetLogsBloom() string { - if m != nil { - return m.LogsBloom +func (x *Transaction) GetLogsBloom() string { + if x != nil { + return x.LogsBloom } return "" } -func (m *Transaction) GetStatus() string { - if m != nil { - return m.Status +func (x *Transaction) GetStatus() string { + if x != nil { + return x.Status } return "" } -func (m *Transaction) GetTransactionType() int32 { - if m != nil { - return m.TransactionType +func (x *Transaction) GetTransactionType() int32 { + if x != nil { + return x.TransactionType } return 0 } -func init() { - proto.RegisterType((*Transaction)(nil), "models.Transaction") -} - -func init() { - proto.RegisterFile("transaction.proto", fileDescriptor_2cc4e03d2c28c490) -} - -var fileDescriptor_2cc4e03d2c28c490 = []byte{ - // 684 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x54, 0x5f, 0x6f, 0xd3, 0x3e, - 0x14, 0x55, 0xb6, 0xae, 0x6b, 0x6f, 0xbb, 0x7f, 0xfe, 0xf5, 0x57, 0x9c, 0xae, 0x1d, 0x65, 0x6c, - 0x5a, 0x25, 0xb4, 0x75, 0x12, 0x12, 0x0f, 0x3c, 0xb1, 0x82, 0x18, 0x20, 0x84, 0x90, 0x37, 0x5e, - 0x78, 0x89, 0xd2, 0xc4, 0x4b, 0x23, 0x92, 0x38, 0x8a, 0x9d, 0x69, 0x7c, 0x1e, 0x3e, 0x45, 0xf2, - 0xe9, 0x90, 0xaf, 0xfb, 0x27, 0xeb, 0xc4, 0x9b, 0xcf, 0xb9, 0xc7, 0xc7, 0xd7, 0xd7, 0x27, 0x81, - 0x03, 0x95, 0xb9, 0x89, 0x74, 0x3d, 0x15, 0x8a, 0xe4, 0x22, 0xcd, 0x84, 0x12, 0xa4, 0x1e, 0x0b, - 0x9f, 0x47, 0xb2, 0xf7, 0x2e, 0x08, 0xd5, 0x2c, 0x9f, 0x5e, 0x78, 0x22, 0x1e, 0x87, 0xc9, 0x9d, - 0x98, 0x46, 0xe2, 0x41, 0xa4, 0x3c, 0x19, 0xa3, 0xcc, 0x3b, 0x0f, 0x78, 0x72, 0x1e, 0x88, 0x2c, - 0x36, 0x78, 0x2c, 0x52, 0xed, 0x21, 0xc7, 0x9a, 0x32, 0x4e, 0xc7, 0x7f, 0x9a, 0xd0, 0xba, 0x5d, - 0xf9, 0x93, 0x3e, 0xd4, 0x66, 0xae, 0x9c, 0x51, 0x6b, 0x68, 0x8d, 0x9a, 0x93, 0x46, 0x59, 0xd8, - 0x35, 0xd8, 0x18, 0x59, 0x0c, 0x59, 0x72, 0x0a, 0xcd, 0x48, 0x04, 0x4e, 0x98, 0xf8, 0xfc, 0x81, - 0x6e, 0x0c, 0xad, 0xd1, 0x66, 0x45, 0xd2, 0x88, 0x44, 0xf0, 0x59, 0x57, 0xc8, 0x25, 0xd4, 0xd4, - 0xef, 0x94, 0xd3, 0x4d, 0x34, 0xe9, 0x97, 0x85, 0x4d, 0xa1, 0xcb, 0x3a, 0x95, 0x7b, 0x38, 0xa1, - 0xff, 0xe0, 0x68, 0x0d, 0x43, 0x25, 0x79, 0x03, 0xf5, 0x98, 0xab, 0x99, 0xf0, 0x69, 0x0d, 0xf7, - 0x1c, 0x95, 0x85, 0xdd, 0x03, 0xca, 0xba, 0xeb, 0x7b, 0x8c, 0x8a, 0xcd, 0xd5, 0xe4, 0x1a, 0xda, - 0x77, 0x99, 0x88, 0x1d, 0xd7, 0xf7, 0x33, 0x2e, 0x25, 0xdd, 0xc2, 0xdd, 0x27, 0x65, 0x61, 0x0f, - 0xe1, 0x88, 0xf5, 0xd7, 0x77, 0x57, 0xb5, 0xac, 0xa5, 0xd1, 0x95, 0x01, 0xe4, 0x0a, 0x40, 0x89, - 0xa5, 0x4d, 0x1d, 0x6d, 0x8e, 0xcb, 0xc2, 0x3e, 0x82, 0x3e, 0xeb, 0x3d, 0x69, 0x7c, 0xa9, 0x64, - 0x4d, 0x25, 0x16, 0x16, 0xd7, 0xd0, 0x9e, 0x46, 0xc2, 0xfb, 0xe5, 0x24, 0x79, 0x3c, 0xe5, 0x19, - 0xdd, 0xc6, 0xf9, 0xfc, 0xb3, 0x97, 0xaa, 0x96, 0xb5, 0x10, 0x7d, 0x43, 0x40, 0x0e, 0xcd, 0x94, - 0x3d, 0x91, 0x27, 0x8a, 0x36, 0xb4, 0x0b, 0xce, 0xf6, 0xbd, 0xc6, 0x84, 0xc2, 0xf6, 0x3d, 0xcf, - 0x64, 0x28, 0x12, 0xda, 0xd4, 0x5d, 0xb2, 0x05, 0x24, 0x1d, 0xd8, 0xba, 0x77, 0xa3, 0x9c, 0x53, - 0x40, 0xde, 0x00, 0xf2, 0x12, 0x76, 0x70, 0xe1, 0xf8, 0xdc, 0x0b, 0x63, 0x37, 0xa2, 0xad, 0xa1, - 0x35, 0xb2, 0x58, 0x1b, 0xc9, 0x0f, 0x86, 0x23, 0x03, 0x00, 0xa9, 0x78, 0xea, 0x44, 0x61, 0x1c, - 0x2a, 0xda, 0xc6, 0xfd, 0x4d, 0xcd, 0x7c, 0xd5, 0x04, 0xe9, 0x43, 0x53, 0x85, 0x31, 0x97, 0xca, - 0x8d, 0x53, 0xba, 0x83, 0x0d, 0xad, 0x08, 0x72, 0x06, 0x7b, 0xe6, 0x2e, 0x2b, 0xcd, 0x2e, 0x6a, - 0x76, 0x91, 0xbe, 0x5d, 0x0a, 0xf7, 0x61, 0x33, 0x09, 0x7d, 0xba, 0x87, 0xf6, 0x7a, 0xa9, 0x5b, - 0x4e, 0x44, 0xe2, 0x71, 0xba, 0x6f, 0x5a, 0x46, 0x40, 0x5e, 0x3d, 0x8a, 0xfc, 0x3c, 0x6d, 0x07, - 0x68, 0xb9, 0x5f, 0x29, 0x98, 0xac, 0x0d, 0x00, 0xcc, 0xe9, 0x18, 0x5b, 0x62, 0x5a, 0x47, 0xe6, - 0x93, 0x4e, 0xec, 0x19, 0xec, 0x55, 0xbd, 0xee, 0x38, 0xa7, 0xff, 0xa1, 0x66, 0xb7, 0x42, 0x7f, - 0xe4, 0x5c, 0xdf, 0x51, 0x86, 0x41, 0xe2, 0xaa, 0x3c, 0xe3, 0xb4, 0x33, 0x9f, 0xc0, 0x82, 0xd0, - 0x4f, 0xe2, 0xbb, 0xca, 0xc5, 0xc8, 0xd2, 0xff, 0xb1, 0xda, 0xd0, 0xc4, 0xad, 0x0e, 0x2f, 0x81, - 0x9a, 0x5e, 0xd3, 0x2e, 0xf2, 0xb8, 0x26, 0x97, 0xd0, 0xf1, 0xf2, 0x38, 0x8f, 0x5c, 0x15, 0xde, - 0x73, 0x07, 0x87, 0x9b, 0x4b, 0xee, 0xd3, 0x67, 0xa8, 0x21, 0xab, 0xda, 0x8d, 0xe2, 0xe9, 0x0f, - 0xc9, 0x7d, 0x7d, 0xc4, 0x4a, 0x46, 0xcd, 0x11, 0x72, 0x51, 0x5c, 0x3c, 0x50, 0x9a, 0x85, 0x1e, - 0xa7, 0xf6, 0xea, 0x81, 0xbe, 0x6b, 0x82, 0x7c, 0x81, 0x1d, 0xe9, 0x89, 0x8c, 0x2f, 0x03, 0xdc, - 0xc3, 0x00, 0x9f, 0x96, 0x85, 0xfd, 0x02, 0x9e, 0xb3, 0xc1, 0x7a, 0xf6, 0x1e, 0x89, 0x59, 0x1b, - 0xe1, 0x22, 0xc6, 0x03, 0x80, 0x48, 0x04, 0x52, 0xe7, 0x53, 0xc4, 0xf4, 0xd0, 0x1c, 0xa5, 0x99, - 0x89, 0x26, 0x48, 0x17, 0xea, 0x52, 0xb9, 0x2a, 0x97, 0xb4, 0x8f, 0xa5, 0x39, 0x22, 0x37, 0x50, - 0x7d, 0x1b, 0x33, 0xa8, 0xc1, 0xd0, 0x1a, 0x6d, 0x4d, 0x46, 0x65, 0x61, 0x9f, 0xc0, 0x31, 0x1b, - 0x3e, 0xf9, 0x8c, 0xd6, 0xf4, 0xac, 0xfa, 0x54, 0x7a, 0xb2, 0x6f, 0xeb, 0x65, 0x61, 0x6f, 0x34, - 0xac, 0x09, 0xfc, 0x6c, 0x5c, 0x8c, 0xcd, 0x3f, 0x6f, 0x5a, 0xc7, 0x1f, 0xd7, 0xeb, 0xbf, 0x01, - 0x00, 0x00, 0xff, 0xff, 0x4c, 0x94, 0x13, 0x2e, 0x17, 0x05, 0x00, 0x00, +var File_transaction_proto protoreflect.FileDescriptor + +var file_transaction_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, + 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, + 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, + 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa3, 0x09, + 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1c, 0x0a, + 0x04, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, + 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x04, 0x68, 0x61, 0x73, 0x68, 0x12, 0x25, 0x0a, 0x09, 0x6c, + 0x6f, 0x67, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, + 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x49, 0x6e, 0x64, + 0x65, 0x78, 0x12, 0x30, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x1c, 0xba, 0xb9, 0x19, 0x18, 0x0a, 0x16, 0x52, 0x14, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x52, 0x04, + 0x74, 0x79, 0x70, 0x65, 0x12, 0x36, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x42, 0x1e, 0xba, 0xb9, 0x19, 0x1a, 0x0a, 0x18, 0x52, 0x16, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x47, 0x0a, 0x0c, + 0x66, 0x72, 0x6f, 0x6d, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x24, 0xba, 0xb9, 0x19, 0x20, 0x0a, 0x1e, 0x52, 0x1c, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x66, 0x72, 0x6f, 0x6d, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x0b, 0x66, 0x72, 0x6f, 0x6d, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x41, 0x0a, 0x0a, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, + 0x65, 0x73, 0x73, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x22, 0xba, 0xb9, 0x19, 0x1e, 0x0a, + 0x1c, 0x52, 0x1a, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, + 0x64, 0x78, 0x5f, 0x74, 0x6f, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x52, 0x09, 0x74, + 0x6f, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x47, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x03, 0x42, 0x24, + 0xba, 0xb9, 0x19, 0x20, 0x0a, 0x1e, 0x52, 0x1c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, + 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x23, + 0x0a, 0x0d, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x01, 0x52, 0x0c, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x44, 0x65, 0x63, 0x69, + 0x6d, 0x61, 0x6c, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x6c, 0x69, 0x6d, 0x69, + 0x74, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x65, 0x70, 0x4c, 0x69, 0x6d, + 0x69, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x0d, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x27, 0x0a, 0x0f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e, 0x62, 0x6c, 0x6f, 0x63, 0x6b, + 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x6e, 0x69, 0x64, + 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6e, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6e, + 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, + 0x65, 0x12, 0x2b, 0x0a, 0x11, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x11, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x1d, + 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x12, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x48, 0x61, 0x73, 0x68, 0x12, 0x27, 0x0a, + 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, + 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, + 0x75, 0x72, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, + 0x74, 0x75, 0x72, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x15, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x61, 0x74, 0x61, 0x54, 0x79, 0x70, + 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x16, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x30, 0x0a, 0x14, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, + 0x69, 0x76, 0x65, 0x5f, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x75, 0x73, 0x65, 0x64, 0x18, 0x17, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x12, 0x63, 0x75, 0x6d, 0x75, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x53, + 0x74, 0x65, 0x70, 0x55, 0x73, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x65, 0x70, 0x5f, + 0x75, 0x73, 0x65, 0x64, 0x18, 0x18, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x65, 0x70, + 0x55, 0x73, 0x65, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x65, 0x70, 0x5f, 0x70, 0x72, 0x69, + 0x63, 0x65, 0x18, 0x19, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x65, 0x70, 0x50, 0x72, + 0x69, 0x63, 0x65, 0x12, 0x4a, 0x0a, 0x0d, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x65, 0x73, 0x73, 0x18, 0x1a, 0x20, 0x01, 0x28, 0x09, 0x42, 0x25, 0xba, 0xb9, 0x19, 0x21, + 0x0a, 0x1f, 0x52, 0x1d, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, + 0x69, 0x64, 0x78, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x52, 0x0c, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, + 0x1d, 0x0a, 0x0a, 0x6c, 0x6f, 0x67, 0x73, 0x5f, 0x62, 0x6c, 0x6f, 0x6f, 0x6d, 0x18, 0x1b, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x6c, 0x6f, 0x67, 0x73, 0x42, 0x6c, 0x6f, 0x6f, 0x6d, 0x12, 0x16, + 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x1c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x53, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x1d, 0x20, 0x01, 0x28, 0x05, + 0x42, 0x28, 0xba, 0xb9, 0x19, 0x24, 0x0a, 0x22, 0x52, 0x20, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x3a, 0x06, 0xba, 0xb9, 0x19, + 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_transaction_proto_rawDescOnce sync.Once + file_transaction_proto_rawDescData = file_transaction_proto_rawDesc +) + +func file_transaction_proto_rawDescGZIP() []byte { + file_transaction_proto_rawDescOnce.Do(func() { + file_transaction_proto_rawDescData = protoimpl.X.CompressGZIP(file_transaction_proto_rawDescData) + }) + return file_transaction_proto_rawDescData +} + +var file_transaction_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_transaction_proto_goTypes = []interface{}{ + (*Transaction)(nil), // 0: models.Transaction +} +var file_transaction_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_transaction_proto_init() } +func file_transaction_proto_init() { + if File_transaction_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_transaction_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Transaction); 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_transaction_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_transaction_proto_goTypes, + DependencyIndexes: file_transaction_proto_depIdxs, + MessageInfos: file_transaction_proto_msgTypes, + }.Build() + File_transaction_proto = out.File + file_transaction_proto_rawDesc = nil + file_transaction_proto_goTypes = nil + file_transaction_proto_depIdxs = nil } diff --git a/src/models/transaction.pb.gorm.go b/src/models/transaction.pb.gorm.go index 70c90e7..df5af00 100644 --- a/src/models/transaction.pb.gorm.go +++ b/src/models/transaction.pb.gorm.go @@ -2,11 +2,9 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type TransactionORM struct { @@ -17,9 +15,9 @@ type TransactionORM struct { Data string DataType string FromAddress string `gorm:"index:transaction_idx_from_address"` - Hash string `gorm:"primary_key"` + Hash string `gorm:"primaryKey"` LogCount int64 - LogIndex int64 `gorm:"primary_key"` + LogIndex int64 `gorm:"primaryKey"` LogsBloom string Method string `gorm:"index:transaction_idx_method"` Nid string @@ -173,7 +171,7 @@ func DefaultCreateTransaction(ctx context.Context, in *Transaction, db *gorm.DB) return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TransactionORMWithAfterCreate_); ok { @@ -203,14 +201,14 @@ func DefaultReadTransaction(ctx context.Context, in *Transaction, db *gorm.DB) ( if ormObj.Hash == "" { return nil, errors.EmptyIdError } + if ormObj.LogIndex == 0 { + return nil, errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(TransactionORMWithBeforeReadApplyQuery); ok { if db, err = hook.BeforeReadApplyQuery(ctx, db); err != nil { return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &TransactionORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -250,6 +248,9 @@ func DefaultDeleteTransaction(ctx context.Context, in *Transaction, db *gorm.DB) if ormObj.Hash == "" { return errors.EmptyIdError } + if ormObj.LogIndex == 0 { + return errors.EmptyIdError + } if hook, ok := interface{}(&ormObj).(TransactionORMWithBeforeDelete_); ok { if db, err = hook.BeforeDelete_(ctx, db); err != nil { return err @@ -272,159 +273,6 @@ type TransactionORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteTransactionSet(ctx context.Context, in []*Transaction, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.Hash == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.Hash) - } - if hook, ok := (interface{}(&TransactionORM{})).(TransactionORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("hash in (?)", keys).Delete(&TransactionORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&TransactionORM{})).(TransactionORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type TransactionORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*Transaction, *gorm.DB) (*gorm.DB, error) -} -type TransactionORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*Transaction, *gorm.DB) error -} - -// DefaultStrictUpdateTransaction clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateTransaction(ctx context.Context, in *Transaction, db *gorm.DB) (*Transaction, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateTransaction") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &TransactionORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("hash=?", ormObj.Hash).First(lockedRow) - if hook, ok := interface{}(&ormObj).(TransactionORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(TransactionORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(TransactionORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type TransactionORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TransactionORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TransactionORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchTransaction executes a basic gorm update call with patch behavior -func DefaultPatchTransaction(ctx context.Context, in *Transaction, updateMask *field_mask.FieldMask, db *gorm.DB) (*Transaction, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj Transaction - var err error - if hook, ok := interface{}(&pbObj).(TransactionWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(TransactionWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskTransaction(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(TransactionWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateTransaction(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(TransactionWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type TransactionWithBeforePatchRead interface { - BeforePatchRead(context.Context, *Transaction, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *Transaction, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionWithBeforePatchSave interface { - BeforePatchSave(context.Context, *Transaction, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionWithAfterPatchSave interface { - AfterPatchSave(context.Context, *Transaction, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetTransaction executes a bulk gorm update call with patch behavior -func DefaultPatchSetTransaction(ctx context.Context, objects []*Transaction, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*Transaction, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*Transaction, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchTransaction(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskTransaction patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskTransaction(ctx context.Context, patchee *Transaction, patcher *Transaction, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*Transaction, error) { if patcher == nil { @@ -569,17 +417,13 @@ func DefaultListTransaction(ctx context.Context, db *gorm.DB) ([]*Transaction, e return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &TransactionORM{}, &Transaction{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("hash") + db = db.Order("hash, log_index") ormResponse := []TransactionORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/transaction_by_address.pb.go b/src/models/transaction_by_address.pb.go index 54be364..3f4bbb6 100644 --- a/src/models/transaction_by_address.pb.go +++ b/src/models/transaction_by_address.pb.go @@ -1,102 +1,174 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: transaction_by_address.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 TransactionByAddress struct { - TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address"` - BlockNumber int64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *TransactionByAddress) Reset() { *m = TransactionByAddress{} } -func (m *TransactionByAddress) String() string { return proto.CompactTextString(m) } -func (*TransactionByAddress) ProtoMessage() {} -func (*TransactionByAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_cbabed12c96da102, []int{0} + TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address"` + BlockNumber int64 `protobuf:"varint,3,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` } -func (m *TransactionByAddress) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransactionByAddress.Unmarshal(m, b) -} -func (m *TransactionByAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransactionByAddress.Marshal(b, m, deterministic) -} -func (m *TransactionByAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionByAddress.Merge(m, src) +func (x *TransactionByAddress) Reset() { + *x = TransactionByAddress{} + if protoimpl.UnsafeEnabled { + mi := &file_transaction_by_address_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TransactionByAddress) XXX_Size() int { - return xxx_messageInfo_TransactionByAddress.Size(m) + +func (x *TransactionByAddress) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TransactionByAddress) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionByAddress.DiscardUnknown(m) + +func (*TransactionByAddress) ProtoMessage() {} + +func (x *TransactionByAddress) ProtoReflect() protoreflect.Message { + mi := &file_transaction_by_address_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) } -var xxx_messageInfo_TransactionByAddress proto.InternalMessageInfo +// Deprecated: Use TransactionByAddress.ProtoReflect.Descriptor instead. +func (*TransactionByAddress) Descriptor() ([]byte, []int) { + return file_transaction_by_address_proto_rawDescGZIP(), []int{0} +} -func (m *TransactionByAddress) GetTransactionHash() string { - if m != nil { - return m.TransactionHash +func (x *TransactionByAddress) GetTransactionHash() string { + if x != nil { + return x.TransactionHash } return "" } -func (m *TransactionByAddress) GetAddress() string { - if m != nil { - return m.Address +func (x *TransactionByAddress) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *TransactionByAddress) GetBlockNumber() int64 { - if m != nil { - return m.BlockNumber +func (x *TransactionByAddress) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber } return 0 } -func init() { - proto.RegisterType((*TransactionByAddress)(nil), "models.TransactionByAddress") +var File_transaction_by_address_proto protoreflect.FileDescriptor + +var file_transaction_by_address_proto_rawDesc = []byte{ + 0x0a, 0x1c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x79, + 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, + 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xcb, 0x01, 0x0a, 0x14, 0x54, 0x72, 0x61, + 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x12, 0x33, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, + 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x22, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, + 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x52, 0x0a, 0x0c, 0x62, 0x6c, + 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x42, 0x2f, 0xba, 0xb9, 0x19, 0x2b, 0x0a, 0x29, 0x52, 0x27, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x62, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x5f, 0x69, 0x64, 0x78, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x3a, 0x06, + 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, + 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_transaction_by_address_proto_rawDescOnce sync.Once + file_transaction_by_address_proto_rawDescData = file_transaction_by_address_proto_rawDesc +) + +func file_transaction_by_address_proto_rawDescGZIP() []byte { + file_transaction_by_address_proto_rawDescOnce.Do(func() { + file_transaction_by_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_transaction_by_address_proto_rawDescData) + }) + return file_transaction_by_address_proto_rawDescData } -func init() { - proto.RegisterFile("transaction_by_address.proto", fileDescriptor_cbabed12c96da102) +var file_transaction_by_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_transaction_by_address_proto_goTypes = []interface{}{ + (*TransactionByAddress)(nil), // 0: models.TransactionByAddress +} +var file_transaction_by_address_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 } -var fileDescriptor_cbabed12c96da102 = []byte{ - // 244 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x29, 0x29, 0x4a, 0xcc, - 0x2b, 0x4e, 0x4c, 0x2e, 0xc9, 0xcc, 0xcf, 0x8b, 0x4f, 0xaa, 0x8c, 0x4f, 0x4c, 0x49, 0x29, 0x4a, - 0x2d, 0x2e, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcb, 0xcd, 0x4f, 0x49, 0xcd, 0x29, - 0x96, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, 0xcc, 0x4b, - 0xcb, 0x4f, 0xca, 0xc9, 0xaf, 0xc8, 0x2f, 0x48, 0xcd, 0xd3, 0x07, 0x2b, 0x4b, 0xd6, 0x4d, 0x4f, - 0xcd, 0xd3, 0x4d, 0xcf, 0x2f, 0xca, 0x85, 0xf0, 0xf5, 0xf3, 0x0b, 0x40, 0xc6, 0x15, 0xeb, 0x83, - 0x84, 0x20, 0x26, 0x29, 0x9d, 0x66, 0xe4, 0x12, 0x09, 0x41, 0x58, 0xe5, 0x54, 0xe9, 0x08, 0xb1, - 0x48, 0xc8, 0x98, 0x4b, 0x00, 0xd9, 0x09, 0x19, 0x89, 0xc5, 0x19, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, - 0x9c, 0x4e, 0x1c, 0xbb, 0x76, 0x4a, 0xb2, 0x70, 0x31, 0x69, 0x30, 0x06, 0xf1, 0x23, 0xa9, 0xf0, - 0x48, 0x2c, 0xce, 0x10, 0x52, 0xe2, 0x62, 0x87, 0x3a, 0x54, 0x82, 0x09, 0x4d, 0x2d, 0x4c, 0x42, - 0x28, 0x88, 0x8b, 0x27, 0x29, 0x27, 0x3f, 0x39, 0x3b, 0x3e, 0xaf, 0x34, 0x37, 0x29, 0xb5, 0x48, - 0x82, 0x59, 0x81, 0x51, 0x83, 0xd9, 0x49, 0x7f, 0xd7, 0x4e, 0x49, 0x6d, 0x2e, 0xcd, 0x20, 0x75, - 0xec, 0xfe, 0x8e, 0xcf, 0x4c, 0xa9, 0x88, 0x47, 0xd6, 0x16, 0xc4, 0x0d, 0xe6, 0xf9, 0x81, 0x39, - 0x56, 0x6c, 0xbb, 0x76, 0x4a, 0x32, 0x71, 0x30, 0x3a, 0x71, 0x45, 0x71, 0xe8, 0xe9, 0x43, 0xc2, - 0x26, 0x89, 0x0d, 0xec, 0x41, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x1a, 0x2d, 0xb5, 0x67, - 0x4a, 0x01, 0x00, 0x00, +func init() { file_transaction_by_address_proto_init() } +func file_transaction_by_address_proto_init() { + if File_transaction_by_address_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_transaction_by_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransactionByAddress); 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_transaction_by_address_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_transaction_by_address_proto_goTypes, + DependencyIndexes: file_transaction_by_address_proto_depIdxs, + MessageInfos: file_transaction_by_address_proto_msgTypes, + }.Build() + File_transaction_by_address_proto = out.File + file_transaction_by_address_proto_rawDesc = nil + file_transaction_by_address_proto_goTypes = nil + file_transaction_by_address_proto_depIdxs = nil } diff --git a/src/models/transaction_by_address.pb.gorm.go b/src/models/transaction_by_address.pb.gorm.go index 0784452..86e5fcb 100644 --- a/src/models/transaction_by_address.pb.gorm.go +++ b/src/models/transaction_by_address.pb.gorm.go @@ -2,17 +2,15 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type TransactionByAddressORM struct { - Address string `gorm:"primary_key"` + Address string `gorm:"primaryKey"` BlockNumber int64 `gorm:"index:transaction_by_address_idx_block_number"` - TransactionHash string `gorm:"primary_key"` + TransactionHash string `gorm:"primaryKey"` } // TableName overrides the default tablename generated by GORM @@ -95,7 +93,7 @@ func DefaultCreateTransactionByAddress(ctx context.Context, in *TransactionByAdd return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TransactionByAddressORMWithAfterCreate_); ok { @@ -122,6 +120,9 @@ func DefaultReadTransactionByAddress(ctx context.Context, in *TransactionByAddre if err != nil { return nil, err } + if ormObj.Address == "" { + return nil, errors.EmptyIdError + } if ormObj.TransactionHash == "" { return nil, errors.EmptyIdError } @@ -130,9 +131,6 @@ func DefaultReadTransactionByAddress(ctx context.Context, in *TransactionByAddre return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &TransactionByAddressORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionByAddressORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -169,6 +167,9 @@ func DefaultDeleteTransactionByAddress(ctx context.Context, in *TransactionByAdd if err != nil { return err } + if ormObj.Address == "" { + return errors.EmptyIdError + } if ormObj.TransactionHash == "" { return errors.EmptyIdError } @@ -194,159 +195,6 @@ type TransactionByAddressORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteTransactionByAddressSet(ctx context.Context, in []*TransactionByAddress, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.TransactionHash == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.TransactionHash) - } - if hook, ok := (interface{}(&TransactionByAddressORM{})).(TransactionByAddressORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("transaction_hash in (?)", keys).Delete(&TransactionByAddressORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&TransactionByAddressORM{})).(TransactionByAddressORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type TransactionByAddressORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*TransactionByAddress, *gorm.DB) (*gorm.DB, error) -} -type TransactionByAddressORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*TransactionByAddress, *gorm.DB) error -} - -// DefaultStrictUpdateTransactionByAddress clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateTransactionByAddress(ctx context.Context, in *TransactionByAddress, db *gorm.DB) (*TransactionByAddress, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateTransactionByAddress") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &TransactionByAddressORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("transaction_hash=?", ormObj.TransactionHash).First(lockedRow) - if hook, ok := interface{}(&ormObj).(TransactionByAddressORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(TransactionByAddressORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(TransactionByAddressORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type TransactionByAddressORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TransactionByAddressORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TransactionByAddressORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchTransactionByAddress executes a basic gorm update call with patch behavior -func DefaultPatchTransactionByAddress(ctx context.Context, in *TransactionByAddress, updateMask *field_mask.FieldMask, db *gorm.DB) (*TransactionByAddress, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj TransactionByAddress - var err error - if hook, ok := interface{}(&pbObj).(TransactionByAddressWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(TransactionByAddressWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskTransactionByAddress(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(TransactionByAddressWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateTransactionByAddress(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(TransactionByAddressWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type TransactionByAddressWithBeforePatchRead interface { - BeforePatchRead(context.Context, *TransactionByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionByAddressWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *TransactionByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionByAddressWithBeforePatchSave interface { - BeforePatchSave(context.Context, *TransactionByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionByAddressWithAfterPatchSave interface { - AfterPatchSave(context.Context, *TransactionByAddress, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetTransactionByAddress executes a bulk gorm update call with patch behavior -func DefaultPatchSetTransactionByAddress(ctx context.Context, objects []*TransactionByAddress, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*TransactionByAddress, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*TransactionByAddress, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchTransactionByAddress(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskTransactionByAddress patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskTransactionByAddress(ctx context.Context, patchee *TransactionByAddress, patcher *TransactionByAddress, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*TransactionByAddress, error) { if patcher == nil { @@ -387,17 +235,13 @@ func DefaultListTransactionByAddress(ctx context.Context, db *gorm.DB) ([]*Trans return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &TransactionByAddressORM{}, &TransactionByAddress{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionByAddressORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("transaction_hash") + db = db.Order("address, transaction_hash") ormResponse := []TransactionByAddressORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err diff --git a/src/models/transaction_create_score.pb.go b/src/models/transaction_create_score.pb.go index 9648771..c09e594 100644 --- a/src/models/transaction_create_score.pb.go +++ b/src/models/transaction_create_score.pb.go @@ -1,101 +1,175 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: transaction_create_score.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 TransactionCreateScore struct { - CreationTransactionHash string `protobuf:"bytes,1,opt,name=creation_transaction_hash,json=creationTransactionHash,proto3" json:"creation_transaction_hash"` - AcceptTransactionHash string `protobuf:"bytes,2,opt,name=accept_transaction_hash,json=acceptTransactionHash,proto3" json:"accept_transaction_hash"` - RejectTransactionHash string `protobuf:"bytes,3,opt,name=reject_transaction_hash,json=rejectTransactionHash,proto3" json:"reject_transaction_hash"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *TransactionCreateScore) Reset() { *m = TransactionCreateScore{} } -func (m *TransactionCreateScore) String() string { return proto.CompactTextString(m) } -func (*TransactionCreateScore) ProtoMessage() {} -func (*TransactionCreateScore) Descriptor() ([]byte, []int) { - return fileDescriptor_104a460f0a080084, []int{0} + CreationTransactionHash string `protobuf:"bytes,1,opt,name=creation_transaction_hash,json=creationTransactionHash,proto3" json:"creation_transaction_hash"` + AcceptTransactionHash string `protobuf:"bytes,2,opt,name=accept_transaction_hash,json=acceptTransactionHash,proto3" json:"accept_transaction_hash"` + RejectTransactionHash string `protobuf:"bytes,3,opt,name=reject_transaction_hash,json=rejectTransactionHash,proto3" json:"reject_transaction_hash"` } -func (m *TransactionCreateScore) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransactionCreateScore.Unmarshal(m, b) -} -func (m *TransactionCreateScore) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransactionCreateScore.Marshal(b, m, deterministic) -} -func (m *TransactionCreateScore) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionCreateScore.Merge(m, src) +func (x *TransactionCreateScore) Reset() { + *x = TransactionCreateScore{} + if protoimpl.UnsafeEnabled { + mi := &file_transaction_create_score_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TransactionCreateScore) XXX_Size() int { - return xxx_messageInfo_TransactionCreateScore.Size(m) + +func (x *TransactionCreateScore) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TransactionCreateScore) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionCreateScore.DiscardUnknown(m) + +func (*TransactionCreateScore) ProtoMessage() {} + +func (x *TransactionCreateScore) ProtoReflect() protoreflect.Message { + mi := &file_transaction_create_score_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) } -var xxx_messageInfo_TransactionCreateScore proto.InternalMessageInfo +// Deprecated: Use TransactionCreateScore.ProtoReflect.Descriptor instead. +func (*TransactionCreateScore) Descriptor() ([]byte, []int) { + return file_transaction_create_score_proto_rawDescGZIP(), []int{0} +} -func (m *TransactionCreateScore) GetCreationTransactionHash() string { - if m != nil { - return m.CreationTransactionHash +func (x *TransactionCreateScore) GetCreationTransactionHash() string { + if x != nil { + return x.CreationTransactionHash } return "" } -func (m *TransactionCreateScore) GetAcceptTransactionHash() string { - if m != nil { - return m.AcceptTransactionHash +func (x *TransactionCreateScore) GetAcceptTransactionHash() string { + if x != nil { + return x.AcceptTransactionHash } return "" } -func (m *TransactionCreateScore) GetRejectTransactionHash() string { - if m != nil { - return m.RejectTransactionHash +func (x *TransactionCreateScore) GetRejectTransactionHash() string { + if x != nil { + return x.RejectTransactionHash } return "" } -func init() { - proto.RegisterType((*TransactionCreateScore)(nil), "models.TransactionCreateScore") +var File_transaction_create_score_proto protoreflect.FileDescriptor + +var file_transaction_create_score_proto_rawDesc = []byte{ + 0x0a, 0x1e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x5f, 0x73, 0x63, 0x6f, 0x72, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, 0x65, + 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x72, + 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, + 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd6, 0x01, 0x0a, 0x16, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x53, 0x63, 0x6f, 0x72, 0x65, 0x12, 0x44, 0x0a, 0x19, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, + 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, + 0x28, 0x01, 0x52, 0x17, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x36, 0x0a, 0x17, 0x61, + 0x63, 0x63, 0x65, 0x70, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x61, 0x63, + 0x63, 0x65, 0x70, 0x74, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, + 0x61, 0x73, 0x68, 0x12, 0x36, 0x0a, 0x17, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x5f, 0x74, 0x72, + 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x72, 0x65, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x3a, 0x06, 0xba, 0xb9, 0x19, + 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_transaction_create_score_proto_rawDescOnce sync.Once + file_transaction_create_score_proto_rawDescData = file_transaction_create_score_proto_rawDesc +) + +func file_transaction_create_score_proto_rawDescGZIP() []byte { + file_transaction_create_score_proto_rawDescOnce.Do(func() { + file_transaction_create_score_proto_rawDescData = protoimpl.X.CompressGZIP(file_transaction_create_score_proto_rawDescData) + }) + return file_transaction_create_score_proto_rawDescData } -func init() { - proto.RegisterFile("transaction_create_score.proto", fileDescriptor_104a460f0a080084) +var file_transaction_create_score_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_transaction_create_score_proto_goTypes = []interface{}{ + (*TransactionCreateScore)(nil), // 0: models.TransactionCreateScore +} +var file_transaction_create_score_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 } -var fileDescriptor_104a460f0a080084 = []byte{ - // 228 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x29, 0x4a, 0xcc, - 0x2b, 0x4e, 0x4c, 0x2e, 0xc9, 0xcc, 0xcf, 0x8b, 0x4f, 0x2e, 0x4a, 0x4d, 0x2c, 0x49, 0x8d, 0x2f, - 0x4e, 0xce, 0x2f, 0x4a, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0xcb, 0xcd, 0x4f, 0x49, - 0xcd, 0x29, 0x96, 0x72, 0x48, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xcf, - 0xcc, 0x4b, 0xcb, 0x4f, 0xca, 0xc9, 0xaf, 0xc8, 0x2f, 0x48, 0xcd, 0xd3, 0x07, 0x2b, 0x4b, 0xd6, - 0x4d, 0x4f, 0xcd, 0xd3, 0x4d, 0xcf, 0x2f, 0xca, 0x85, 0xf0, 0xf5, 0xf3, 0x0b, 0x40, 0x06, 0x16, - 0xeb, 0x83, 0x84, 0x20, 0x26, 0x29, 0x5d, 0x63, 0xe4, 0x12, 0x0b, 0x41, 0x58, 0xe6, 0x0c, 0xb6, - 0x2b, 0x18, 0x64, 0x95, 0x90, 0x0b, 0x97, 0x24, 0xd8, 0x6a, 0x90, 0x1b, 0x90, 0xdd, 0x93, 0x91, - 0x58, 0x9c, 0x21, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe9, 0xc4, 0xb1, 0x6b, 0xa7, 0x24, 0x0b, 0x17, - 0x93, 0x06, 0x63, 0x90, 0x38, 0x4c, 0x29, 0x92, 0x61, 0x1e, 0x89, 0xc5, 0x19, 0x42, 0x66, 0x5c, - 0xe2, 0x89, 0xc9, 0xc9, 0xa9, 0x05, 0x25, 0x98, 0x66, 0x30, 0x81, 0xcc, 0x08, 0x12, 0x85, 0x48, - 0x63, 0xd1, 0x57, 0x94, 0x9a, 0x95, 0x9a, 0x8c, 0x45, 0x1f, 0x33, 0x44, 0x1f, 0x44, 0x1a, 0x4d, - 0x9f, 0x15, 0xdb, 0xae, 0x9d, 0x92, 0x4c, 0x1c, 0x8c, 0x4e, 0x5c, 0x51, 0x1c, 0x7a, 0xfa, 0x90, - 0x60, 0x4a, 0x62, 0x03, 0xfb, 0xd5, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x8d, 0x6f, 0x82, 0xcb, - 0x57, 0x01, 0x00, 0x00, +func init() { file_transaction_create_score_proto_init() } +func file_transaction_create_score_proto_init() { + if File_transaction_create_score_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_transaction_create_score_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransactionCreateScore); 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_transaction_create_score_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_transaction_create_score_proto_goTypes, + DependencyIndexes: file_transaction_create_score_proto_depIdxs, + MessageInfos: file_transaction_create_score_proto_msgTypes, + }.Build() + File_transaction_create_score_proto = out.File + file_transaction_create_score_proto_rawDesc = nil + file_transaction_create_score_proto_goTypes = nil + file_transaction_create_score_proto_depIdxs = nil } diff --git a/src/models/transaction_create_score.pb.gorm.go b/src/models/transaction_create_score.pb.gorm.go index 0620df2..86c5952 100644 --- a/src/models/transaction_create_score.pb.gorm.go +++ b/src/models/transaction_create_score.pb.gorm.go @@ -3,15 +3,14 @@ package models import ( context "context" fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type TransactionCreateScoreORM struct { AcceptTransactionHash string - CreationTransactionHash string `gorm:"primary_key"` + CreationTransactionHash string `gorm:"primaryKey"` RejectTransactionHash string } @@ -95,7 +94,7 @@ func DefaultCreateTransactionCreateScore(ctx context.Context, in *TransactionCre return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TransactionCreateScoreORMWithAfterCreate_); ok { @@ -130,9 +129,6 @@ func DefaultReadTransactionCreateScore(ctx context.Context, in *TransactionCreat return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &TransactionCreateScoreORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionCreateScoreORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -253,7 +249,7 @@ func DefaultStrictUpdateTransactionCreateScore(ctx context.Context, in *Transact return nil, err } } - if err = db.Save(&ormObj).Error; err != nil { + if err = db.Omit().Save(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TransactionCreateScoreORMWithAfterStrictUpdateSave); ok { @@ -387,10 +383,6 @@ func DefaultListTransactionCreateScore(ctx context.Context, db *gorm.DB) ([]*Tra return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &TransactionCreateScoreORM{}, &TransactionCreateScore{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionCreateScoreORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err diff --git a/src/models/transaction_internal_by_address.pb.go b/src/models/transaction_internal_by_address.pb.go index c50d356..6d08542 100644 --- a/src/models/transaction_internal_by_address.pb.go +++ b/src/models/transaction_internal_by_address.pb.go @@ -1,111 +1,183 @@ // Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v5.27.2 // source: transaction_internal_by_address.proto package models import ( - fmt "fmt" - proto "github.com/golang/protobuf/proto" _ "github.com/infobloxopen/protoc-gen-gorm/options" - math "math" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" ) -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package +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 TransactionInternalByAddress struct { - TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` - LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` - Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address"` - BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` -} + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -func (m *TransactionInternalByAddress) Reset() { *m = TransactionInternalByAddress{} } -func (m *TransactionInternalByAddress) String() string { return proto.CompactTextString(m) } -func (*TransactionInternalByAddress) ProtoMessage() {} -func (*TransactionInternalByAddress) Descriptor() ([]byte, []int) { - return fileDescriptor_45c032238ff9de70, []int{0} + TransactionHash string `protobuf:"bytes,1,opt,name=transaction_hash,json=transactionHash,proto3" json:"transaction_hash"` + LogIndex int64 `protobuf:"varint,2,opt,name=log_index,json=logIndex,proto3" json:"log_index"` + Address string `protobuf:"bytes,3,opt,name=address,proto3" json:"address"` + BlockNumber int64 `protobuf:"varint,4,opt,name=block_number,json=blockNumber,proto3" json:"block_number"` } -func (m *TransactionInternalByAddress) XXX_Unmarshal(b []byte) error { - return xxx_messageInfo_TransactionInternalByAddress.Unmarshal(m, b) -} -func (m *TransactionInternalByAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - return xxx_messageInfo_TransactionInternalByAddress.Marshal(b, m, deterministic) -} -func (m *TransactionInternalByAddress) XXX_Merge(src proto.Message) { - xxx_messageInfo_TransactionInternalByAddress.Merge(m, src) +func (x *TransactionInternalByAddress) Reset() { + *x = TransactionInternalByAddress{} + if protoimpl.UnsafeEnabled { + mi := &file_transaction_internal_by_address_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } } -func (m *TransactionInternalByAddress) XXX_Size() int { - return xxx_messageInfo_TransactionInternalByAddress.Size(m) + +func (x *TransactionInternalByAddress) String() string { + return protoimpl.X.MessageStringOf(x) } -func (m *TransactionInternalByAddress) XXX_DiscardUnknown() { - xxx_messageInfo_TransactionInternalByAddress.DiscardUnknown(m) + +func (*TransactionInternalByAddress) ProtoMessage() {} + +func (x *TransactionInternalByAddress) ProtoReflect() protoreflect.Message { + mi := &file_transaction_internal_by_address_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) } -var xxx_messageInfo_TransactionInternalByAddress proto.InternalMessageInfo +// Deprecated: Use TransactionInternalByAddress.ProtoReflect.Descriptor instead. +func (*TransactionInternalByAddress) Descriptor() ([]byte, []int) { + return file_transaction_internal_by_address_proto_rawDescGZIP(), []int{0} +} -func (m *TransactionInternalByAddress) GetTransactionHash() string { - if m != nil { - return m.TransactionHash +func (x *TransactionInternalByAddress) GetTransactionHash() string { + if x != nil { + return x.TransactionHash } return "" } -func (m *TransactionInternalByAddress) GetLogIndex() int64 { - if m != nil { - return m.LogIndex +func (x *TransactionInternalByAddress) GetLogIndex() int64 { + if x != nil { + return x.LogIndex } return 0 } -func (m *TransactionInternalByAddress) GetAddress() string { - if m != nil { - return m.Address +func (x *TransactionInternalByAddress) GetAddress() string { + if x != nil { + return x.Address } return "" } -func (m *TransactionInternalByAddress) GetBlockNumber() int64 { - if m != nil { - return m.BlockNumber +func (x *TransactionInternalByAddress) GetBlockNumber() int64 { + if x != nil { + return x.BlockNumber } return 0 } -func init() { - proto.RegisterType((*TransactionInternalByAddress)(nil), "models.TransactionInternalByAddress") +var File_transaction_internal_by_address_proto protoreflect.FileDescriptor + +var file_transaction_internal_by_address_proto_rawDesc = []byte{ + 0x0a, 0x25, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x62, 0x79, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x1a, + 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x69, 0x6e, 0x66, 0x6f, + 0x62, 0x6c, 0x6f, 0x78, 0x6f, 0x70, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x2d, + 0x67, 0x65, 0x6e, 0x2d, 0x67, 0x6f, 0x72, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6f, + 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x67, 0x6f, 0x72, 0x6d, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x1c, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x42, 0x79, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x33, 0x0a, 0x10, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x68, 0x61, 0x73, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x08, 0xba, 0xb9, + 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x73, 0x68, 0x12, 0x25, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x69, + 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x42, 0x08, 0xba, 0xb9, 0x19, 0x04, + 0x0a, 0x02, 0x28, 0x01, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x22, + 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, + 0x08, 0xba, 0xb9, 0x19, 0x04, 0x0a, 0x02, 0x28, 0x01, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x5f, 0x6e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 0x3a, 0x06, 0xba, 0xb9, 0x19, 0x02, 0x08, 0x01, 0x42, 0x0a, 0x5a, + 0x08, 0x2e, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, +} + +var ( + file_transaction_internal_by_address_proto_rawDescOnce sync.Once + file_transaction_internal_by_address_proto_rawDescData = file_transaction_internal_by_address_proto_rawDesc +) + +func file_transaction_internal_by_address_proto_rawDescGZIP() []byte { + file_transaction_internal_by_address_proto_rawDescOnce.Do(func() { + file_transaction_internal_by_address_proto_rawDescData = protoimpl.X.CompressGZIP(file_transaction_internal_by_address_proto_rawDescData) + }) + return file_transaction_internal_by_address_proto_rawDescData } -func init() { - proto.RegisterFile("transaction_internal_by_address.proto", fileDescriptor_45c032238ff9de70) +var file_transaction_internal_by_address_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_transaction_internal_by_address_proto_goTypes = []interface{}{ + (*TransactionInternalByAddress)(nil), // 0: models.TransactionInternalByAddress +} +var file_transaction_internal_by_address_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 } -var fileDescriptor_45c032238ff9de70 = []byte{ - // 258 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xb1, 0x4e, 0xc3, 0x30, - 0x18, 0x84, 0xe5, 0xb4, 0x0a, 0xa9, 0x41, 0x02, 0x79, 0x4a, 0x11, 0x43, 0xa9, 0x54, 0x29, 0x4b, - 0xe3, 0xa1, 0x1b, 0x13, 0x64, 0xa2, 0x0b, 0x43, 0xc5, 0xc4, 0x62, 0xd9, 0x89, 0x71, 0x2c, 0x1c, - 0xff, 0x91, 0xed, 0x4a, 0xed, 0xa3, 0xb5, 0x6f, 0xc0, 0x5b, 0xa1, 0x24, 0x45, 0x44, 0x8c, 0xbe, - 0x3b, 0x7d, 0xe7, 0xfb, 0xf1, 0x2a, 0x38, 0x6e, 0x3d, 0x2f, 0x83, 0x06, 0xcb, 0xb4, 0x0d, 0xd2, - 0x59, 0x6e, 0x98, 0x38, 0x32, 0x5e, 0x55, 0x4e, 0x7a, 0x9f, 0xb7, 0x0e, 0x02, 0x90, 0xb8, 0x81, - 0x4a, 0x1a, 0x7f, 0xff, 0xac, 0x74, 0xa8, 0xf7, 0x22, 0x2f, 0xa1, 0xa1, 0xda, 0x7e, 0x82, 0x30, - 0x70, 0x80, 0x56, 0x5a, 0xda, 0xc7, 0xca, 0xb5, 0x92, 0x76, 0xad, 0xc0, 0x35, 0xc3, 0x9b, 0x42, - 0xdb, 0x71, 0x3d, 0xed, 0xa4, 0x81, 0xb4, 0xfc, 0x46, 0xf8, 0xe1, 0xfd, 0xaf, 0x73, 0x7b, 0xa9, - 0x2c, 0x8e, 0x2f, 0x43, 0x21, 0xd9, 0xe0, 0xbb, 0xf1, 0x9f, 0x6a, 0xee, 0xeb, 0x14, 0x2d, 0x50, - 0x36, 0x2b, 0x92, 0xf3, 0x69, 0x3e, 0xc5, 0x51, 0x86, 0x76, 0xb7, 0xa3, 0xc4, 0x2b, 0xf7, 0x35, - 0x59, 0xe1, 0x99, 0x01, 0xc5, 0xb4, 0xad, 0xe4, 0x21, 0x8d, 0x16, 0x28, 0x9b, 0x8c, 0xd2, 0x89, - 0x01, 0xb5, 0xed, 0x1c, 0xb2, 0xc4, 0x57, 0x97, 0x5d, 0xe9, 0xe4, 0x1f, 0xf2, 0xd7, 0x20, 0x8f, - 0xf8, 0x46, 0x18, 0x28, 0xbf, 0x98, 0xdd, 0x37, 0x42, 0xba, 0x74, 0xda, 0xd1, 0x76, 0xd7, 0xbd, - 0xf6, 0xd6, 0x4b, 0x4f, 0xf1, 0xf9, 0x34, 0x8f, 0x12, 0x54, 0xe0, 0x8f, 0x24, 0xa7, 0xc3, 0x65, - 0x44, 0xdc, 0xcf, 0xdb, 0xfc, 0x04, 0x00, 0x00, 0xff, 0xff, 0xf2, 0x6e, 0x77, 0x4e, 0x51, 0x01, - 0x00, 0x00, +func init() { file_transaction_internal_by_address_proto_init() } +func file_transaction_internal_by_address_proto_init() { + if File_transaction_internal_by_address_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_transaction_internal_by_address_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*TransactionInternalByAddress); 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_transaction_internal_by_address_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_transaction_internal_by_address_proto_goTypes, + DependencyIndexes: file_transaction_internal_by_address_proto_depIdxs, + MessageInfos: file_transaction_internal_by_address_proto_msgTypes, + }.Build() + File_transaction_internal_by_address_proto = out.File + file_transaction_internal_by_address_proto_rawDesc = nil + file_transaction_internal_by_address_proto_goTypes = nil + file_transaction_internal_by_address_proto_depIdxs = nil } diff --git a/src/models/transaction_internal_by_address.pb.gorm.go b/src/models/transaction_internal_by_address.pb.gorm.go index 45d9d3a..4ef212d 100644 --- a/src/models/transaction_internal_by_address.pb.gorm.go +++ b/src/models/transaction_internal_by_address.pb.gorm.go @@ -2,18 +2,16 @@ package models import ( context "context" - fmt "fmt" - gorm1 "github.com/infobloxopen/atlas-app-toolkit/gorm" errors "github.com/infobloxopen/protoc-gen-gorm/errors" - gorm "github.com/jinzhu/gorm" field_mask "google.golang.org/genproto/protobuf/field_mask" + gorm "gorm.io/gorm" ) type TransactionInternalByAddressORM struct { - Address string `gorm:"primary_key"` + Address string `gorm:"primaryKey"` BlockNumber int64 - LogIndex int64 `gorm:"primary_key"` - TransactionHash string `gorm:"primary_key"` + LogIndex int64 `gorm:"primaryKey"` + TransactionHash string `gorm:"primaryKey"` } // TableName overrides the default tablename generated by GORM @@ -98,7 +96,7 @@ func DefaultCreateTransactionInternalByAddress(ctx context.Context, in *Transact return nil, err } } - if err = db.Create(&ormObj).Error; err != nil { + if err = db.Omit().Create(&ormObj).Error; err != nil { return nil, err } if hook, ok := interface{}(&ormObj).(TransactionInternalByAddressORMWithAfterCreate_); ok { @@ -125,6 +123,12 @@ func DefaultReadTransactionInternalByAddress(ctx context.Context, in *Transactio if err != nil { return nil, err } + if ormObj.Address == "" { + return nil, errors.EmptyIdError + } + if ormObj.LogIndex == 0 { + return nil, errors.EmptyIdError + } if ormObj.TransactionHash == "" { return nil, errors.EmptyIdError } @@ -133,9 +137,6 @@ func DefaultReadTransactionInternalByAddress(ctx context.Context, in *Transactio return nil, err } } - if db, err = gorm1.ApplyFieldSelection(ctx, db, nil, &TransactionInternalByAddressORM{}); err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionInternalByAddressORMWithBeforeReadFind); ok { if db, err = hook.BeforeReadFind(ctx, db); err != nil { return nil, err @@ -172,6 +173,12 @@ func DefaultDeleteTransactionInternalByAddress(ctx context.Context, in *Transact if err != nil { return err } + if ormObj.Address == "" { + return errors.EmptyIdError + } + if ormObj.LogIndex == 0 { + return errors.EmptyIdError + } if ormObj.TransactionHash == "" { return errors.EmptyIdError } @@ -197,159 +204,6 @@ type TransactionInternalByAddressORMWithAfterDelete_ interface { AfterDelete_(context.Context, *gorm.DB) error } -func DefaultDeleteTransactionInternalByAddressSet(ctx context.Context, in []*TransactionInternalByAddress, db *gorm.DB) error { - if in == nil { - return errors.NilArgumentError - } - var err error - keys := []string{} - for _, obj := range in { - ormObj, err := obj.ToORM(ctx) - if err != nil { - return err - } - if ormObj.TransactionHash == "" { - return errors.EmptyIdError - } - keys = append(keys, ormObj.TransactionHash) - } - if hook, ok := (interface{}(&TransactionInternalByAddressORM{})).(TransactionInternalByAddressORMWithBeforeDeleteSet); ok { - if db, err = hook.BeforeDeleteSet(ctx, in, db); err != nil { - return err - } - } - err = db.Where("transaction_hash in (?)", keys).Delete(&TransactionInternalByAddressORM{}).Error - if err != nil { - return err - } - if hook, ok := (interface{}(&TransactionInternalByAddressORM{})).(TransactionInternalByAddressORMWithAfterDeleteSet); ok { - err = hook.AfterDeleteSet(ctx, in, db) - } - return err -} - -type TransactionInternalByAddressORMWithBeforeDeleteSet interface { - BeforeDeleteSet(context.Context, []*TransactionInternalByAddress, *gorm.DB) (*gorm.DB, error) -} -type TransactionInternalByAddressORMWithAfterDeleteSet interface { - AfterDeleteSet(context.Context, []*TransactionInternalByAddress, *gorm.DB) error -} - -// DefaultStrictUpdateTransactionInternalByAddress clears / replaces / appends first level 1:many children and then executes a gorm update call -func DefaultStrictUpdateTransactionInternalByAddress(ctx context.Context, in *TransactionInternalByAddress, db *gorm.DB) (*TransactionInternalByAddress, error) { - if in == nil { - return nil, fmt.Errorf("Nil argument to DefaultStrictUpdateTransactionInternalByAddress") - } - ormObj, err := in.ToORM(ctx) - if err != nil { - return nil, err - } - lockedRow := &TransactionInternalByAddressORM{} - db.Model(&ormObj).Set("gorm:query_option", "FOR UPDATE").Where("transaction_hash=?", ormObj.TransactionHash).First(lockedRow) - if hook, ok := interface{}(&ormObj).(TransactionInternalByAddressORMWithBeforeStrictUpdateCleanup); ok { - if db, err = hook.BeforeStrictUpdateCleanup(ctx, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&ormObj).(TransactionInternalByAddressORMWithBeforeStrictUpdateSave); ok { - if db, err = hook.BeforeStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - if err = db.Save(&ormObj).Error; err != nil { - return nil, err - } - if hook, ok := interface{}(&ormObj).(TransactionInternalByAddressORMWithAfterStrictUpdateSave); ok { - if err = hook.AfterStrictUpdateSave(ctx, db); err != nil { - return nil, err - } - } - pbResponse, err := ormObj.ToPB(ctx) - if err != nil { - return nil, err - } - return &pbResponse, err -} - -type TransactionInternalByAddressORMWithBeforeStrictUpdateCleanup interface { - BeforeStrictUpdateCleanup(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TransactionInternalByAddressORMWithBeforeStrictUpdateSave interface { - BeforeStrictUpdateSave(context.Context, *gorm.DB) (*gorm.DB, error) -} -type TransactionInternalByAddressORMWithAfterStrictUpdateSave interface { - AfterStrictUpdateSave(context.Context, *gorm.DB) error -} - -// DefaultPatchTransactionInternalByAddress executes a basic gorm update call with patch behavior -func DefaultPatchTransactionInternalByAddress(ctx context.Context, in *TransactionInternalByAddress, updateMask *field_mask.FieldMask, db *gorm.DB) (*TransactionInternalByAddress, error) { - if in == nil { - return nil, errors.NilArgumentError - } - var pbObj TransactionInternalByAddress - var err error - if hook, ok := interface{}(&pbObj).(TransactionInternalByAddressWithBeforePatchRead); ok { - if db, err = hook.BeforePatchRead(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if hook, ok := interface{}(&pbObj).(TransactionInternalByAddressWithBeforePatchApplyFieldMask); ok { - if db, err = hook.BeforePatchApplyFieldMask(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - if _, err := DefaultApplyFieldMaskTransactionInternalByAddress(ctx, &pbObj, in, updateMask, "", db); err != nil { - return nil, err - } - if hook, ok := interface{}(&pbObj).(TransactionInternalByAddressWithBeforePatchSave); ok { - if db, err = hook.BeforePatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - pbResponse, err := DefaultStrictUpdateTransactionInternalByAddress(ctx, &pbObj, db) - if err != nil { - return nil, err - } - if hook, ok := interface{}(pbResponse).(TransactionInternalByAddressWithAfterPatchSave); ok { - if err = hook.AfterPatchSave(ctx, in, updateMask, db); err != nil { - return nil, err - } - } - return pbResponse, nil -} - -type TransactionInternalByAddressWithBeforePatchRead interface { - BeforePatchRead(context.Context, *TransactionInternalByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionInternalByAddressWithBeforePatchApplyFieldMask interface { - BeforePatchApplyFieldMask(context.Context, *TransactionInternalByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionInternalByAddressWithBeforePatchSave interface { - BeforePatchSave(context.Context, *TransactionInternalByAddress, *field_mask.FieldMask, *gorm.DB) (*gorm.DB, error) -} -type TransactionInternalByAddressWithAfterPatchSave interface { - AfterPatchSave(context.Context, *TransactionInternalByAddress, *field_mask.FieldMask, *gorm.DB) error -} - -// DefaultPatchSetTransactionInternalByAddress executes a bulk gorm update call with patch behavior -func DefaultPatchSetTransactionInternalByAddress(ctx context.Context, objects []*TransactionInternalByAddress, updateMasks []*field_mask.FieldMask, db *gorm.DB) ([]*TransactionInternalByAddress, error) { - if len(objects) != len(updateMasks) { - return nil, fmt.Errorf(errors.BadRepeatedFieldMaskTpl, len(updateMasks), len(objects)) - } - - results := make([]*TransactionInternalByAddress, 0, len(objects)) - for i, patcher := range objects { - pbResponse, err := DefaultPatchTransactionInternalByAddress(ctx, patcher, updateMasks[i], db) - if err != nil { - return nil, err - } - - results = append(results, pbResponse) - } - - return results, nil -} - // DefaultApplyFieldMaskTransactionInternalByAddress patches an pbObject with patcher according to a field mask. func DefaultApplyFieldMaskTransactionInternalByAddress(ctx context.Context, patchee *TransactionInternalByAddress, patcher *TransactionInternalByAddress, updateMask *field_mask.FieldMask, prefix string, db *gorm.DB) (*TransactionInternalByAddress, error) { if patcher == nil { @@ -394,17 +248,13 @@ func DefaultListTransactionInternalByAddress(ctx context.Context, db *gorm.DB) ( return nil, err } } - db, err = gorm1.ApplyCollectionOperators(ctx, db, &TransactionInternalByAddressORM{}, &TransactionInternalByAddress{}, nil, nil, nil, nil) - if err != nil { - return nil, err - } if hook, ok := interface{}(&ormObj).(TransactionInternalByAddressORMWithBeforeListFind); ok { if db, err = hook.BeforeListFind(ctx, db); err != nil { return nil, err } } db = db.Where(&ormObj) - db = db.Order("transaction_hash") + db = db.Order("address, log_index, transaction_hash") ormResponse := []TransactionInternalByAddressORM{} if err := db.Find(&ormResponse).Error; err != nil { return nil, err