Documentation
¶
Index ¶
- Constants
- Variables
- func RunFlashDriverTestCase[T Driver](t *testing.T, config *DriverTestConfig, getDriverCb func() T)
- type Client
- type ClientConfig
- type CreateEventCallback
- type DatabaseEvent
- type DatabaseEventsChan
- type DeleteEvent
- type DeleteEventCallback
- type Driver
- type DriverTestConfig
- type Event
- type EventCallback
- type EventData
- type ExecSqlFunc
- type InsertEvent
- type Listener
- type ListenerCondition
- type ListenerConfig
- type Operation
- type TestFn
- type TruncateEvent
- type UpdateEvent
Constants ¶
View Source
const (
OperationAll = OperationInsert | OperationUpdate | OperationDelete | OperationTruncate
)
Variables ¶
View Source
var DefaultDriverTestConfig = &DriverTestConfig{ ImagesVersions: []string{ "docker.io/postgres:14-alpine", "docker.io/postgres:15-alpine", "docker.io/postgres:16-alpine", }, Database: "testdb", Username: "testuser", Password: "testpasword", PropagationTimeout: time.Second, RegistrationTimeout: time.Second, Parallel: false, }
Functions ¶
func RunFlashDriverTestCase ¶
func RunFlashDriverTestCase[T Driver](t *testing.T, config *DriverTestConfig, getDriverCb func() T)
Types ¶
type Client ¶
type Client struct {
Config *ClientConfig
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(config *ClientConfig) (*Client, error)
type ClientConfig ¶
type CreateEventCallback ¶
type DatabaseEvent ¶
type DatabaseEventsChan ¶
type DatabaseEventsChan chan *DatabaseEvent
type DeleteEvent ¶
type DeleteEvent struct {
Old *EventData
}
func (*DeleteEvent) GetOperation ¶
func (e *DeleteEvent) GetOperation() Operation
type DeleteEventCallback ¶
type Driver ¶
type Driver interface {
Init(clientConfig *ClientConfig) error
Close() error
HandleOperationListenStart(listenerUid string, listenerConfig *ListenerConfig, operation Operation) error
HandleOperationListenStop(listenerUid string, listenerConfig *ListenerConfig, operation Operation) error
Listen(eventsChan *DatabaseEventsChan) error
}
type DriverTestConfig ¶
type DriverTestConfig struct {
ImagesVersions []string `default:"postgres,flash"`
Database string
Username string
Password string
ContainerCustomizers []testcontainers.ContainerCustomizer
PropagationTimeout time.Duration // Delay for event propagated from the DB to the eventsChan
RegistrationTimeout time.Duration // Delay for OperationListenStart / HandleOperationListenStop
Parallel bool
}
type EventCallback ¶
type EventCallback func(event Event)
type InsertEvent ¶
type InsertEvent struct {
New *EventData
}
func (*InsertEvent) GetOperation ¶
func (e *InsertEvent) GetOperation() Operation
type Listener ¶
type Listener struct {
Config *ListenerConfig
// Internals
sync.Mutex
// contains filtered or unexported fields
}
func NewListener ¶
func NewListener(config *ListenerConfig) (*Listener, error)
func (*Listener) Init ¶
func (l *Listener) Init(_createCallback CreateEventCallback, _deleteCallback DeleteEventCallback) error
Init emit all event for first boot */
type ListenerCondition ¶
type ListenerCondition struct {
Column string
//Operator string //TODO actually only equals are implemented
Value any
}
TODO SORTIR VERIFICATION AU NIVEAU LISTENER, PBM oblige à envoyer les columns dans l'event
type ListenerConfig ¶
type ListenerConfig struct {
Table string // Can be prefixed by schema - e.g: public.posts
Fields []string // Empty fields means all ( SELECT * )
MaxParallelProcess int // Default to 1 (not parallel) -> use -1 for Infinity
Conditions []*ListenerCondition
}
type Operation ¶
type Operation uint8
func OperationFromName ¶
func (Operation) GetAtomics ¶
func (Operation) IncludeAll ¶
IncludeAll checks if the current operation includes all specified atomic operations.
func (Operation) IncludeOne ¶
IncludeOne checks if the current operation includes at least one of the specified atomic operations.
func (Operation) StrictName ¶
StrictName returns the name of the operation, or throws an error if it doesn't exist
type TruncateEvent ¶
type TruncateEvent struct{}
func (*TruncateEvent) GetOperation ¶
func (e *TruncateEvent) GetOperation() Operation
type UpdateEvent ¶
func (*UpdateEvent) GetOperation ¶
func (e *UpdateEvent) GetOperation() Operation
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
_examples
|
|
|
debug_trace
command
|
|
|
development
command
|
|
|
parallel_callback
command
|
|
|
specific_fields
command
|
|
|
trigger_all
command
|
|
|
trigger_insert
command
|
|
|
drivers
|
|
|
trigger
module
|
|
|
wal_logical
module
|
Click to show internal directories.
Click to hide internal directories.