How to Use graphql-go for GraphQL in Go

Web
Execute GraphQL queries in Go using the Weaviate client's fluent builder pattern to retrieve vector-based search results.

Use the graphql package from github.com/weaviate/weaviate-go-client/v4/weaviate/graphql to construct queries via the fluent builder pattern.

import "github.com/weaviate/weaviate-go-client/v4/weaviate/graphql"

result, err := gql.Get().
  WithNearVector(gql.NearVectorArgBuilder().WithVector(vector)).
  WithClassName("Document").
  WithFields(graphql.Field{Name: "text"}).
  WithLimit(3).
  Do(ctx)

This executes a GraphQL query against Weaviate to retrieve objects based on vector similarity.