github.com/weaviate/weaviate@v1.24.6/entities/models/classification_meta.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  // Code generated by go-swagger; DO NOT EDIT.
    13  
    14  package models
    15  
    16  // This file was generated by the swagger tool.
    17  // Editing this file might prove futile when you re-run the swagger generate command
    18  
    19  import (
    20  	"context"
    21  
    22  	"github.com/go-openapi/errors"
    23  	"github.com/go-openapi/strfmt"
    24  	"github.com/go-openapi/swag"
    25  	"github.com/go-openapi/validate"
    26  )
    27  
    28  // ClassificationMeta Additional information to a specific classification
    29  //
    30  // swagger:model ClassificationMeta
    31  type ClassificationMeta struct {
    32  
    33  	// time when this classification finished
    34  	// Example: 2017-07-21T17:32:28Z
    35  	// Format: date-time
    36  	Completed strfmt.DateTime `json:"completed,omitempty"`
    37  
    38  	// number of objects which were taken into consideration for classification
    39  	// Example: 147
    40  	Count int64 `json:"count,omitempty"`
    41  
    42  	// number of objects which could not be classified - see error message for details
    43  	// Example: 7
    44  	CountFailed int64 `json:"countFailed,omitempty"`
    45  
    46  	// number of objects successfully classified
    47  	// Example: 140
    48  	CountSucceeded int64 `json:"countSucceeded,omitempty"`
    49  
    50  	// time when this classification was started
    51  	// Example: 2017-07-21T17:32:28Z
    52  	// Format: date-time
    53  	Started strfmt.DateTime `json:"started,omitempty"`
    54  }
    55  
    56  // Validate validates this classification meta
    57  func (m *ClassificationMeta) Validate(formats strfmt.Registry) error {
    58  	var res []error
    59  
    60  	if err := m.validateCompleted(formats); err != nil {
    61  		res = append(res, err)
    62  	}
    63  
    64  	if err := m.validateStarted(formats); err != nil {
    65  		res = append(res, err)
    66  	}
    67  
    68  	if len(res) > 0 {
    69  		return errors.CompositeValidationError(res...)
    70  	}
    71  	return nil
    72  }
    73  
    74  func (m *ClassificationMeta) validateCompleted(formats strfmt.Registry) error {
    75  	if swag.IsZero(m.Completed) { // not required
    76  		return nil
    77  	}
    78  
    79  	if err := validate.FormatOf("completed", "body", "date-time", m.Completed.String(), formats); err != nil {
    80  		return err
    81  	}
    82  
    83  	return nil
    84  }
    85  
    86  func (m *ClassificationMeta) validateStarted(formats strfmt.Registry) error {
    87  	if swag.IsZero(m.Started) { // not required
    88  		return nil
    89  	}
    90  
    91  	if err := validate.FormatOf("started", "body", "date-time", m.Started.String(), formats); err != nil {
    92  		return err
    93  	}
    94  
    95  	return nil
    96  }
    97  
    98  // ContextValidate validates this classification meta based on context it is used
    99  func (m *ClassificationMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
   100  	return nil
   101  }
   102  
   103  // MarshalBinary interface implementation
   104  func (m *ClassificationMeta) MarshalBinary() ([]byte, error) {
   105  	if m == nil {
   106  		return nil, nil
   107  	}
   108  	return swag.WriteJSON(m)
   109  }
   110  
   111  // UnmarshalBinary interface implementation
   112  func (m *ClassificationMeta) UnmarshalBinary(b []byte) error {
   113  	var res ClassificationMeta
   114  	if err := swag.ReadJSON(b, &res); err != nil {
   115  		return err
   116  	}
   117  	*m = res
   118  	return nil
   119  }