scaffold type --module der DER zigbeeID dirigeraID dirigeraMAC plmntAddress liquidAddress

Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
Jürgen Eckel 2025-05-20 16:57:54 +02:00
parent ba8cd80ee3
commit d3edf76a45
No known key found for this signature in database
2 changed files with 535 additions and 0 deletions

View File

@ -0,0 +1,13 @@
syntax = "proto3";
package planetmintgo.der;
option go_package = "github.com/planetmint/planetmint-go/x/der/types";
message DER {
string zigbeeID = 1;
string dirigeraID = 2;
string dirigeraMAC = 3;
string plmntAddress = 4;
string liquidAddress = 5;
}

522
x/der/types/der.pb.go Normal file
View File

@ -0,0 +1,522 @@
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: planetmintgo/der/der.proto
package types
import (
fmt "fmt"
proto "github.com/cosmos/gogoproto/proto"
io "io"
math "math"
math_bits "math/bits"
)
// 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.GoGoProtoPackageIsVersion3 // please upgrade the proto package
type DER struct {
ZigbeeID string `protobuf:"bytes,1,opt,name=zigbeeID,proto3" json:"zigbeeID,omitempty"`
DirigeraID string `protobuf:"bytes,2,opt,name=dirigeraID,proto3" json:"dirigeraID,omitempty"`
DirigeraMAC string `protobuf:"bytes,3,opt,name=dirigeraMAC,proto3" json:"dirigeraMAC,omitempty"`
PlmntAddress string `protobuf:"bytes,4,opt,name=plmntAddress,proto3" json:"plmntAddress,omitempty"`
LiquidAddress string `protobuf:"bytes,5,opt,name=liquidAddress,proto3" json:"liquidAddress,omitempty"`
}
func (m *DER) Reset() { *m = DER{} }
func (m *DER) String() string { return proto.CompactTextString(m) }
func (*DER) ProtoMessage() {}
func (*DER) Descriptor() ([]byte, []int) {
return fileDescriptor_6380e8122e200808, []int{0}
}
func (m *DER) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *DER) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_DER.Marshal(b, m, deterministic)
} else {
b = b[:cap(b)]
n, err := m.MarshalToSizedBuffer(b)
if err != nil {
return nil, err
}
return b[:n], nil
}
}
func (m *DER) XXX_Merge(src proto.Message) {
xxx_messageInfo_DER.Merge(m, src)
}
func (m *DER) XXX_Size() int {
return m.Size()
}
func (m *DER) XXX_DiscardUnknown() {
xxx_messageInfo_DER.DiscardUnknown(m)
}
var xxx_messageInfo_DER proto.InternalMessageInfo
func (m *DER) GetZigbeeID() string {
if m != nil {
return m.ZigbeeID
}
return ""
}
func (m *DER) GetDirigeraID() string {
if m != nil {
return m.DirigeraID
}
return ""
}
func (m *DER) GetDirigeraMAC() string {
if m != nil {
return m.DirigeraMAC
}
return ""
}
func (m *DER) GetPlmntAddress() string {
if m != nil {
return m.PlmntAddress
}
return ""
}
func (m *DER) GetLiquidAddress() string {
if m != nil {
return m.LiquidAddress
}
return ""
}
func init() {
proto.RegisterType((*DER)(nil), "planetmintgo.der.DER")
}
func init() { proto.RegisterFile("planetmintgo/der/der.proto", fileDescriptor_6380e8122e200808) }
var fileDescriptor_6380e8122e200808 = []byte{
// 222 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0xc8, 0x49, 0xcc,
0x4b, 0x2d, 0xc9, 0xcd, 0xcc, 0x2b, 0x49, 0xcf, 0xd7, 0x4f, 0x49, 0x2d, 0x02, 0x61, 0xbd, 0x82,
0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x01, 0x64, 0x39, 0xbd, 0x94, 0xd4, 0x22, 0xa5, 0xb5, 0x8c, 0x5c,
0xcc, 0x2e, 0xae, 0x41, 0x42, 0x52, 0x5c, 0x1c, 0x55, 0x99, 0xe9, 0x49, 0xa9, 0xa9, 0x9e, 0x2e,
0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x70, 0xbe, 0x90, 0x1c, 0x17, 0x57, 0x4a, 0x66, 0x51,
0x66, 0x7a, 0x6a, 0x51, 0xa2, 0xa7, 0x8b, 0x04, 0x13, 0x58, 0x16, 0x49, 0x44, 0x48, 0x81, 0x8b,
0x1b, 0xc6, 0xf3, 0x75, 0x74, 0x96, 0x60, 0x06, 0x2b, 0x40, 0x16, 0x12, 0x52, 0xe2, 0xe2, 0x29,
0xc8, 0xc9, 0xcd, 0x2b, 0x71, 0x4c, 0x49, 0x29, 0x4a, 0x2d, 0x2e, 0x96, 0x60, 0x01, 0x2b, 0x41,
0x11, 0x13, 0x52, 0xe1, 0xe2, 0xcd, 0xc9, 0x2c, 0x2c, 0xcd, 0x4c, 0x81, 0x29, 0x62, 0x05, 0x2b,
0x42, 0x15, 0x74, 0xf2, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4,
0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xfd,
0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x84, 0x37, 0x91, 0x98, 0xba,
0xe9, 0xf9, 0xfa, 0x15, 0xe0, 0x00, 0x29, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0x89,
0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x47, 0x01, 0xf0, 0x5d, 0x31, 0x01, 0x00, 0x00,
}
func (m *DER) Marshal() (dAtA []byte, err error) {
size := m.Size()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBuffer(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *DER) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *DER) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.LiquidAddress) > 0 {
i -= len(m.LiquidAddress)
copy(dAtA[i:], m.LiquidAddress)
i = encodeVarintDer(dAtA, i, uint64(len(m.LiquidAddress)))
i--
dAtA[i] = 0x2a
}
if len(m.PlmntAddress) > 0 {
i -= len(m.PlmntAddress)
copy(dAtA[i:], m.PlmntAddress)
i = encodeVarintDer(dAtA, i, uint64(len(m.PlmntAddress)))
i--
dAtA[i] = 0x22
}
if len(m.DirigeraMAC) > 0 {
i -= len(m.DirigeraMAC)
copy(dAtA[i:], m.DirigeraMAC)
i = encodeVarintDer(dAtA, i, uint64(len(m.DirigeraMAC)))
i--
dAtA[i] = 0x1a
}
if len(m.DirigeraID) > 0 {
i -= len(m.DirigeraID)
copy(dAtA[i:], m.DirigeraID)
i = encodeVarintDer(dAtA, i, uint64(len(m.DirigeraID)))
i--
dAtA[i] = 0x12
}
if len(m.ZigbeeID) > 0 {
i -= len(m.ZigbeeID)
copy(dAtA[i:], m.ZigbeeID)
i = encodeVarintDer(dAtA, i, uint64(len(m.ZigbeeID)))
i--
dAtA[i] = 0xa
}
return len(dAtA) - i, nil
}
func encodeVarintDer(dAtA []byte, offset int, v uint64) int {
offset -= sovDer(v)
base := offset
for v >= 1<<7 {
dAtA[offset] = uint8(v&0x7f | 0x80)
v >>= 7
offset++
}
dAtA[offset] = uint8(v)
return base
}
func (m *DER) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
l = len(m.ZigbeeID)
if l > 0 {
n += 1 + l + sovDer(uint64(l))
}
l = len(m.DirigeraID)
if l > 0 {
n += 1 + l + sovDer(uint64(l))
}
l = len(m.DirigeraMAC)
if l > 0 {
n += 1 + l + sovDer(uint64(l))
}
l = len(m.PlmntAddress)
if l > 0 {
n += 1 + l + sovDer(uint64(l))
}
l = len(m.LiquidAddress)
if l > 0 {
n += 1 + l + sovDer(uint64(l))
}
return n
}
func sovDer(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7
}
func sozDer(x uint64) (n int) {
return sovDer(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *DER) Unmarshal(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowDer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: DER: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: DER: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field ZigbeeID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowDer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthDer
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthDer
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.ZigbeeID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 2:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DirigeraID", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowDer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthDer
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthDer
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DirigeraID = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 3:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field DirigeraMAC", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowDer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthDer
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthDer
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.DirigeraMAC = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 4:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field PlmntAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowDer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthDer
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthDer
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.PlmntAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
case 5:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field LiquidAddress", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return ErrIntOverflowDer
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return ErrInvalidLengthDer
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return ErrInvalidLengthDer
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.LiquidAddress = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := skipDer(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return ErrInvalidLengthDer
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}
func skipDer(dAtA []byte) (n int, err error) {
l := len(dAtA)
iNdEx := 0
depth := 0
for iNdEx < l {
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowDer
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= (uint64(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
wireType := int(wire & 0x7)
switch wireType {
case 0:
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowDer
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
iNdEx++
if dAtA[iNdEx-1] < 0x80 {
break
}
}
case 1:
iNdEx += 8
case 2:
var length int
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return 0, ErrIntOverflowDer
}
if iNdEx >= l {
return 0, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
length |= (int(b) & 0x7F) << shift
if b < 0x80 {
break
}
}
if length < 0 {
return 0, ErrInvalidLengthDer
}
iNdEx += length
case 3:
depth++
case 4:
if depth == 0 {
return 0, ErrUnexpectedEndOfGroupDer
}
depth--
case 5:
iNdEx += 4
default:
return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
}
if iNdEx < 0 {
return 0, ErrInvalidLengthDer
}
if depth == 0 {
return iNdEx, nil
}
}
return 0, io.ErrUnexpectedEOF
}
var (
ErrInvalidLengthDer = fmt.Errorf("proto: negative length found during unmarshaling")
ErrIntOverflowDer = fmt.Errorf("proto: integer overflow")
ErrUnexpectedEndOfGroupDer = fmt.Errorf("proto: unexpected end of group")
)