Documentation ¶
Index ¶
- func Alter(hub, topic, callbackURL, mode string) error
- func MakeCallbackURL(baseURL, id string) string
- func Subscribe(hub, topic, callbackURL string) error
- func Unsubscribe(hub, topic, callbackURL string) error
- type Client
- type Handler
- type MessageHandler
- type SQLiteState
- func (s *SQLiteState) Add(hub, topic, baseURL string) (*Subscription, string, error)
- func (s *SQLiteState) All() ([]Subscription, error)
- func (s *SQLiteState) Del(hub, topic string) error
- func (s *SQLiteState) Get(hub, topic string) (*Subscription, error)
- func (s *SQLiteState) GetByID(id string) (*Subscription, error)
- func (s *SQLiteState) Set(hub, topic string, updatedAt, expiresAt time.Time) error
- type State
- type Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeCallbackURL ¶
func Unsubscribe ¶
Types ¶
type Client ¶
type Client struct { CallbackURL string State State OnMessage MessageHandler }
func (*Client) Unsubscribe ¶
type Handler ¶
type MessageHandler ¶
type MessageHandler func(id string, s *Subscription, rd io.ReadCloser)
type SQLiteState ¶
func NewSQLiteState ¶
func NewSQLiteState(db *sql.DB) *SQLiteState
func (*SQLiteState) Add ¶
func (s *SQLiteState) Add(hub, topic, baseURL string) (*Subscription, string, error)
func (*SQLiteState) All ¶
func (s *SQLiteState) All() ([]Subscription, error)
func (*SQLiteState) Del ¶
func (s *SQLiteState) Del(hub, topic string) error
func (*SQLiteState) Get ¶
func (s *SQLiteState) Get(hub, topic string) (*Subscription, error)
func (*SQLiteState) GetByID ¶
func (s *SQLiteState) GetByID(id string) (*Subscription, error)
type State ¶
type State interface { All() (subscriptions []Subscription, err error) Add(hub, topic, baseURL string) (subscription *Subscription, oldCallbackURL string, err error) Get(hub, topic string) (subscription *Subscription, err error) GetByID(id string) (subscription *Subscription, err error) Set(hub, topic string, updatedAt, expiresAt time.Time) (err error) Del(hub, topic string) (err error) }
Click to show internal directories.
Click to hide internal directories.