item

package
v0.0.0-...-e3c6108 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldTypeString  FieldType = "String"
	FieldTypeInt               = "Int"
	FieldTypeFloat             = "Float"
	FieldTypeBoolean           = "Boolean"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	Type  ColumnType
	Name  string
	Alias string
}

type ColumnType

type ColumnType string
const (
	Int    ColumnType = "Int"
	Float  ColumnType = "Float"
	String ColumnType = "String"
)

type DefaultSqlHelper

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

func NewDefaultSqlHelper

func NewDefaultSqlHelper(tableName string, columns []*Column) *DefaultSqlHelper

func (*DefaultSqlHelper) Resolve

type Delegate

type Delegate interface {
	// Name graphQL查询的字段名称
	Name() string
	// Type item对象类型
	Type() FieldType

	Resolve() graphql.FieldResolveFn
	BuildField() []*Field

	IsList() bool
}

type Field

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

func NewItemField

func NewItemField(fieldName string, fieldType FieldType) *Field

func (*Field) Convert

func (f *Field) Convert(hub *ItemHub) (*graphql.Field, error)

func (*Field) Resolver

func (f *Field) Resolver() graphql.FieldResolveFn

func (*Field) SetResolver

func (f *Field) SetResolver(resolver graphql.FieldResolveFn)

type FieldType

type FieldType string

type ItemHub

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

TODO HubSet 框架支持多个数据源

func HUB

func HUB() *ItemHub

func (*ItemHub) BuildSchema

func (h *ItemHub) BuildSchema() (*graphql.Schema, error)

func (*ItemHub) GetDB

func (h *ItemHub) GetDB() *sql.DB

func (*ItemHub) Register

func (h *ItemHub) Register(delegate Delegate)

func (*ItemHub) SetDB

func (h *ItemHub) SetDB(db *sql.DB)

type SqlHelper

type SqlHelper interface {
	Resolve() graphql.FieldResolveFn
}

Jump to

Keyboard shortcuts

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