Documentation
¶
Index ¶
- type Executor
- type MultiExecutor
- func (m *MultiExecutor) Mutate(ctx context.Context, dest any) error
- func (m *MultiExecutor) Query(ctx context.Context, dest any) error
- func (m *MultiExecutor) QueryWithTypes(ctx context.Context, dest any, types map[string]reflect.Type, typeKey string) error
- func (m *MultiExecutor) Register(dialect string, executor Executor)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Executor ¶
type Executor interface {
// Query executes a read query and scans results into dest
Query(ctx context.Context, dest any) error
// QueryWithTypes handles interface types that need type discrimination
QueryWithTypes(ctx context.Context, dest any, types map[string]reflect.Type, typeKey string) error
// Mutate executes a create/update/delete mutation and scans results into dest
Mutate(ctx context.Context, dest any) error
}
Executor is the main interface for executing GraphQL operations against any database. Each database implementation (PostgreSQL, MongoDB, etc.) implements this interface.
type MultiExecutor ¶ added in v0.3.1
type MultiExecutor struct {
// contains filtered or unexported fields
}
MultiExecutor routes queries to the appropriate executor based on the type's dialect. It reads the dialect from the @table directive on each GraphQL type.
func NewMultiExecutor ¶ added in v0.3.1
func NewMultiExecutor(schema *ast.Schema, defaultDialect string) *MultiExecutor
NewMultiExecutor creates a new MultiExecutor with the given schema and default dialect.
func (*MultiExecutor) Mutate ¶ added in v0.3.1
func (m *MultiExecutor) Mutate(ctx context.Context, dest any) error
Mutate routes the mutation to the appropriate executor based on the type's dialect.
func (*MultiExecutor) Query ¶ added in v0.3.1
func (m *MultiExecutor) Query(ctx context.Context, dest any) error
Query routes the query to the appropriate executor based on the type's dialect.
func (*MultiExecutor) QueryWithTypes ¶ added in v0.3.1
func (m *MultiExecutor) QueryWithTypes(ctx context.Context, dest any, types map[string]reflect.Type, typeKey string) error
QueryWithTypes routes the query to the appropriate executor for interface types.
func (*MultiExecutor) Register ¶ added in v0.3.1
func (m *MultiExecutor) Register(dialect string, executor Executor)
Register adds an executor for a specific dialect.