Documentation ¶
Index ¶
- Constants
- Variables
- func GetClassByName(s *models.Schema, className string) (*models.Class, error)
- func GetPropertyByName(c *models.Class, propName string) (*models.Property, error)
- func IsArrayDataType(dt []string) bool
- func IsBlobDataType(dt []string) 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 MultiTenancyEnabled(class *models.Class) bool
- func UppercaseClassName(name string) string
- func ValidateReservedPropertyName(name string) error
- type BM25Config
- type ClassAndProperty
- type ClassName
- type DataType
- type InvertedIndexConfig
- type PropertyDataType
- 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]*` ShardNameRegexCore = `[A-Za-z0-9\-\_]{1,64}` )
Variables ¶
var DeprecatedPrimitiveDataTypes []DataType = []DataType{ DataTypeString, DataTypeStringArray, }
var ErrRefToNonexistentClass = errors.New("reference property to nonexistent class")
var PrimitiveDataTypes []DataType = []DataType{ DataTypeText, DataTypeInt, DataTypeNumber, DataTypeBoolean, DataTypeDate, DataTypeGeoCoordinates, DataTypePhoneNumber, DataTypeBlob, DataTypeTextArray, DataTypeIntArray, DataTypeNumberArray, DataTypeBooleanArray, DataTypeDateArray, DataTypeUUID, DataTypeUUIDArray, }
Functions ¶
func GetClassByName ¶
GetClassByName returns the class by its name
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 MultiTenancyEnabled ¶ added in v1.20.0
func UppercaseClassName ¶ added in v1.18.2
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 coordintaes, 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[]" // 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 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 PropertyKind ¶
type PropertyKind int
const ( PropertyKindPrimitive PropertyKind = 1 PropertyKindRef PropertyKind = 2 )
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 ¶
type VectorIndexConfig interface {
IndexType() string
}