Expose reader state
This commit is contained in:
parent
ca74b866b6
commit
1308d3306a
|
@ -35,6 +35,10 @@ func New(dsn string, sc slave.Config) (*Reader, error) {
|
|||
|
||||
r := &Reader{
|
||||
conn: conn,
|
||||
state: binlog.Position{
|
||||
File: sc.File,
|
||||
Offset: uint64(sc.Offset),
|
||||
},
|
||||
}
|
||||
r.initTableMap()
|
||||
|
||||
|
@ -131,6 +135,11 @@ func (r *Reader) ReadEvent() (*Event, error) {
|
|||
return &evt, err
|
||||
}
|
||||
|
||||
// State returns current position in the binary log.
|
||||
func (r *Reader) State() binlog.Position {
|
||||
return r.state
|
||||
}
|
||||
|
||||
// Close underlying database connection.
|
||||
func (r *Reader) Close() error {
|
||||
return r.conn.Close()
|
||||
|
|
Loading…
Reference in New Issue