github.com/weaviate/weaviate@v1.24.6/entities/models/graph_q_l_responses.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  	"strconv"
    22  
    23  	"github.com/go-openapi/errors"
    24  	"github.com/go-openapi/strfmt"
    25  	"github.com/go-openapi/swag"
    26  )
    27  
    28  // GraphQLResponses A list of GraphQL responses.
    29  //
    30  // swagger:model GraphQLResponses
    31  type GraphQLResponses []*GraphQLResponse
    32  
    33  // Validate validates this graph q l responses
    34  func (m GraphQLResponses) Validate(formats strfmt.Registry) error {
    35  	var res []error
    36  
    37  	for i := 0; i < len(m); i++ {
    38  		if swag.IsZero(m[i]) { // not required
    39  			continue
    40  		}
    41  
    42  		if m[i] != nil {
    43  			if err := m[i].Validate(formats); err != nil {
    44  				if ve, ok := err.(*errors.Validation); ok {
    45  					return ve.ValidateName(strconv.Itoa(i))
    46  				} else if ce, ok := err.(*errors.CompositeError); ok {
    47  					return ce.ValidateName(strconv.Itoa(i))
    48  				}
    49  				return err
    50  			}
    51  		}
    52  
    53  	}
    54  
    55  	if len(res) > 0 {
    56  		return errors.CompositeValidationError(res...)
    57  	}
    58  	return nil
    59  }
    60  
    61  // ContextValidate validate this graph q l responses based on the context it is used
    62  func (m GraphQLResponses) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
    63  	var res []error
    64  
    65  	for i := 0; i < len(m); i++ {
    66  
    67  		if m[i] != nil {
    68  			if err := m[i].ContextValidate(ctx, formats); err != nil {
    69  				if ve, ok := err.(*errors.Validation); ok {
    70  					return ve.ValidateName(strconv.Itoa(i))
    71  				} else if ce, ok := err.(*errors.CompositeError); ok {
    72  					return ce.ValidateName(strconv.Itoa(i))
    73  				}
    74  				return err
    75  			}
    76  		}
    77  
    78  	}
    79  
    80  	if len(res) > 0 {
    81  		return errors.CompositeValidationError(res...)
    82  	}
    83  	return nil
    84  }