github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/compiler/models/byte_code.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  // ByteCode byte code
    16  // swagger:model ByteCode
    17  type ByteCode struct {
    18  
    19  	// bytecode
    20  	// Required: true
    21  	Bytecode EncodedByteArray `json:"bytecode"`
    22  }
    23  
    24  // Validate validates this byte code
    25  func (m *ByteCode) Validate(formats strfmt.Registry) error {
    26  	var res []error
    27  
    28  	if err := m.validateBytecode(formats); err != nil {
    29  		res = append(res, err)
    30  	}
    31  
    32  	if len(res) > 0 {
    33  		return errors.CompositeValidationError(res...)
    34  	}
    35  	return nil
    36  }
    37  
    38  func (m *ByteCode) validateBytecode(formats strfmt.Registry) error {
    39  
    40  	if err := m.Bytecode.Validate(formats); err != nil {
    41  		if ve, ok := err.(*errors.Validation); ok {
    42  			return ve.ValidateName("bytecode")
    43  		}
    44  		return err
    45  	}
    46  
    47  	return nil
    48  }
    49  
    50  // MarshalBinary interface implementation
    51  func (m *ByteCode) MarshalBinary() ([]byte, error) {
    52  	if m == nil {
    53  		return nil, nil
    54  	}
    55  	return swag.WriteJSON(m)
    56  }
    57  
    58  // UnmarshalBinary interface implementation
    59  func (m *ByteCode) UnmarshalBinary(b []byte) error {
    60  	var res ByteCode
    61  	if err := swag.ReadJSON(b, &res); err != nil {
    62  		return err
    63  	}
    64  	*m = res
    65  	return nil
    66  }