Documentation
¶
Overview ¶
Package gws is a generated protocol buffer package.
It is generated from these files:
distribution.proto
It has these top-level messages:
Distribution Filter Condition
Index ¶
- func ErrorsFromGraphQLErrors(errors []gqlerrors.FormattedError) []error
- type AuthorizeFunc
- type CacheAdaptor
- type Condition
- func (*Condition) Descriptor() ([]byte, []int)
- func (m *Condition) GetEqIDs() []int64
- func (m *Condition) GetEqKeys() []string
- func (m *Condition) GetNeIDs() []int64
- func (m *Condition) GetNeKeys() []string
- func (*Condition) ProtoMessage()
- func (m *Condition) Reset()
- func (m *Condition) String() string
- type Context
- type DataMessagePayload
- type Distribution
- func (*Distribution) Descriptor() ([]byte, []int)
- func (m *Distribution) GetCondition() *Condition
- func (m *Distribution) GetField() string
- func (m *Distribution) GetFilters() []*Filter
- func (m *Distribution) GetPayload() []byte
- func (m *Distribution) GetStrict() bool
- func (*Distribution) ProtoMessage()
- func (m *Distribution) Reset()
- func (m *Distribution) String() string
- type Filter
- func (*Filter) Descriptor() ([]byte, []int)
- func (m *Filter) GetBoolValue() bool
- func (m *Filter) GetBytesValue() []byte
- func (m *Filter) GetFloatValue() float64
- func (m *Filter) GetIntValue() int64
- func (m *Filter) GetKey() string
- func (m *Filter) GetStringValue() string
- func (m *Filter) GetTimeValue() int64
- func (m *Filter) GetValOneof() isFilter_ValOneof
- func (*Filter) ProtoMessage()
- func (m *Filter) Reset()
- func (m *Filter) String() string
- func (*Filter) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type Filter_BoolValue
- type Filter_BytesValue
- type Filter_FloatValue
- type Filter_IntValue
- type Filter_StringValue
- type Filter_TimeValue
- type HandlerFunc
- type HookFunc
- type Identity
- type InitMessagePayload
- type MessageAdaptor
- type OperationMessage
- type Option
- type Options
- type Service
- type StartMessagePayload
- type Store
- type Subscription
- type Subscriptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorsFromGraphQLErrors ¶
func ErrorsFromGraphQLErrors(errors []gqlerrors.FormattedError) []error
ErrorsFromGraphQLErrors convert from GraphQL errors to regular errors.
Types ¶
type CacheAdaptor ¶
type CacheAdaptor interface { Set(key []byte, data []byte, ttl time.Duration) error Get(key []byte) ([]byte, error) }
CacheAdaptor interface
type Condition ¶
type Condition struct { EqIDs []int64 `protobuf:"varint,10,rep,packed,name=EqIDs" json:"EqIDs,omitempty"` NeIDs []int64 `protobuf:"varint,11,rep,packed,name=NeIDs" json:"NeIDs,omitempty"` EqKeys []string `protobuf:"bytes,20,rep,name=EqKeys" json:"EqKeys,omitempty"` NeKeys []string `protobuf:"bytes,21,rep,name=NeKeys" json:"NeKeys,omitempty"` }
func (*Condition) Descriptor ¶
func (*Condition) ProtoMessage ¶
func (*Condition) ProtoMessage()
type Context ¶
type Context interface { Identity() Identity MachineID() string ProcessID() string Context() context.Context Req() *http.Request Res() http.ResponseWriter Client() router.Client Cookie() router.Cookie Header() router.Header Subscriptions() Subscriptions Connection() *websocket.Conn Cache() CacheAdaptor Message() MessageAdaptor Write(string, interface{}) error Error(string, interface{}) error Close() error BeforeOpen() AfterClose() }
Context interface
type DataMessagePayload ¶
type DataMessagePayload struct { Data interface{} `json:"data"` Errors []error `json:"errors"` }
DataMessagePayload defines the result data of an operation.
type Distribution ¶
type Distribution struct { Field string `protobuf:"bytes,10,opt,name=field" json:"field,omitempty"` Payload []byte `protobuf:"bytes,20,opt,name=payload,proto3" json:"payload,omitempty"` Filters []*Filter `protobuf:"bytes,30,rep,name=filters" json:"filters,omitempty"` Condition *Condition `protobuf:"bytes,50,opt,name=condition" json:"condition,omitempty"` Strict bool `protobuf:"varint,60,opt,name=strict" json:"strict,omitempty"` }
func (*Distribution) Descriptor ¶
func (*Distribution) Descriptor() ([]byte, []int)
func (*Distribution) GetCondition ¶
func (m *Distribution) GetCondition() *Condition
func (*Distribution) GetField ¶
func (m *Distribution) GetField() string
func (*Distribution) GetFilters ¶
func (m *Distribution) GetFilters() []*Filter
func (*Distribution) GetPayload ¶
func (m *Distribution) GetPayload() []byte
func (*Distribution) GetStrict ¶
func (m *Distribution) GetStrict() bool
func (*Distribution) ProtoMessage ¶
func (*Distribution) ProtoMessage()
func (*Distribution) Reset ¶
func (m *Distribution) Reset()
func (*Distribution) String ¶
func (m *Distribution) String() string
type Filter ¶
type Filter struct { Key string `protobuf:"bytes,1,opt,name=key" json:"key,omitempty"` // Types that are valid to be assigned to ValOneof: // *Filter_StringValue // *Filter_IntValue // *Filter_FloatValue // *Filter_BoolValue // *Filter_BytesValue // *Filter_TimeValue ValOneof isFilter_ValOneof `protobuf_oneof:"val_oneof"` }
func (*Filter) Descriptor ¶
func (*Filter) GetBoolValue ¶
func (*Filter) GetBytesValue ¶
func (*Filter) GetFloatValue ¶
func (*Filter) GetIntValue ¶
func (*Filter) GetStringValue ¶
func (*Filter) GetTimeValue ¶
func (*Filter) GetValOneof ¶
func (m *Filter) GetValOneof() isFilter_ValOneof
func (*Filter) ProtoMessage ¶
func (*Filter) ProtoMessage()
type Filter_BoolValue ¶
type Filter_BoolValue struct {
BoolValue bool `protobuf:"varint,13,opt,name=bool_value,json=boolValue,oneof"`
}
type Filter_BytesValue ¶
type Filter_BytesValue struct {
BytesValue []byte `protobuf:"bytes,14,opt,name=bytes_value,json=bytesValue,proto3,oneof"`
}
type Filter_FloatValue ¶
type Filter_FloatValue struct {
FloatValue float64 `protobuf:"fixed64,12,opt,name=float_value,json=floatValue,oneof"`
}
type Filter_IntValue ¶
type Filter_IntValue struct {
IntValue int64 `protobuf:"varint,11,opt,name=int_value,json=intValue,oneof"`
}
type Filter_StringValue ¶
type Filter_StringValue struct {
StringValue string `protobuf:"bytes,10,opt,name=string_value,json=stringValue,oneof"`
}
type Filter_TimeValue ¶
type Filter_TimeValue struct {
TimeValue int64 `protobuf:"varint,15,opt,name=time_value,json=timeValue,oneof"`
}
type Identity ¶
type Identity interface { HasID() bool GetID() int SetID(int) HasKey() bool GetKey() string SetKey(string) }
Identity interface
type InitMessagePayload ¶
type InitMessagePayload struct {
AuthToken string `json:"authToken"`
}
InitMessagePayload defines the parameters of a connection init message.
type MessageAdaptor ¶
type MessageAdaptor interface { Emit([]byte, []byte) error Listen([]byte, message.Handler) message.Close }
MessageAdaptor broker interface
type OperationMessage ¶
type OperationMessage struct { ID string `json:"id,omitempty"` Type string `json:"type"` Payload interface{} `json:"payload,omitempty"` }
OperationMessage represents a GraphQL WebSocket message.
func (*OperationMessage) Marshal ¶
func (msg *OperationMessage) Marshal() []byte
Marshal helper func
func (*OperationMessage) String ¶
func (msg *OperationMessage) String() string
func (*OperationMessage) Unmarshal ¶
func (msg *OperationMessage) Unmarshal(b []byte) error
Unmarshal helper func
type Options ¶
type Options struct { // engine server unique id ID string // message broker topic Topic []byte // graphql schema Schema graphql.Schema // cache engine Cache cache.Service // message broker Message message.Service }
Options is the engine server options
type Service ¶
type Service interface { Start() error Stop() error Publish(*Distribution) error Subscribe(*Distribution) error Subscriptions() Store Handle(router.Context, *websocket.Conn) Schema(graphql.Schema) Adaptor() router.GQLSubscriptionAdaptor Authorize(AuthorizeFunc) BeforeOpen(HookFunc) AfterClose(HookFunc) String() string }
Service interface
type StartMessagePayload ¶
type StartMessagePayload struct { Query string `json:"query"` Variables map[string]interface{} `json:"variables"` OperationName string `json:"operationName"` }
StartMessagePayload defines the parameters of an operation that a client requests to be started.
type Store ¶
type Store interface { Has(Subscription) bool Add(Subscription, ...bool) bool Del(Subscription) bool Get(...string) []Subscription }
Store interface
type Subscription ¶
type Subscription interface { ID() string Query() string Variables() map[string]interface{} Arguments() map[string]interface{} OperationName() string Document() *ast.Document Fields() []string Connection() Context }
Subscription interface
type Subscriptions ¶
type Subscriptions interface { Has(string) bool Add(Subscription, ...bool) bool Del(Subscription) bool Get(string) Subscription List() []Subscription Len() int }
Subscriptions interface