storobj

package
v1.23.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2023 License: BSD-3-Clause Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddOwnership added in v1.19.0

func AddOwnership(objs []*Object, node, shard string)

func DocIDFromBinary

func DocIDFromBinary(in []byte) (uint64, error)

func NewErrNotFoundf

func NewErrNotFoundf(docID uint64, msg string, args ...interface{}) error

func ParseAndExtractBoolArrayProp added in v1.21.2

func ParseAndExtractBoolArrayProp(data []byte, propName string) ([]bool, bool, error)

func ParseAndExtractNumberArrayProp

func ParseAndExtractNumberArrayProp(data []byte, propName string) ([]float64, bool, error)

func ParseAndExtractProperty

func ParseAndExtractProperty(data []byte, propName string) ([]string, bool, error)

func ParseAndExtractTextProp

func ParseAndExtractTextProp(data []byte, propName string) ([]string, bool, error)

func SearchResults

func SearchResults(in []*Object, additional additional.Properties, tenant string) search.Results

func SearchResultsWithDists

func SearchResultsWithDists(in []*Object, addl additional.Properties,
	dists []float32,
) search.Results

func UnmarshalPropertiesFromObject

func UnmarshalPropertiesFromObject(data []byte, properties *map[string]interface{}, aggregationProperties []string, propStrings [][]string) error

UnmarshalPropertiesFromObject only unmarshals and returns the properties part of the object

Check MarshalBinary for the order of elements in the input array

func VectorFromBinary

func VectorFromBinary(in []byte, buffer []float32) ([]float32, error)

Types

type ErrNotFound

type ErrNotFound struct {
	DocID       uint64
	OriginalMsg string
}

func (ErrNotFound) Error

func (err ErrNotFound) Error() string

type Object

type Object struct {
	MarshallerVersion uint8
	Object            models.Object `json:"object"`
	Vector            []float32     `json:"vector"`
	VectorLen         int           `json:"-"`
	BelongsToNode     string        `json:"-"`
	BelongsToShard    string        `json:"-"`
	IsConsistent      bool          `json:"-"`
	// contains filtered or unexported fields
}

func FromBinary

func FromBinary(data []byte) (*Object, error)

func FromBinaryOptional

func FromBinaryOptional(data []byte,
	addProp additional.Properties,
) (*Object, error)

func FromBinaryUUIDOnly added in v1.18.1

func FromBinaryUUIDOnly(data []byte) (*Object, error)

func FromObject

func FromObject(object *models.Object, vector []float32) *Object

func New

func New(docID uint64) *Object

func ObjectsByDocID

func ObjectsByDocID(bucket bucket, ids []uint64,
	additional additional.Properties,
) ([]*Object, error)

func (*Object) AdditionalProperties

func (ko *Object) AdditionalProperties() models.AdditionalProperties

AdditionalProperties groups all properties which are stored with the object and not generated at runtime

func (*Object) Class

func (ko *Object) Class() schema.ClassName

func (*Object) CreationTimeUnix

func (ko *Object) CreationTimeUnix() int64

func (*Object) DeepCopyDangerous

func (ko *Object) DeepCopyDangerous() *Object

DeepCopyDangerous creates a deep copy of the underlying Object WARNING: This was purpose built for the batch ref usecase and only covers the situations that are required there. This means that cases which aren't reflected in that usecase may still contain references. Thus the suffix "Dangerous". If needed, make sure everything is copied and remove the suffix.

func (*Object) DocID

func (ko *Object) DocID() uint64

func (*Object) ExplainScore

func (ko *Object) ExplainScore() string

func (*Object) ID

func (ko *Object) ID() strfmt.UUID

func (*Object) LastUpdateTimeUnix

func (ko *Object) LastUpdateTimeUnix() int64

func (*Object) MarshalBinary

func (ko *Object) MarshalBinary() ([]byte, error)

MarshalBinary creates the binary representation of a kind object. Regardless of the marshaller version the first byte is a uint8 indicating the version followed by the payload which depends on the specific version

Version 1 No. of B | Type | Content ------------------------------------------------ 1 | uint8 | MarshallerVersion = 1 8 | uint64 | index id, keep early so id-only lookups are maximum efficient 1 | uint8 | kind, 0=action, 1=thing - deprecated 16 | uint128 | uuid 8 | int64 | create time 8 | int64 | update time 2 | uint16 | VectorLength n*4 | []float32 | vector of length n 2 | uint16 | length of class name n | []byte | className 4 | uint32 | length of schema json n | []byte | schema as json 2 | uint32 | length of meta json n | []byte | meta as json 2 | uint32 | length of vectorweights json n | []byte | vectorweights as json

func (*Object) Properties

func (ko *Object) Properties() models.PropertySchema

func (*Object) PropertiesWithAdditional

func (ko *Object) PropertiesWithAdditional(
	additional additional.Properties,
) models.PropertySchema

func (*Object) Score

func (ko *Object) Score() float32

func (*Object) SearchResult

func (ko *Object) SearchResult(additional additional.Properties, tenant string) *search.Result

func (*Object) SearchResultWithDist

func (ko *Object) SearchResultWithDist(addl additional.Properties, dist float32) search.Result

func (*Object) SetClass

func (ko *Object) SetClass(class string)

func (*Object) SetDocID

func (ko *Object) SetDocID(id uint64)

func (*Object) SetID

func (ko *Object) SetID(id strfmt.UUID)

func (*Object) SetProperties

func (ko *Object) SetProperties(schema models.PropertySchema)

func (*Object) UnmarshalBinary

func (ko *Object) UnmarshalBinary(data []byte) error

UnmarshalBinary is the versioned way to unmarshal a kind object from binary, see MarshalBinary for the exact contents of each version

func (*Object) Valid

func (ko *Object) Valid() bool

func (*Object) VectorWeights

func (ko *Object) VectorWeights() models.VectorWeights

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL