github.com/thetreep/go-swagger@v0.0.0-20240223100711-35af64f14f01/examples/stream-server/models/mark.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  	"context"
    10  
    11  	"github.com/go-openapi/errors"
    12  	"github.com/go-openapi/strfmt"
    13  	"github.com/go-openapi/swag"
    14  	"github.com/go-openapi/validate"
    15  )
    16  
    17  // Mark mark
    18  //
    19  // swagger:model Mark
    20  type Mark struct {
    21  
    22  	// remains
    23  	// Required: true
    24  	Remains *int64 `json:"remains"`
    25  }
    26  
    27  // Validate validates this mark
    28  func (m *Mark) Validate(formats strfmt.Registry) error {
    29  	var res []error
    30  
    31  	if err := m.validateRemains(formats); err != nil {
    32  		res = append(res, err)
    33  	}
    34  
    35  	if len(res) > 0 {
    36  		return errors.CompositeValidationError(res...)
    37  	}
    38  	return nil
    39  }
    40  
    41  func (m *Mark) validateRemains(formats strfmt.Registry) error {
    42  
    43  	if err := validate.Required("remains", "body", m.Remains); err != nil {
    44  		return err
    45  	}
    46  
    47  	return nil
    48  }
    49  
    50  // ContextValidate validates this mark based on context it is used
    51  func (m *Mark) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    52  	return nil
    53  }
    54  
    55  // MarshalBinary interface implementation
    56  func (m *Mark) MarshalBinary() ([]byte, error) {
    57  	if m == nil {
    58  		return nil, nil
    59  	}
    60  	return swag.WriteJSON(m)
    61  }
    62  
    63  // UnmarshalBinary interface implementation
    64  func (m *Mark) UnmarshalBinary(b []byte) error {
    65  	var res Mark
    66  	if err := swag.ReadJSON(b, &res); err != nil {
    67  		return err
    68  	}
    69  	*m = res
    70  	return nil
    71  }