graphql

package
v0.0.0-...-28e02bd Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 8 Imported by: 0

README

The GraphQL queries in DBS are supported as proof-of-concept. The implementation is done via graph-gophers library. The code reads DBS GraphQL schema and provides /query end-point for GraphQL queries. The queries can be posted via HTTP POST request as following:

curl -X POST -d@/tmp/qraph.ql https://some-host.com/dbs2go/query

where /tmp/graph.ql represents GraphQL query like

{"query": "{getDataset(name: \"test\") {name}}"}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSchema

func InitSchema(fname string, db *sql.DB) *graphql.Schema

InitSchema initializes GraphQL schema

Types

type Dataset

type Dataset struct {
	Name string
}

Dataset represents data model struct

type DatasetResolver

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

DatasetResolver provides dataset resolver

func (*DatasetResolver) Name

func (dr *DatasetResolver) Name(ctx context.Context) *string

Name resolves the Name field for Dataset

type Resolver

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

Resolver is the root resolver it can hold some attribute to resolve our requests, e.g. a database pointer which we can use to execute the queries

func (*Resolver) AddDataset

func (r *Resolver) AddDataset(ctx context.Context, args struct{ Name string }) (*bool, error)

AddDataset implements addDataset of graphql schema

func (*Resolver) DeleteDataset

func (r *Resolver) DeleteDataset(ctx context.Context, args struct{ Name string }) (*bool, error)

DeleteDataset implements deleteDataset of graphql schema

func (*Resolver) GetDataset

func (r *Resolver) GetDataset(ctx context.Context, args struct{ Name string }) (*DatasetResolver, error)

GetDataset resolves the getDataset query

func (*Resolver) UpdateDataset

func (r *Resolver) UpdateDataset(ctx context.Context, args struct{ Dataset datasetInput }) (*bool, error)

UpdateDataset implements updateDataset of graphql schema

Jump to

Keyboard shortcuts

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