Documentation
¶
Index ¶
- func CheckVehicleRawDataByDID(ctx context.Context, did string) error
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type ClaimsContextKey
- type CloudEventResolver
- type CloudEventWrapper
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type QueryResolver
- type RawJSON
- type Resolver
- type ResolverRoot
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckVehicleRawDataByDID ¶
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 ¶
MarshalGQL writes the raw JSON bytes to w so the response contains unescaped JSON.
func (*RawJSON) UnmarshalGQL ¶
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
}