github.com/weaviate/weaviate@v1.24.6/entities/models/batch_reference.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 // BatchReference batch reference 29 // 30 // swagger:model BatchReference 31 type BatchReference struct { 32 33 // Long-form beacon-style URI to identify the source of the cross-ref including the property name. Should be in the form of weaviate://localhost/<kinds>/<uuid>/<className>/<propertyName>, where <kinds> must be one of 'objects', 'objects' and <className> and <propertyName> must represent the cross-ref property of source class to be used. 34 // Example: weaviate://localhost/Zoo/a5d09582-4239-4702-81c9-92a6e0122bb4/hasAnimals 35 // Format: uri 36 From strfmt.URI `json:"from,omitempty"` 37 38 // Name of the reference tenant. 39 Tenant string `json:"tenant,omitempty"` 40 41 // Short-form URI to point to the cross-ref. Should be in the form of weaviate://localhost/<uuid> for the example of a local cross-ref to an object 42 // Example: weaviate://localhost/97525810-a9a5-4eb0-858a-71449aeb007f 43 // Format: uri 44 To strfmt.URI `json:"to,omitempty"` 45 } 46 47 // Validate validates this batch reference 48 func (m *BatchReference) Validate(formats strfmt.Registry) error { 49 var res []error 50 51 if err := m.validateFrom(formats); err != nil { 52 res = append(res, err) 53 } 54 55 if err := m.validateTo(formats); err != nil { 56 res = append(res, err) 57 } 58 59 if len(res) > 0 { 60 return errors.CompositeValidationError(res...) 61 } 62 return nil 63 } 64 65 func (m *BatchReference) validateFrom(formats strfmt.Registry) error { 66 if swag.IsZero(m.From) { // not required 67 return nil 68 } 69 70 if err := validate.FormatOf("from", "body", "uri", m.From.String(), formats); err != nil { 71 return err 72 } 73 74 return nil 75 } 76 77 func (m *BatchReference) validateTo(formats strfmt.Registry) error { 78 if swag.IsZero(m.To) { // not required 79 return nil 80 } 81 82 if err := validate.FormatOf("to", "body", "uri", m.To.String(), formats); err != nil { 83 return err 84 } 85 86 return nil 87 } 88 89 // ContextValidate validates this batch reference based on context it is used 90 func (m *BatchReference) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 91 return nil 92 } 93 94 // MarshalBinary interface implementation 95 func (m *BatchReference) MarshalBinary() ([]byte, error) { 96 if m == nil { 97 return nil, nil 98 } 99 return swag.WriteJSON(m) 100 } 101 102 // UnmarshalBinary interface implementation 103 func (m *BatchReference) UnmarshalBinary(b []byte) error { 104 var res BatchReference 105 if err := swag.ReadJSON(b, &res); err != nil { 106 return err 107 } 108 *m = res 109 return nil 110 }