Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseNode ¶
type BaseNode struct {
// contains filtered or unexported fields
}
func (*BaseNode) GetRegistry ¶
func (n *BaseNode) GetRegistry() *NodeRegistry
func (*BaseNode) SetRegistry ¶
func (n *BaseNode) SetRegistry(registry *NodeRegistry)
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field a Field represents a component of the Node abstraction, corresponding to an attribute of a business object. Field is used to define and represent a single data point within a Node, such as a user's name, age, etc.
func NewNodeField ¶
func (*Field) Convert ¶
func (f *Field) Convert(hub *NodeRegistry) (field *graphql.Field, err error)
Convert Field对象不仅需要转换成graphql.Field对象,同时要根据自身的数据类型,生成相应的ArgumentConfig 当 Field 是一个对象类型时,将会递归调用 NodeRegistry.buildNode 方法,优先初始化对应的Node,
func (*Field) Resolver ¶
func (f *Field) Resolver() graphql.FieldResolveFn
func (*Field) SetResolver ¶
func (f *Field) SetResolver(resolver graphql.FieldResolveFn)
type Node ¶
type Node interface { // Name query name // users{ <- this is the query name // id // name // email // } Name() string // Type NodeType Type() FieldType Resolve() graphql.FieldResolveFn BuildFields() []*Field BuildArgs() []argument.Argument IsList() bool GetRegistry() *NodeRegistry SetRegistry(*NodeRegistry) }
Node a Node represents a fundamental business object, serving as the core unit for constructing GraphQL queries. As an abstract concept, Node allows developers to define and declare their business data models. These models are then transformed by the framework into GraphQL query structures.
type NodeRegistry ¶
type NodeRegistry struct {
// contains filtered or unexported fields
}
NodeRegistry is a key component in the go-gql-builder framework, serving as a repository for storing and managing the implementations of Node declared by developers.
func DefaultRegistry ¶
func DefaultRegistry() *NodeRegistry
func NewRegistry ¶
func NewRegistry() *NodeRegistry
func (*NodeRegistry) BuildHandler ¶
func (h *NodeRegistry) BuildHandler() (http.Handler, error)
func (*NodeRegistry) GetDB ¶
func (h *NodeRegistry) GetDB() *sql.DB
func (*NodeRegistry) Register ¶
func (h *NodeRegistry) Register(delegate Node)
func (*NodeRegistry) SetDB ¶
func (h *NodeRegistry) SetDB(db *sql.DB)