Documentation
ΒΆ
Index ΒΆ
- Variables
- func GetConfigPath() string
- func GetLoggerForModule(ModuleID string) *zerolog.Logger
- func GetLoggerForProcessor(processor *Processor) *zerolog.Logger
- func GetLoggerForSourceDriver(driverID string) *zerolog.Logger
- func GetLoggerForTargetDriver(driver TargetDriver) *zerolog.Logger
- func LoadConfig() error
- func SaveConfig() error
- func SetConfigPath(newPath string)
- func Start() error
- type App
- type Condition
- type DbDeleteEvent
- type DbEvent
- type DbInsertEvent
- type DbPatchEvent
- type DbTruncateEvent
- type Document
- type Exporter
- type JsonConfig
- type JsonMapping
- type JsonMappingField
- type JsonProcessor
- type JsonSource
- type JsonTarget
- type Mapping
- type Module
- type Processor
- type Relation
- type RelationPivot
- type SimpleField
- type Source
- type SourceDriver
- type SourceDriverConfig
- type SourceDriverStats
- type SourceDriverStatsTable
- type Target
- type TargetDeleteEvent
- type TargetDriver
- type TargetDriverConfig
- type TargetEvent
- type TargetInsertEvent
- type TargetPatchEvent
- type TargetTruncateEvent
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var Exporters = utils.NewRegistry[Exporter]("exporter")
Exporters is a registry that allows external library to register their own exporter
View Source
var Modules = utils.NewRegistry[Module]("module").ValidateUsing(func(ID string, module Module) error { if module.New == nil { return errors.New(`module doesn't implements "New" method`) } if val := module.New(); val == nil { return errors.New(`module "New" method must return a non-nil instance`) } return nil })
Modules is a registry that allows external library to register their own modules
View Source
var Processors = utils.NewRegistry[*Processor]("processor").SetIdGenerator(func(item **Processor) (string, error) { ulid := ulid.Make().String() (*item).ID = ulid return ulid, nil })
View Source
var SourceDrivers = utils.NewRegistry[SourceDriver]("source-driver").ValidateUsing(func(ID string, driver SourceDriver) error { if driver.New == nil { return errors.New(`target driver doesn't implements "New" method`) } return nil })
SourceDrivers is a registry that allows external library to register their own source driver
View Source
var Sources = utils.NewRegistry[Source]("source").SetIdGenerator(func(item *Source) (string, error) { ulid := ulid.Make().String() item.ID = ulid return ulid, nil })
View Source
var TargetDrivers = utils.NewRegistry[TargetDriver]("target-driver").ValidateUsing(func(ID string, driver TargetDriver) error { if driver.New == nil { return errors.New(`target driver doesn't implements "New" method`) } return nil })
TargetDrivers is a registry that allows external library to register their own target driver
View Source
var Targets = utils.NewRegistry[Target]("target").SetIdGenerator(func(item *Target) (string, error) { ulid := ulid.Make().String() item.ID = ulid return ulid, nil })
Functions ΒΆ
func GetConfigPath ΒΆ
func GetConfigPath() string
func GetLoggerForModule ΒΆ
func GetLoggerForProcessor ΒΆ
func GetLoggerForTargetDriver ΒΆ
func GetLoggerForTargetDriver(driver TargetDriver) *zerolog.Logger
func LoadConfig ΒΆ
func LoadConfig() error
func SaveConfig ΒΆ
func SaveConfig() error
func SetConfigPath ΒΆ
func SetConfigPath(newPath string)
Types ΒΆ
type DbDeleteEvent ΒΆ
type DbInsertEvent ΒΆ
type DbPatchEvent ΒΆ
type DbTruncateEvent ΒΆ
type DbTruncateEvent struct {
Relation *Relation
}
type Exporter ΒΆ
type Exporter interface { Name() string MimeType() string Load(w io.Writer) error BeforeAll() error WriteDocument(doc *Document, itemPosition uint64) error AfterAll() error }
Exporter is an interface for transforming a set of documents into a file.
type JsonConfig ΒΆ
type JsonConfig struct { Sources []*JsonSource `json:"sources"` Targets []*JsonTarget `json:"targets"` Processors []*JsonProcessor `json:"processors"` }
type JsonMapping ΒΆ
type JsonMapping []JsonMappingField
func SerializeMapping ΒΆ
func SerializeMapping(m *Mapping) (*JsonMapping, error)
type JsonMappingField ΒΆ
type JsonMappingField struct { FieldType string `json:"_type"` // Simple field Column string `json:"column,omitempty"` Alias string `json:"alias,omitempty"` // Relation Name string `json:"name,omitempty"` Type string `json:"type,omitempty"` Table string `json:"table,omitempty"` PrimaryKeys []string `json:"primary_keys,omitempty"` LocalKey string `json:"local_key,omitempty"` UsePivotTable bool `json:"use_pivot_table,omitempty"` PivotTable string `json:"pivot_table,omitempty"` ForeignPivotKey string `json:"foreign_pivot_key,omitempty"` LocalPivotKey string `json:"local_pivot_key,omitempty"` PivotFields []JsonMappingField `json:"pivot_fields,omitempty"` ForeignKey string `json:"foreign_key,omitempty"` Mapping JsonMapping `json:"mapping,omitempty"` }
type JsonProcessor ΒΆ
type JsonProcessor struct { ID string `json:"ID"` Source string `json:"source"` // as source_id Targets []string `json:"targets"` // as targets_id Table string `json:"table"` PrimaryKeys []string `json:"primary_keys"` Conditions []Condition `json:"conditions"` Mapping JsonMapping `json:"mapping"` Index string `json:"index"` Enabled bool `json:"enabled"` }
func SerializeProcessor ΒΆ
func SerializeProcessor(p *Processor) (*JsonProcessor, error)
type JsonSource ΒΆ
type JsonSource struct { ID string `json:"id"` Driver string `json:"driver"` Config any `json:"config"` }
func SerializeSource ΒΆ
func SerializeSource(s *Source) (*JsonSource, error)
type JsonTarget ΒΆ
type JsonTarget struct { ID string `json:"id"` Driver string `json:"driver"` Config any `json:"config"` }
func SerializeTarget ΒΆ
func SerializeTarget(t *Target) (*JsonTarget, error)
type Mapping ΒΆ
type Mapping struct { Fields []SimpleField Relations []Relation }
func UnserializeMapping ΒΆ
func UnserializeMapping(jm *JsonMapping, parent *Relation) (*Mapping, error)
type Processor ΒΆ
type Processor struct { ID string Indexing atomic.Bool Listening atomic.Bool ListenBroadcaster *utils.Broadcaster[DbEvent, TargetEvent] Source *Source Targets []*Target Table string PrimaryKeys []string Conditions []Condition Mapping Mapping Index string Enabled bool }
func UnserializeProcessor ΒΆ
func UnserializeProcessor(jp *JsonProcessor) (*Processor, error)
type Relation ΒΆ
type RelationPivot ΒΆ
type RelationPivot struct { Table string LocalKey string ForeignKey string Fields []SimpleField }
type SimpleField ΒΆ
type Source ΒΆ
type Source struct { ID string Driver SourceDriver Config utils.DynamicConfig }
func UnserializeSource ΒΆ
func UnserializeSource(js *JsonSource) (*Source, error)
type SourceDriver ΒΆ
type SourceDriver interface { ID() string New(config any) (SourceDriver, error) Config() SourceDriverConfig TestConfig() (string, error) // TODO USELESS REPLACE IN FAVOR OF STATS TO CHECK NOT EMPTY Stats() (*SourceDriverStats, error) // GetDocumentsForProcessor use limit=0 to unlimited GetDocumentsForProcessor(processor *Processor, in chan<- *Document, ctx context.Context, limit uint64) error Start(processor *Processor, in utils.BroadcasterIn[DbEvent]) error Stop() error }
type SourceDriverConfig ΒΆ
type SourceDriverConfig struct { Name string `json:"name"` Config utils.DynamicConfig `json:"-"` // As inlined SVG Image string `json:"image,omitempty"` Notes []string `json:"notes,omitempty"` }
type SourceDriverStats ΒΆ
type SourceDriverStats map[string]SourceDriverStatsTable
type SourceDriverStatsTable ΒΆ
type Target ΒΆ
type Target struct { ID string Driver TargetDriver Config utils.DynamicConfig }
func UnserializeTarget ΒΆ
func UnserializeTarget(js *JsonTarget) (*Target, error)
type TargetDeleteEvent ΒΆ
type TargetDriver ΒΆ
type TargetDriver interface { ID() string New(config any) (TargetDriver, error) Config() TargetDriverConfig TestConfig() (string, error) // TODO USELESS REPLACE IN FAVOR OF STATS TO CHECK NOT EMPTY HandleEvents(processor *Processor, eventsChan <-chan TargetEvent) error Shutdown() error }
type TargetDriverConfig ΒΆ
type TargetDriverConfig struct { Name string `json:"name"` Config utils.DynamicConfig `json:"-"` // As inlined SVG Image string `json:"image,omitempty"` Notes []string `json:"notes,omitempty"` }
type TargetEvent ΒΆ
type TargetEvent any // TargetDeleteEvent | TargetInsertEvent | TargetPatchEvent | TargetTruncateEvent
type TargetInsertEvent ΒΆ
type TargetPatchEvent ΒΆ
type TargetTruncateEvent ΒΆ
type TargetTruncateEvent struct {
Relation *Relation
}
Source Files
ΒΆ
Directories
ΒΆ
Path | Synopsis |
---|---|
app
module
|
|
exporters
|
|
modules
|
|
source-drivers
|
|
postgresql_trigger
Module
|
|
postgresql_wal
Module
|
|
target-drivers
|
|
Click to show internal directories.
Click to hide internal directories.