github.com/weaviate/weaviate@v1.24.6/usecases/objects/batch_types.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  package objects
    13  
    14  import (
    15  	"github.com/go-openapi/strfmt"
    16  	"github.com/weaviate/weaviate/entities/filters"
    17  	"github.com/weaviate/weaviate/entities/models"
    18  	"github.com/weaviate/weaviate/entities/schema"
    19  	"github.com/weaviate/weaviate/entities/schema/crossref"
    20  )
    21  
    22  // BatchObject is a helper type that groups all the info about one object in a
    23  // batch that belongs together, i.e. uuid, object body and error state.
    24  //
    25  // Consumers of an Object (i.e. database connector) should always check
    26  // whether an error is already present by the time they receive a batch object.
    27  // Errors can be introduced at all levels, e.g. validation.
    28  //
    29  // However, error'd objects are not removed to make sure that the list in
    30  // Objects matches the order and content of the incoming batch request
    31  type BatchObject struct {
    32  	OriginalIndex int
    33  	Err           error
    34  	Object        *models.Object
    35  	UUID          strfmt.UUID
    36  }
    37  
    38  // BatchObjects groups many Object items together. The order matches the
    39  // order from the original request. It can be turned into the expected response
    40  // type using the .Response() method
    41  type BatchObjects []BatchObject
    42  
    43  // BatchReference is a helper type that groups all the info about one references in a
    44  // batch that belongs together, i.e. from, to, original index and error state
    45  //
    46  // Consumers of an Object (i.e. database connector) should always check
    47  // whether an error is already present by the time they receive a batch object.
    48  // Errors can be introduced at all levels, e.g. validation.
    49  //
    50  // However, error'd objects are not removed to make sure that the list in
    51  // Objects matches the order and content of the incoming batch request
    52  type BatchReference struct {
    53  	OriginalIndex int                 `json:"originalIndex"`
    54  	Err           error               `json:"err"`
    55  	From          *crossref.RefSource `json:"from"`
    56  	To            *crossref.Ref       `json:"to"`
    57  	Tenant        string              `json:"tenant"`
    58  }
    59  
    60  // BatchReferences groups many Reference items together. The order matches the
    61  // order from the original request. It can be turned into the expected response
    62  // type using the .Response() method
    63  type BatchReferences []BatchReference
    64  
    65  type BatchSimpleObject struct {
    66  	UUID strfmt.UUID
    67  	Err  error
    68  }
    69  
    70  type BatchSimpleObjects []BatchSimpleObject
    71  
    72  type BatchDeleteParams struct {
    73  	ClassName schema.ClassName     `json:"className"`
    74  	Filters   *filters.LocalFilter `json:"filters"`
    75  	DryRun    bool
    76  	Output    string
    77  }
    78  
    79  type BatchDeleteResult struct {
    80  	Matches int64
    81  	Limit   int64
    82  	DryRun  bool
    83  	Objects BatchSimpleObjects
    84  }
    85  
    86  type BatchDeleteResponse struct {
    87  	Match  *models.BatchDeleteMatch
    88  	DryRun bool
    89  	Output string
    90  	Params BatchDeleteParams
    91  	Result BatchDeleteResult
    92  }