Documentation ¶
Index ¶
- Constants
- Variables
- func ActivityStatus(status string) string
- func GetClassByName(s *models.Schema, className string) (*models.Class, error)
- func GetNestedPropertyByName[P PropertyInterface](p P, propName string) (*models.NestedProperty, error)
- func GetPropertyByName(c *models.Class, propName string) (*models.Property, error)
- func IsArrayDataType(dt []string) bool
- func IsBlobDataType(dt []string) bool
- func IsNested(dataType DataType) bool
- func IsPropertyLength(propName string, offset int) (string, bool)
- func IsRefDataType(dt []string) bool
- func IsValidValueDataType(dt string) bool
- func LowercaseAllPropertyNames(props []*models.Property) []*models.Property
- func LowercaseFirstLetter(name string) string
- func LowercaseFirstLetterOfStrings(in []string) []string
- func MergeRecursivelyNestedProperties(nPropsBase, nPropsExt []*models.NestedProperty) ([]*models.NestedProperty, bool)
- func MultiTenancyEnabled(class *models.Class) bool
- func UppercaseClassName(name string) string
- func ValidateNestedPropertyName(name, prefix string) error
- func ValidateReservedPropertyName(name string) error
- type BM25Config
- type ClassAndProperty
- type ClassName
- type DataType
- func AsNested(dataType []string) (DataType, bool)
- func AsPrimitive(dataType []string) (DataType, bool)
- func GetNestedPropertyDataType[P PropertyInterface](p P, propertyName string) (*DataType, error)
- func GetPropertyDataType(class *models.Class, propertyName string) (*DataType, error)
- func GetValueDataTypeFromString(dt string) (*DataType, error)
- func IsArrayType(dt DataType) (DataType, bool)
- type InvertedIndexConfig
- type PropertyDataType
- type PropertyInterface
- type PropertyKind
- type PropertyName
- type Schema
- func (s *Schema) FindClassByName(className ClassName) *models.Class
- func (s *Schema) FindPropertyDataType(dataType []string) (PropertyDataType, error)
- func (s *Schema) FindPropertyDataTypeWithRefs(dataType []string, relaxCrossRefValidation bool, beloningToClass ClassName) (PropertyDataType, error)
- func (s *Schema) GetClass(className ClassName) *models.Class
- func (s *Schema) GetProperty(className ClassName, propName PropertyName) (*models.Property, error)
- func (s *Schema) GetPropsOfType(propType string) []ClassAndProperty
- func (s *Schema) SemanticSchemaFor() *models.Schema
- type VectorIndexConfig
Constants ¶
const ( ErrorNoSuchClass string = "no such class with name '%s' found in the schema. Check your schema files for which classes are available" ErrorNoSuchProperty string = "" /* 135-byte string literal not displayed */ ErrorNoSuchDatatype string = "given value-DataType does not exist." )
const ( ClassNameRegexCore = `[A-Z][_0-9A-Za-z]{0,254}` ShardNameRegexCore = `[A-Za-z0-9\-\_]{1,64}` PropertyNameRegex = `[_A-Za-z][_0-9A-Za-z]{0,230}` // Nested properties names are not used to build directory names (yet), // no max length restriction is imposed NestedPropertyNameRegex = `[_A-Za-z][_0-9A-Za-z]*` // Target vector names must be GraphQL compliant names no longer then 230 characters TargetVectorNameMaxLength = 230 TargetVectorNameRegex = `[_A-Za-z][_0-9A-Za-z]{0,229}` )
Variables ¶
var DeprecatedPrimitiveDataTypes []DataType = []DataType{ DataTypeString, DataTypeStringArray, }
var ErrRefToNonexistentClass = errors.New("reference property to nonexistent class")
var NestedDataTypes []DataType = []DataType{ DataTypeObject, DataTypeObjectArray, }
var PrimitiveDataTypes []DataType = []DataType{ DataTypeText, DataTypeInt, DataTypeNumber, DataTypeBoolean, DataTypeDate, DataTypeGeoCoordinates, DataTypePhoneNumber, DataTypeBlob, DataTypeTextArray, DataTypeIntArray, DataTypeNumberArray, DataTypeBooleanArray, DataTypeDateArray, DataTypeUUID, DataTypeUUIDArray, }
Functions ¶
func ActivityStatus ¶ added in v1.21.0
func GetClassByName ¶
GetClassByName returns the class by its name
func GetNestedPropertyByName ¶ added in v1.22.0
func GetNestedPropertyByName[P PropertyInterface](p P, propName string) (*models.NestedProperty, error)
func GetPropertyByName ¶
GetPropertyByName returns the class by its name
func IsArrayDataType ¶
func IsBlobDataType ¶
func IsPropertyLength ¶
IsPropertyLength returns if a string is a filters for property length. They have the form len(*PROPNAME*)
func IsRefDataType ¶
func IsValidValueDataType ¶
IsValidValueDataType checks whether the given string is a valid data type
func LowercaseAllPropertyNames ¶ added in v1.18.2
func LowercaseFirstLetter ¶ added in v1.18.2
func LowercaseFirstLetterOfStrings ¶ added in v1.21.3
func MergeRecursivelyNestedProperties ¶ added in v1.22.0
func MergeRecursivelyNestedProperties(nPropsBase, nPropsExt []*models.NestedProperty, ) ([]*models.NestedProperty, bool)
merges nPropsExt with nPropsBase returns new slice without changing input ones and bool indicating whether there was changes done comparing to base slice
func MultiTenancyEnabled ¶ added in v1.20.0
func UppercaseClassName ¶ added in v1.18.2
func ValidateNestedPropertyName ¶ added in v1.22.0
ValidateNestedPropertyName validates that this string is a valid nested property name
func ValidateReservedPropertyName ¶
ValidateReservedPropertyName validates that a string is not a reserved property name
Types ¶
type BM25Config ¶
type ClassAndProperty ¶
type ClassAndProperty struct { ClassName ClassName PropertyName PropertyName }
type ClassName ¶
type ClassName string
Newtype to denote that this string is used as a Class name
func AssertValidClassName ¶
AssertValidClassName assert that this string is a valid class name or panics and should therefore most likely not be used
func ValidateClassName ¶
ValidateClassName validates that this string is a valid class name (format wise)
type DataType ¶
type DataType string
const ( // DataTypeCRef The data type is a cross-reference, it is starting with a capital letter DataTypeCRef DataType = "cref" // DataTypeText The data type is a value of type string DataTypeText DataType = "text" // DataTypeInt The data type is a value of type int DataTypeInt DataType = "int" // DataTypeNumber The data type is a value of type number/float DataTypeNumber DataType = "number" // DataTypeBoolean The data type is a value of type boolean DataTypeBoolean DataType = "boolean" // DataTypeDate The data type is a value of type date DataTypeDate DataType = "date" // DataTypeGeoCoordinates is used to represent geo coordinates, i.e. latitude // and longitude pairs of locations on earth DataTypeGeoCoordinates DataType = "geoCoordinates" // DataTypePhoneNumber represents a parsed/to-be-parsed phone number DataTypePhoneNumber DataType = "phoneNumber" // DataTypeBlob represents a base64 encoded data DataTypeBlob DataType = "blob" // DataTypeTextArray The data type is a value of type string array DataTypeTextArray DataType = "text[]" // DataTypeIntArray The data type is a value of type int array DataTypeIntArray DataType = "int[]" // DataTypeNumberArray The data type is a value of type number/float array DataTypeNumberArray DataType = "number[]" // DataTypeBooleanArray The data type is a value of type boolean array DataTypeBooleanArray DataType = "boolean[]" // DataTypeDateArray The data type is a value of type date array DataTypeDateArray DataType = "date[]" // DataTypeUUID is a native UUID data type. It is stored in it's raw byte // representation and therefore takes up less space than storing a UUID as a // string DataTypeUUID DataType = "uuid" // DataTypeUUIDArray is the array version of DataTypeUUID DataTypeUUIDArray DataType = "uuid[]" DataTypeObject DataType = "object" DataTypeObjectArray DataType = "object[]" // deprecated as of v1.19, replaced by DataTypeText + relevant tokenization setting // DataTypeString The data type is a value of type string DataTypeString DataType = "string" // deprecated as of v1.19, replaced by DataTypeTextArray + relevant tokenization setting // DataTypeArrayString The data type is a value of type string array DataTypeStringArray DataType = "string[]" )
func AsPrimitive ¶ added in v1.19.0
func GetNestedPropertyDataType ¶ added in v1.22.0
func GetNestedPropertyDataType[P PropertyInterface](p P, propertyName string) (*DataType, error)
func GetPropertyDataType ¶
GetPropertyDataType checks whether the given string is a valid data type
func GetValueDataTypeFromString ¶
GetValueDataTypeFromString checks whether the given string is a valid data type
func IsArrayType ¶
func (DataType) PropString ¶ added in v1.19.0
type InvertedIndexConfig ¶
type InvertedIndexConfig struct { BM25 BM25Config Stopwords models.StopwordConfig IndexTimestamps bool IndexNullState bool IndexPropertyLength bool }
type PropertyDataType ¶
type PropertyInterface ¶ added in v1.22.0
type PropertyInterface interface { GetName() string GetNestedProperties() []*models.NestedProperty }
type PropertyKind ¶
type PropertyKind int
const ( PropertyKindPrimitive PropertyKind = 1 PropertyKindRef PropertyKind = 2 PropertyKindNested PropertyKind = 3 )
type PropertyName ¶
type PropertyName string
Newtype to denote that this string is used as a Property name
func AssertValidPropertyName ¶
func AssertValidPropertyName(name string) PropertyName
AssertValidPropertyName asserts that this string is a valid property name or panics and should therefore most likely never be used.
func ValidatePropertyName ¶
func ValidatePropertyName(name string) (PropertyName, error)
ValidatePropertyName validates that this string is a valid property name
func (PropertyName) String ¶
func (p PropertyName) String() string
type Schema ¶
Describes the schema that is used in Weaviate.
func (*Schema) FindClassByName ¶
FindClassByName will find either a Thing or Class by name.
func (*Schema) FindPropertyDataType ¶
func (s *Schema) FindPropertyDataType(dataType []string) (PropertyDataType, error)
Based on the schema, return a valid description of the defined datatype
Note that this function will error if referenced classes do not exist. If you don't want such validation, use [Schema.FindPropertyDataTypeRelaxedRefs] instead and set relax to true
func (*Schema) FindPropertyDataTypeWithRefs ¶
func (s *Schema) FindPropertyDataTypeWithRefs( dataType []string, relaxCrossRefValidation bool, beloningToClass ClassName, ) (PropertyDataType, error)
Based on the schema, return a valid description of the defined datatype If relaxCrossRefValidation is set, there is no check if the referenced class exists in the schema. This can be helpful in scenarios, such as restoring from a backup where we have no guarantee over the order of class creation. If belongingToClass is set and equal to referenced class, check whether class exists in the schema is skipped. This is done to allow creating class schema with properties referencing to itself. Previously such properties had to be created separately only after creation of class schema
func (*Schema) GetProperty ¶
func (*Schema) GetPropsOfType ¶
func (s *Schema) GetPropsOfType(propType string) []ClassAndProperty
func (*Schema) SemanticSchemaFor ¶
Return one of the semantic schema's
type VectorIndexConfig ¶
func TypeAssertVectorIndex ¶ added in v1.23.0
func TypeAssertVectorIndex(class *models.Class, targetVectors []string) (VectorIndexConfig, error)