github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/node/models/micro_block_header.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 strfmt "github.com/go-openapi/strfmt" 10 11 "github.com/go-openapi/errors" 12 "github.com/go-openapi/swag" 13 "github.com/go-openapi/validate" 14 ) 15 16 // MicroBlockHeader micro block header 17 // swagger:model MicroBlockHeader 18 type MicroBlockHeader struct { 19 20 // hash 21 // Required: true 22 Hash *string `json:"hash"` 23 24 // height 25 // Required: true 26 Height *uint64 `json:"height"` 27 28 // "no_fraud" | api encoded Proof of Fraud hash 29 // Required: true 30 PofHash *string `json:"pof_hash"` 31 32 // prev hash 33 // Required: true 34 PrevHash *string `json:"prev_hash"` 35 36 // prev key hash 37 // Required: true 38 PrevKeyHash *string `json:"prev_key_hash"` 39 40 // signature 41 // Required: true 42 Signature *string `json:"signature"` 43 44 // state hash 45 // Required: true 46 StateHash *string `json:"state_hash"` 47 48 // time 49 // Required: true 50 Time *uint64 `json:"time"` 51 52 // txs hash 53 // Required: true 54 TxsHash *string `json:"txs_hash"` 55 56 // version 57 // Required: true 58 Version *uint32 `json:"version"` 59 } 60 61 // Validate validates this micro block header 62 func (m *MicroBlockHeader) Validate(formats strfmt.Registry) error { 63 var res []error 64 65 if err := m.validateHash(formats); err != nil { 66 res = append(res, err) 67 } 68 69 if err := m.validateHeight(formats); err != nil { 70 res = append(res, err) 71 } 72 73 if err := m.validatePofHash(formats); err != nil { 74 res = append(res, err) 75 } 76 77 if err := m.validatePrevHash(formats); err != nil { 78 res = append(res, err) 79 } 80 81 if err := m.validatePrevKeyHash(formats); err != nil { 82 res = append(res, err) 83 } 84 85 if err := m.validateSignature(formats); err != nil { 86 res = append(res, err) 87 } 88 89 if err := m.validateStateHash(formats); err != nil { 90 res = append(res, err) 91 } 92 93 if err := m.validateTime(formats); err != nil { 94 res = append(res, err) 95 } 96 97 if err := m.validateTxsHash(formats); err != nil { 98 res = append(res, err) 99 } 100 101 if err := m.validateVersion(formats); err != nil { 102 res = append(res, err) 103 } 104 105 if len(res) > 0 { 106 return errors.CompositeValidationError(res...) 107 } 108 return nil 109 } 110 111 func (m *MicroBlockHeader) validateHash(formats strfmt.Registry) error { 112 113 if err := validate.Required("hash", "body", m.Hash); err != nil { 114 return err 115 } 116 117 return nil 118 } 119 120 func (m *MicroBlockHeader) validateHeight(formats strfmt.Registry) error { 121 122 if err := validate.Required("height", "body", m.Height); err != nil { 123 return err 124 } 125 126 return nil 127 } 128 129 func (m *MicroBlockHeader) validatePofHash(formats strfmt.Registry) error { 130 131 if err := validate.Required("pof_hash", "body", m.PofHash); err != nil { 132 return err 133 } 134 135 return nil 136 } 137 138 func (m *MicroBlockHeader) validatePrevHash(formats strfmt.Registry) error { 139 140 if err := validate.Required("prev_hash", "body", m.PrevHash); err != nil { 141 return err 142 } 143 144 return nil 145 } 146 147 func (m *MicroBlockHeader) validatePrevKeyHash(formats strfmt.Registry) error { 148 149 if err := validate.Required("prev_key_hash", "body", m.PrevKeyHash); err != nil { 150 return err 151 } 152 153 return nil 154 } 155 156 func (m *MicroBlockHeader) validateSignature(formats strfmt.Registry) error { 157 158 if err := validate.Required("signature", "body", m.Signature); err != nil { 159 return err 160 } 161 162 return nil 163 } 164 165 func (m *MicroBlockHeader) validateStateHash(formats strfmt.Registry) error { 166 167 if err := validate.Required("state_hash", "body", m.StateHash); err != nil { 168 return err 169 } 170 171 return nil 172 } 173 174 func (m *MicroBlockHeader) validateTime(formats strfmt.Registry) error { 175 176 if err := validate.Required("time", "body", m.Time); err != nil { 177 return err 178 } 179 180 return nil 181 } 182 183 func (m *MicroBlockHeader) validateTxsHash(formats strfmt.Registry) error { 184 185 if err := validate.Required("txs_hash", "body", m.TxsHash); err != nil { 186 return err 187 } 188 189 return nil 190 } 191 192 func (m *MicroBlockHeader) validateVersion(formats strfmt.Registry) error { 193 194 if err := validate.Required("version", "body", m.Version); err != nil { 195 return err 196 } 197 198 return nil 199 } 200 201 // MarshalBinary interface implementation 202 func (m *MicroBlockHeader) MarshalBinary() ([]byte, error) { 203 if m == nil { 204 return nil, nil 205 } 206 return swag.WriteJSON(m) 207 } 208 209 // UnmarshalBinary interface implementation 210 func (m *MicroBlockHeader) UnmarshalBinary(b []byte) error { 211 var res MicroBlockHeader 212 if err := swag.ReadJSON(b, &res); err != nil { 213 return err 214 } 215 *m = res 216 return nil 217 }