mirror of https://github.com/jackc/pgx.git
Replication: add NOEXPORT_SNAPSHOT, add GetConnInfo() func
parent
e49735a0c4
commit
04bead7c8a
|
@ -11,6 +11,7 @@ import (
|
||||||
|
|
||||||
"github.com/jackc/pgx/pgio"
|
"github.com/jackc/pgx/pgio"
|
||||||
"github.com/jackc/pgx/pgproto3"
|
"github.com/jackc/pgx/pgproto3"
|
||||||
|
"github.com/jackc/pgx/pgtype"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -212,6 +213,10 @@ func (rc *ReplicationConn) CauseOfDeath() error {
|
||||||
return rc.c.CauseOfDeath()
|
return rc.c.CauseOfDeath()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (rc *ReplicationConn) GetConnInfo() *pgtype.ConnInfo {
|
||||||
|
return rc.c.ConnInfo
|
||||||
|
}
|
||||||
|
|
||||||
func (rc *ReplicationConn) readReplicationMessage() (r *ReplicationMessage, err error) {
|
func (rc *ReplicationConn) readReplicationMessage() (r *ReplicationMessage, err error) {
|
||||||
msg, err := rc.c.rxMsg()
|
msg, err := rc.c.rxMsg()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -436,7 +441,7 @@ func (rc *ReplicationConn) StartReplication(slotName string, startLsn uint64, ti
|
||||||
|
|
||||||
// Create the replication slot, using the given name and output plugin.
|
// Create the replication slot, using the given name and output plugin.
|
||||||
func (rc *ReplicationConn) CreateReplicationSlot(slotName, outputPlugin string) (err error) {
|
func (rc *ReplicationConn) CreateReplicationSlot(slotName, outputPlugin string) (err error) {
|
||||||
_, err = rc.c.Exec(fmt.Sprintf("CREATE_REPLICATION_SLOT %s LOGICAL %s", slotName, outputPlugin))
|
_, err = rc.c.Exec(fmt.Sprintf("CREATE_REPLICATION_SLOT %s LOGICAL %s NOEXPORT_SNAPSHOT", slotName, outputPlugin))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue