github.com/weaviate/weaviate@v1.24.6/adapters/handlers/graphql/local/get/group_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 groupArgument(className string) *graphql.ArgumentConfig {
    22  	prefix := fmt.Sprintf("GetObjects%s", className)
    23  	return &graphql.ArgumentConfig{
    24  		// Description: descriptions.GetGroup,
    25  		Type: graphql.NewInputObject(
    26  			graphql.InputObjectConfig{
    27  				Name:        fmt.Sprintf("%sGroupInpObj", prefix),
    28  				Fields:      groupFields(prefix),
    29  				Description: descriptions.GetWhereInpObj,
    30  			},
    31  		),
    32  	}
    33  }
    34  
    35  func groupFields(prefix string) graphql.InputObjectConfigFieldMap {
    36  	return graphql.InputObjectConfigFieldMap{
    37  		"type": &graphql.InputObjectFieldConfig{
    38  			// Description: descriptions.Concepts,
    39  			Type: graphql.NewEnum(graphql.EnumConfig{
    40  				Name: fmt.Sprintf("%sGroupInpObjTypeEnum", prefix),
    41  				Values: graphql.EnumValueConfigMap{
    42  					"closest": &graphql.EnumValueConfig{},
    43  					"merge":   &graphql.EnumValueConfig{},
    44  				},
    45  			}),
    46  		},
    47  		"force": &graphql.InputObjectFieldConfig{
    48  			Description: descriptions.Force,
    49  			Type:        graphql.NewNonNull(graphql.Float),
    50  		},
    51  	}
    52  }