Documentation ¶
Index ¶
- func NewSchema(opts ...apigraphql.Option) graphql.ExecutableSchema
- type Connection
- type PubSub
- func (pb *PubSub) AddConnBy(id uuid.UUID, filter *model.MessageFilter) *Connection
- func (pb *PubSub) GetConn(ctx context.Context, connID uuid.UUID) (*Connection, error)
- func (pb *PubSub) GetFilter(ctx context.Context) (*model.MessageFilter, error)
- func (pb *PubSub) RemoveConn(ctx context.Context) error
- func (pb *PubSub) Start(ctx context.Context) error
- func (pb *PubSub) Stop(ctx context.Context) error
- func (pb *PubSub) Subscribe(ctx context.Context, topic string) (chan *model.Message, error)
- type Resolver
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSchema ¶
func NewSchema(opts ...apigraphql.Option) graphql.ExecutableSchema
NewSchema creates a graphql executable schema.
Types ¶
type Connection ¶
type Connection struct { ID uuid.UUID Filter model.MessageFilter Subscribers map[string]chan *model.Message }
Connection 对应客户端连接,共享队列机制.连接在用户真正订阅时才会创建连接.
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub 订阅管理器
func (*PubSub) AddConnBy ¶
func (pb *PubSub) AddConnBy(id uuid.UUID, filter *model.MessageFilter) *Connection
func (*PubSub) RemoveConn ¶
RemoveConn 移除连接,忽略对于连接ID不匹配的错误
type Resolver ¶
type Resolver struct {
*apigraphql.Resolver
}
func NewResolver ¶
func NewResolver(opt ...apigraphql.Option) *Resolver
Click to show internal directories.
Click to hide internal directories.