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.