Documentation ¶
Index ¶
- Constants
- func GetDriverAndName(dataSourceAddress string) (dsd, dsn string, err error)
- func IsConnected(ctx context.Context, db *sql.DB) error
- func LoadDriver(dataSourceAddress string) (drvDialect string, drv *sql.DB, err error)
- func NewStatsCollectorWith(db *sql.DB) prometheus.Collector
- func Wait(ctx context.Context, drv *sql.DB) (err error)
- type Embedded
- type ListenHandler
- type Listener
- type Option
Constants ¶
View Source
const (
DialectPostgres = "postgres"
)
Variables ¶
This section is empty.
Functions ¶
func GetDriverAndName ¶
func LoadDriver ¶
func NewStatsCollectorWith ¶
func NewStatsCollectorWith(db *sql.DB) prometheus.Collector
Types ¶
type ListenHandler ¶
type ListenHandler interface { // Channels returns the name list of multiple channels to establish. Channels() []string // Handle handles the payload according to the given channel. Handle(ctx context.Context, channel, payload string) }
ListenHandler holds the operations for the database listen handler.
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
Listener subscribes the database listen channel and handle the event.
func NewListener ¶
NewListener create database listener with options.
func (*Listener) Register ¶
func (l *Listener) Register(handler ListenHandler) error
Register listens the channel returns by the given handler and handles by the given handler if event received.
Click to show internal directories.
Click to hide internal directories.