protographql

package
v0.0.0-...-d3dae30 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRequestOperation

func GetRequestOperation(rpcOpts *graphqlv1.Rpc) string

func GraphqlFieldOptions

func GraphqlFieldOptions(opts proto.Message) *graphqlv1.Field

func GraphqlMethodOptions

func GraphqlMethodOptions(opts proto.Message) *graphqlv1.Rpc

func GraphqlOneofOptions

func GraphqlOneofOptions(opts proto.Message) *graphqlv1.Oneof

func IsEmpty

same isEmpty but for mortals

func ToLowerFirst

func ToLowerFirst(s string) string

Types

type Callstack

type Callstack interface {
	Push(entry interface{})
	Pop(entry interface{})
	Has(entry interface{}) bool
}

func NewCallstack

func NewCallstack() Callstack

type SchemaDescriptor

type SchemaDescriptor struct {
	FileDescriptors   []protoreflect.FileDescriptor
	Query             *ast.Definition
	Mutation          *ast.Definition
	Subscription      *ast.Definition
	Directives        map[string]*ast.DirectiveDefinition
	Types             map[string]*ast.Definition
	Types2MessageDesc map[string]protoreflect.MessageDescriptor
	MethodsByName     map[ast.Operation]map[string]protoreflect.MethodDescriptor
	ProtoTypes        *protoregistry.Types
	HaveFieldMask     map[protoreflect.MessageDescriptor]struct{}
}

SchemaDescriptor 存储生成的 GraphQL schema 信息

func New

func New() *SchemaDescriptor

func (*SchemaDescriptor) AsGraphQL

func (s *SchemaDescriptor) AsGraphQL() *ast.Schema

func (*SchemaDescriptor) CreateObjects

func (s *SchemaDescriptor) CreateObjects(msgDesc protoreflect.MessageDescriptor, isInput bool) (*ast.Definition, error)

CreateObjects 创建 GraphQL 对象类型定义

func (*SchemaDescriptor) Marshal

func (ins *SchemaDescriptor) Marshal(msg proto.Message, field *ast.Field) (interface{}, error)

Marshal 将 gRPC 返回的 proto.Message 转换为 GraphQL 数据

func (*SchemaDescriptor) RegisterFileDescriptor

func (schema *SchemaDescriptor) RegisterFileDescriptor(generateUnboundMethods bool, file protoreflect.FileDescriptor) error

func (*SchemaDescriptor) Unmarshal

func (ins *SchemaDescriptor) Unmarshal(desc protoreflect.MessageDescriptor, field *ast.Field, vars map[string]interface{}) (proto.Message, error)

Unmarshal 将 GraphQL 字段转换为 Protocol Buffers 消息

Jump to

Keyboard shortcuts

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