Documentation ¶
Index ¶
- Variables
- func NewChangeFeedConnection(ctx context.Context, l *logrusx.Logger, dsn string) (*sqlx.DB, error)
- func WatchAndServeWS(ctx context.Context, u *url.URL, writer herodot.Writer) (http.HandlerFunc, error)
- type ChangeEvent
- type ErrorEvent
- type Event
- type EventChannel
- type RemoveEvent
- type Watcher
- func Watch(ctx context.Context, u *url.URL, c EventChannel) (Watcher, error)
- func WatchChangeFeed(ctx context.Context, cx *sqlx.DB, tableName string, out EventChannel, ...) (_ Watcher, err error)
- func WatchDirectory(ctx context.Context, dir string, c EventChannel) (Watcher, error)
- func WatchFile(ctx context.Context, file string, c EventChannel) (Watcher, error)
- func WatchWebsocket(ctx context.Context, u *url.URL, c EventChannel) (Watcher, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrSchemeUnknown is just for checking with errors.Is() ErrSchemeUnknown = &errSchemeUnknown{} ErrWatcherNotRunning = fmt.Errorf("watcher is not running") )
Functions ¶
func NewChangeFeedConnection ¶ added in v0.0.247
Types ¶
type ChangeEvent ¶
type ChangeEvent struct {
// contains filtered or unexported fields
}
func (*ChangeEvent) MarshalJSON ¶ added in v0.0.145
func (e *ChangeEvent) MarshalJSON() ([]byte, error)
func (*ChangeEvent) Reader ¶
func (e *ChangeEvent) Reader() io.Reader
func (*ChangeEvent) String ¶ added in v0.0.171
func (e *ChangeEvent) String() string
type ErrorEvent ¶
type ErrorEvent struct {
// contains filtered or unexported fields
}
func (*ErrorEvent) MarshalJSON ¶ added in v0.0.145
func (e *ErrorEvent) MarshalJSON() ([]byte, error)
func (*ErrorEvent) Reader ¶
func (e *ErrorEvent) Reader() io.Reader
func (*ErrorEvent) String ¶ added in v0.0.171
func (e *ErrorEvent) String() string
type EventChannel ¶
type EventChannel chan Event
type RemoveEvent ¶
type RemoveEvent struct {
// contains filtered or unexported fields
}
func (*RemoveEvent) MarshalJSON ¶ added in v0.0.145
func (e *RemoveEvent) MarshalJSON() ([]byte, error)
func (*RemoveEvent) Reader ¶
func (e *RemoveEvent) Reader() io.Reader
func (*RemoveEvent) String ¶ added in v0.0.171
func (e *RemoveEvent) String() string
type Watcher ¶ added in v0.0.168
type Watcher interface { // DispatchNow fires the watcher and causes an event. // // WARNING: The returned channel must be read or no further events will // be propagated due to a deadlock. DispatchNow() (<-chan int, error) }
func WatchChangeFeed ¶ added in v0.0.247
func WatchChangeFeed(ctx context.Context, cx *sqlx.DB, tableName string, out EventChannel, cursor time.Time) (_ Watcher, err error)
WatchChangeFeed sends changed rows on the channel. To cancel the execution, cancel the context!
Watcher.DispatchNow() does not have an effect in this method.
This watcher is blocking to allow proper context cancellation and clean up.
func WatchDirectory ¶ added in v0.0.142
func WatchFile ¶
WatchFile spawns a background goroutine to watch file, reporting any changes to c. When initially starting to watch the file fails, c is closed. Watching stops when ctx is canceled, at which point c is also closed.
func WatchWebsocket ¶ added in v0.0.145
Source Files ¶
Click to show internal directories.
Click to hide internal directories.