hugr

package module
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2025 License: MIT Imports: 43 Imported by: 0

README

The Hugr query-engine

The Hugr query engine is golang package that provide GraphQL query engine to work with various data sources. It is designed to be extensible and pluggable, allowing you to add your own data sources and query types as needed.

Dependencies

It used the following packages:

Features

  • Http handlers for GraphQL API
  • GraphiQL UI to execute queries
  • GraphQL schema definition and compilation
  • Data sources management
  • Schema extensions to add sub queries to existing data sources
  • Authentication and authorization
  • Caching: L1 (inmemory - bigcache) and L2 (redis, memcached or pegasus)
  • Query parsing and validation
  • Query execution
  • Transformation results (jq transformation)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrParallelMutationNotSupported = errors.New("parallel mutation queries are not supported")

Functions

This section is empty.

Types

type Config

type Config struct {
	DB               db.Config
	AdminUI          bool
	AdminUIFetchPath string
	Debug            bool

	AllowParallel      bool
	MaxParallelQueries int
	MaxDepth           int

	CoreDB *coredb.Source
	Auth   *auth.Config
	Cache  cache.Config
}

type JQRequest

type JQRequest struct {
	JQ    string  `json:"jq"`
	Query Request `json:"query"`
}

type Request

type Request struct {
	Query         string                 `json:"query"`
	Variables     map[string]interface{} `json:"variables"`
	OperationName string                 `json:"operationName,omitempty"`
}

type Service

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

func New

func New(config Config) *Service

func (*Service) AttachRuntimeSource

func (s *Service) AttachRuntimeSource(ctx context.Context, source sources.RuntimeSource) error

func (*Service) Close

func (s *Service) Close() error

func (*Service) Commit

func (s *Service) Commit(ctx context.Context) error

func (*Service) ContextWithTx

func (s *Service) ContextWithTx(ctx context.Context) (context.Context, error)

func (*Service) Init

func (s *Service) Init(ctx context.Context) (err error)

func (*Service) LoadDataSource added in v0.1.8

func (s *Service) LoadDataSource(ctx context.Context, name string) error

func (*Service) ProcessQuery

func (s *Service) ProcessQuery(ctx context.Context, catalog string, req Request) types.Response

func (*Service) Query

func (s *Service) Query(ctx context.Context, query string, vars map[string]any) (*types.Response, error)

func (*Service) QueryCatalog

func (s *Service) QueryCatalog(ctx context.Context, catalog, query string, vars map[string]any) (*types.Response, error)

func (*Service) RegisterDataSource added in v0.1.8

func (s *Service) RegisterDataSource(ctx context.Context, ds types.DataSource) error

func (*Service) Rollback

func (s *Service) Rollback(ctx context.Context) error

func (*Service) Schema

func (s *Service) Schema() *ast.Schema

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Service) UnloadDataSource added in v0.1.8

func (s *Service) UnloadDataSource(ctx context.Context, name string) error

Jump to

Keyboard shortcuts

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