github.com/weaviate/weaviate@v1.24.6/entities/models/vectors.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  )
    25  
    26  // Vectors A Multi Vector map of named vectors
    27  //
    28  // swagger:model Vectors
    29  type Vectors map[string]Vector
    30  
    31  // Validate validates this vectors
    32  func (m Vectors) Validate(formats strfmt.Registry) error {
    33  	var res []error
    34  
    35  	for k := range m {
    36  
    37  		if err := m[k].Validate(formats); err != nil {
    38  			if ve, ok := err.(*errors.Validation); ok {
    39  				return ve.ValidateName(k)
    40  			} else if ce, ok := err.(*errors.CompositeError); ok {
    41  				return ce.ValidateName(k)
    42  			}
    43  			return err
    44  		}
    45  
    46  	}
    47  
    48  	if len(res) > 0 {
    49  		return errors.CompositeValidationError(res...)
    50  	}
    51  	return nil
    52  }
    53  
    54  // ContextValidate validate this vectors based on the context it is used
    55  func (m Vectors) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    56  	var res []error
    57  
    58  	for k := range m {
    59  
    60  		if err := m[k].ContextValidate(ctx, formats); err != nil {
    61  			if ve, ok := err.(*errors.Validation); ok {
    62  				return ve.ValidateName(k)
    63  			} else if ce, ok := err.(*errors.CompositeError); ok {
    64  				return ce.ValidateName(k)
    65  			}
    66  			return err
    67  		}
    68  
    69  	}
    70  
    71  	if len(res) > 0 {
    72  		return errors.CompositeValidationError(res...)
    73  	}
    74  	return nil
    75  }