querybuilder

package module
v0.0.0-...-11ec8f3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

querybuilder

A Go package for building GraphQL queries.

Documentation

Index

Constants

View Source
const (
	GraphQLMarshallerType   = "XXX_GraphQLType"
	GraphQLMarshallerIDType = "XXX_GraphQLIDType"
	GraphQLMarshallerID     = "XXX_GraphQLID"
)

Variables

This section is empty.

Functions

func IsZeroValue

func IsZeroValue(value any) bool

func MarshalGQL

func MarshalGQL(ctx context.Context, v any) (string, error)

Types

type GraphQLMarshaller

type GraphQLMarshaller interface {
	// XXX_GraphQLType is an internal function. It returns the native GraphQL type name
	XXX_GraphQLType() string
	// XXX_GraphQLIDType is an internal function. It returns the native GraphQL type name for the ID of this object
	XXX_GraphQLIDType() string
	// XXX_GraphqlID is an internal function. It returns the underlying type ID
	XXX_GraphQLID(ctx context.Context) (string, error)
	json.Marshaler
}

GraphQLMarshaller is an internal interface for marshalling an object into GraphQL.

type QueryBuilder

type QueryBuilder struct {
	// contains filtered or unexported fields
}

QueryBuilder represents a GraphQL query builder using a chain-based approach

func Mutation

func Mutation() *QueryBuilder

Mutation creates a new QueryBuilder for a mutation operation.

func Query

func Query() *QueryBuilder

Query creates a new QueryBuilder

func QueryV2

func QueryV2() *QueryBuilder

Keep the old name for backward compatibility

func (*QueryBuilder) Arg

func (q *QueryBuilder) Arg(name string, value any) *QueryBuilder

func (*QueryBuilder) Bind

func (q *QueryBuilder) Bind(v any) *QueryBuilder

func (*QueryBuilder) Build

func (q *QueryBuilder) Build(ctx context.Context) (string, error)

func (*QueryBuilder) Client

func (q *QueryBuilder) Client(c graphql.Client) *QueryBuilder

func (*QueryBuilder) Execute

func (q *QueryBuilder) Execute(ctx context.Context) error

func (*QueryBuilder) InlineFragment

func (q *QueryBuilder) InlineFragment(typeName string) *QueryBuilder

InlineFragment adds an inline fragment type condition (... on TypeName). Subsequent selections will be nested inside the fragment. The response data is flat — the fragment doesn't add a nesting level during unpack.

func (*QueryBuilder) Root

func (q *QueryBuilder) Root() *QueryBuilder

func (*QueryBuilder) Select

func (q *QueryBuilder) Select(name string) *QueryBuilder

func (*QueryBuilder) SelectFields

func (q *QueryBuilder) SelectFields(fields ...string) *QueryBuilder

SelectFields selects multiple fields at the current level

func (*QueryBuilder) SelectMixed

func (q *QueryBuilder) SelectMixed(simpleFields []string, nestedSelections map[string]*QueryBuilder) *QueryBuilder

SelectMixed allows mixing simple fields and nested selections at the same level

func (*QueryBuilder) SelectMultiple

func (q *QueryBuilder) SelectMultiple(name ...string) *QueryBuilder

func (*QueryBuilder) SelectNested

func (q *QueryBuilder) SelectNested(field string, subSelection *QueryBuilder) *QueryBuilder

SelectNested selects a field with nested sub-selections

func (*QueryBuilder) SelectWithAlias

func (q *QueryBuilder) SelectWithAlias(alias, name string) *QueryBuilder

type Selection

type Selection = QueryBuilder

Type alias for backward compatibility

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL