graph

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckVehicleRawDataByDID

func CheckVehicleRawDataByDID(ctx context.Context, did string) error

CheckVehicleRawDataByDID returns an error if the context does not have claims or the token does not have GetRawData permission for the given vehicle DID, or if the DID is invalid.

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type ClaimsContextKey

type ClaimsContextKey struct{}

ClaimsContextKey is the context key for token claims (set by JWT middleware).

type CloudEventResolver

type CloudEventResolver interface {
	Header(ctx context.Context, obj *CloudEventWrapper) (*cloudevent.CloudEventHeader, error)
	Data(ctx context.Context, obj *CloudEventWrapper) (RawJSON, error)
	DataBase64(ctx context.Context, obj *CloudEventWrapper) (*string, error)
}

type CloudEventWrapper

type CloudEventWrapper struct {
	Raw *cloudevent.RawEvent
}

CloudEventWrapper holds a pointer to a RawEvent so resolvers can expose header, data, and dataBase64 without copying the underlying event.

type ComplexityRoot

type ComplexityRoot struct {
	CloudEvent struct {
		Data       func(childComplexity int) int
		DataBase64 func(childComplexity int) int
		Header     func(childComplexity int) int
	}

	CloudEventHeader struct {
		DataContentType func(childComplexity int) int
		DataSchema      func(childComplexity int) int
		DataVersion     func(childComplexity int) int
		ID              func(childComplexity int) int
		Producer        func(childComplexity int) int
		Signature       func(childComplexity int) int
		Source          func(childComplexity int) int
		SpecVersion     func(childComplexity int) int
		Subject         func(childComplexity int) int
		Tags            func(childComplexity int) int
		Time            func(childComplexity int) int
		Type            func(childComplexity int) int
	}

	CloudEventIndex struct {
		Header   func(childComplexity int) int
		IndexKey func(childComplexity int) int
	}

	Query struct {
		CloudEvents      func(childComplexity int, did string, limit *int, filter *model.CloudEventFilter) int
		Indexes          func(childComplexity int, did string, limit *int, filter *model.CloudEventFilter) int
		LatestCloudEvent func(childComplexity int, did string, filter *model.CloudEventFilter) int
		LatestIndex      func(childComplexity int, did string, filter *model.CloudEventFilter) int
	}
}

type Config

type Config struct {
	Schema     *ast.Schema
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type QueryResolver

type QueryResolver interface {
	LatestIndex(ctx context.Context, did string, filter *model.CloudEventFilter) (*model.CloudEventIndex, error)
	Indexes(ctx context.Context, did string, limit *int, filter *model.CloudEventFilter) ([]*model.CloudEventIndex, error)
	LatestCloudEvent(ctx context.Context, did string, filter *model.CloudEventFilter) (*CloudEventWrapper, error)
	CloudEvents(ctx context.Context, did string, limit *int, filter *model.CloudEventFilter) ([]*CloudEventWrapper, error)
}

type RawJSON

type RawJSON []byte

RawJSON is the raw bytes of a JSON value. It implements graphql.Marshaler by writing the bytes directly so the payload appears as unescaped JSON (object/array) in the GraphQL response instead of an escaped string.

func (RawJSON) MarshalGQL

func (r RawJSON) MarshalGQL(w io.Writer)

MarshalGQL writes the raw JSON bytes to w so the response contains unescaped JSON.

func (*RawJSON) UnmarshalGQL

func (r *RawJSON) UnmarshalGQL(v interface{}) error

UnmarshalGQL satisfies the graphql.Unmarshaler interface (e.g. for variables). Scalar is primarily used for output (CloudEvent.data); input is not used.

type Resolver

type Resolver struct {
	EventService *eventrepo.Service
	Buckets      []string
	VehicleAddr  common.Address
	ChainID      uint64
}

func (*Resolver) CloudEvent

func (r *Resolver) CloudEvent() CloudEventResolver

CloudEvent returns CloudEventResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	CloudEvent() CloudEventResolver
	Query() QueryResolver
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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