github.com/aeternity/aepp-sdk-go@v1.0.3-0.20190606142815-1c0ffdc21fd9/generated/models/contract_store_store.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  )
    14  
    15  // ContractStoreStore contract store store
    16  // swagger:model ContractStore_store
    17  type ContractStoreStore struct {
    18  
    19  	// key
    20  	Key string `json:"key,omitempty"`
    21  
    22  	// value
    23  	Value EncodedByteArray `json:"value,omitempty"`
    24  }
    25  
    26  // Validate validates this contract store store
    27  func (m *ContractStoreStore) Validate(formats strfmt.Registry) error {
    28  	var res []error
    29  
    30  	if err := m.validateValue(formats); err != nil {
    31  		res = append(res, err)
    32  	}
    33  
    34  	if len(res) > 0 {
    35  		return errors.CompositeValidationError(res...)
    36  	}
    37  	return nil
    38  }
    39  
    40  func (m *ContractStoreStore) validateValue(formats strfmt.Registry) error {
    41  
    42  	if swag.IsZero(m.Value) { // not required
    43  		return nil
    44  	}
    45  
    46  	if err := m.Value.Validate(formats); err != nil {
    47  		if ve, ok := err.(*errors.Validation); ok {
    48  			return ve.ValidateName("value")
    49  		}
    50  		return err
    51  	}
    52  
    53  	return nil
    54  }
    55  
    56  // MarshalBinary interface implementation
    57  func (m *ContractStoreStore) MarshalBinary() ([]byte, error) {
    58  	if m == nil {
    59  		return nil, nil
    60  	}
    61  	return swag.WriteJSON(m)
    62  }
    63  
    64  // UnmarshalBinary interface implementation
    65  func (m *ContractStoreStore) UnmarshalBinary(b []byte) error {
    66  	var res ContractStoreStore
    67  	if err := swag.ReadJSON(b, &res); err != nil {
    68  		return err
    69  	}
    70  	*m = res
    71  	return nil
    72  }