graphql

package
v0.0.0-...-260b785 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractWhereClause

func ExtractWhereClause(args []*ast.Argument, store utils.M) (map[string]interface{}, error)

ExtractWhereClause return the where arg of graphql schema

func Filter

func Filter(field *ast.Field, value interface{}) interface{}

Filter filers the result based on the provided selection set

Types

type AuthInterface

type AuthInterface interface {
	ParseToken(ctx context.Context, token string) (map[string]interface{}, error)
	IsCreateOpAuthorised(ctx context.Context, project, dbAlias, col, token string, req *model.CreateRequest) (model.RequestParams, error)
	IsReadOpAuthorised(ctx context.Context, project, dbAlias, col, token string, req *model.ReadRequest, stub model.ReturnWhereStub) (*model.PostProcess, model.RequestParams, error)
	IsUpdateOpAuthorised(ctx context.Context, project, dbAlias, col, token string, req *model.UpdateRequest) (model.RequestParams, error)
	IsDeleteOpAuthorised(ctx context.Context, project, dbAlias, col, token string, req *model.DeleteRequest) (model.RequestParams, error)
	IsFuncCallAuthorised(ctx context.Context, project, service, function, token string, params interface{}) (*model.PostProcess, model.RequestParams, error)
	IsPreparedQueryAuthorised(ctx context.Context, project, dbAlias, id, token string, req *model.PreparedQueryRequest) (*model.PostProcess, model.RequestParams, error)
}

AuthInterface is an interface consisting of functions of auth module used by graphql module

type CrudInterface

type CrudInterface interface {
	Create(ctx context.Context, dbAlias, collection string, request *model.CreateRequest, params model.RequestParams) error
	Read(ctx context.Context, dbAlias, collection string, request *model.ReadRequest, params model.RequestParams) (interface{}, *model.SQLMetaData, error)
	Update(ctx context.Context, dbAlias, collection string, request *model.UpdateRequest, params model.RequestParams) error
	Delete(ctx context.Context, dbAlias, collection string, request *model.DeleteRequest, params model.RequestParams) error
	Batch(ctx context.Context, dbAlias string, req *model.BatchRequest, params model.RequestParams) error
	GetDBType(dbAlias string) (string, error)
	IsPreparedQueryPresent(directive, fieldName string) bool
	ExecPreparedQuery(ctx context.Context, dbAlias, id string, req *model.PreparedQueryRequest, params model.RequestParams) (interface{}, *model.SQLMetaData, error)
}

CrudInterface is an interface consisting of functions of crud module used by graphql module

type FunctionInterface

type FunctionInterface interface {
	CallWithContext(ctx context.Context, service, function, token string, reqParams model.RequestParams, req *model.FunctionsRequest) (int, interface{}, error)
}

FunctionInterface is an interface consisting of functions of function module used by graphql module

type Module

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

Module is the object for the GraphQL module

func New

New creates a new GraphQL module

func (*Module) ExecGraphQLQuery

func (graph *Module) ExecGraphQLQuery(ctx context.Context, req *model.GraphQLRequest, token string, cb model.GraphQLCallback)

ExecGraphQLQuery executes the provided graphql query

func (*Module) GetDBAlias

func (graph *Module) GetDBAlias(ctx context.Context, field *ast.Field, token string, store utils.M) (string, error)

GetDBAlias returns the dbAlias of the request

func (*Module) GetProjectID

func (graph *Module) GetProjectID() string

GetProjectID sets the project configuration

func (*Module) SetConfig

func (graph *Module) SetConfig(project string)

SetConfig sets the project configuration

func (*Module) SetProjectAESKey

func (graph *Module) SetProjectAESKey(aesKey string) error

SetProjectAESKey sets aes key

type SchemaInterface

type SchemaInterface interface {
	GetSchema(dbAlias, col string) (model.Fields, bool)
}

SchemaInterface is an interface consisting of functions of schema module used by graphql module

Jump to

Keyboard shortcuts

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