github.com/weaviate/weaviate@v1.24.6/adapters/handlers/graphql/local/get/group_by_argument.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 get 13 14 import ( 15 "fmt" 16 17 "github.com/tailor-inc/graphql" 18 "github.com/weaviate/weaviate/adapters/handlers/graphql/descriptions" 19 ) 20 21 func groupByArgument(className string) *graphql.ArgumentConfig { 22 prefix := fmt.Sprintf("GetObjects%s", className) 23 return &graphql.ArgumentConfig{ 24 Type: graphql.NewInputObject( 25 graphql.InputObjectConfig{ 26 Name: fmt.Sprintf("%sGroupByInpObj", prefix), 27 Fields: groupByFields(prefix), 28 Description: descriptions.GroupByFilter, 29 }, 30 ), 31 } 32 } 33 34 func groupByFields(prefix string) graphql.InputObjectConfigFieldMap { 35 return graphql.InputObjectConfigFieldMap{ 36 "path": &graphql.InputObjectFieldConfig{ 37 Description: descriptions.GroupByPath, 38 Type: graphql.NewNonNull(graphql.NewList(graphql.String)), 39 }, 40 "groups": &graphql.InputObjectFieldConfig{ 41 Description: descriptions.GroupByGroups, 42 Type: graphql.NewNonNull(graphql.Int), 43 }, 44 "objectsPerGroup": &graphql.InputObjectFieldConfig{ 45 Description: descriptions.GroupByObjectsPerGroup, 46 Type: graphql.NewNonNull(graphql.Int), 47 }, 48 } 49 }