github.com/weaviate/weaviate@v1.24.6/entities/modulecapabilities/graphql.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 modulecapabilities 13 14 import ( 15 "github.com/tailor-inc/graphql" 16 ) 17 18 // GetArgumentsFn generates get graphql config for a given classname 19 type GetArgumentsFn = func(classname string) *graphql.ArgumentConfig 20 21 // AggregateArgumentsFn generates aggregate graphql config for a given classname 22 type AggregateArgumentsFn = func(classname string) *graphql.ArgumentConfig 23 24 // ExploreArgumentsFn generates explore graphql config 25 type ExploreArgumentsFn = func() *graphql.ArgumentConfig 26 27 // ExtractFn extracts graphql params to given struct implementation 28 type ExtractFn = func(param map[string]interface{}) interface{} 29 30 // NearParam defines params with certainty information 31 type NearParam interface { 32 GetCertainty() float64 33 GetDistance() float64 34 GetTargetVectors() []string 35 SimilarityMetricProvided() bool 36 } 37 38 // ValidateFn validates a given module param 39 type ValidateFn = func(param interface{}) error 40 41 // GraphQLArgument defines all the needed settings / methods 42 // to add a module specific graphql argument 43 type GraphQLArgument struct { 44 GetArgumentsFunction GetArgumentsFn 45 AggregateArgumentsFunction AggregateArgumentsFn 46 ExploreArgumentsFunction ExploreArgumentsFn 47 ExtractFunction ExtractFn 48 ValidateFunction ValidateFn 49 } 50 51 // GraphQLArguments defines the capabilities of modules to add their 52 // arguments to graphql API 53 type GraphQLArguments interface { 54 Arguments() map[string]GraphQLArgument 55 }