Documentation ¶
Index ¶
- Variables
- func OnModuleHashMismatchNames() []string
- type ColumnInfo
- type CursorError
- type DSN
- type Loader
- func (l *Loader) Delete(tableName string, primaryKey string) error
- func (l *Loader) DeleteAllCursors(ctx context.Context) (err error)
- func (l *Loader) DeleteCursor(ctx context.Context, moduleHash string) error
- func (l *Loader) EntriesCount() uint64
- func (l *Loader) Flush(ctx context.Context, outputModuleHash string, cursor *sink.Cursor) (err error)
- func (l *Loader) FlushInterval() time.Duration
- func (l *Loader) GetAllCursors(ctx context.Context) (out map[string]*sink.Cursor, err error)
- func (l *Loader) GetAvailableTablesInSchema() string
- func (l *Loader) GetCursor(ctx context.Context, outputModuleHash string) (cursor *sink.Cursor, mistmatchDetected bool, err error)
- func (l *Loader) GetDatabase() string
- func (l *Loader) GetIdentifier() string
- func (l *Loader) HasTable(tableName string) bool
- func (l *Loader) Insert(tableName string, primaryKey string, data map[string]string) error
- func (l *Loader) InsertCursor(ctx context.Context, moduleHash string, c *sink.Cursor) error
- func (l *Loader) LoadTables() error
- func (l *Loader) MarshalLogObject(encoder zapcore.ObjectEncoder) error
- func (l *Loader) Setup(ctx context.Context, schemaFile string) error
- func (l *Loader) Update(tableName string, primaryKey string, data map[string]string) error
- func (l *Loader) UpdateCursor(ctx context.Context, tx *sql.Tx, moduleHash string, c *sink.Cursor) error
- type OnModuleHashMismatch
- type Operation
- type OperationType
- type Queryable
- type TableInfo
- type TypeGetter
Constants ¶
This section is empty.
Variables ¶
var ErrCursorNotFound = errors.New("cursor not found")
var ErrInvalidOnModuleHashMismatch = fmt.Errorf("not a valid OnModuleHashMismatch, try [%s]", strings.Join(_OnModuleHashMismatchNames, ", "))
Functions ¶
func OnModuleHashMismatchNames ¶
func OnModuleHashMismatchNames() []string
OnModuleHashMismatchNames returns a list of possible string values of OnModuleHashMismatch.
Types ¶
type ColumnInfo ¶
type ColumnInfo struct {
// contains filtered or unexported fields
}
func NewColumnInfo ¶
func NewColumnInfo(name string, databaseTypeName string, scanType any) *ColumnInfo
type CursorError ¶
type CursorError struct {
// contains filtered or unexported fields
}
type Loader ¶
func (*Loader) Delete ¶
Delete a row in the DB, it is assumed the table exists, you can do a check before with HasTable()
func (*Loader) DeleteAllCursors ¶
DeleteAllCursors deletes the active cursor for the given 'moduleHash'. If no cursor is active and no delete occurrred, returns ErrCursorNotFound. If the delete was not successful on the database, returns an error.
func (*Loader) DeleteCursor ¶
DeleteCursor deletes the active cursor for the given 'moduleHash'. If no cursor is active and no delete occurrred, returns ErrCursorNotFound. If the delete was not successful on the database, returns an error.
func (*Loader) EntriesCount ¶
func (*Loader) FlushInterval ¶
func (*Loader) GetAllCursors ¶
GetAllCursors returns an unordered map given for each module's hash recorded the active cursor for it.
func (*Loader) GetAvailableTablesInSchema ¶
func (*Loader) GetDatabase ¶
func (*Loader) GetIdentifier ¶
GetIdentifier returns <database>/<schema> suitable for user presentation
func (*Loader) Insert ¶
Insert a row in the DB, it is assumed the table exists, you can do a check before with HasTable()
func (*Loader) InsertCursor ¶
func (*Loader) LoadTables ¶
func (*Loader) MarshalLogObject ¶
func (l *Loader) MarshalLogObject(encoder zapcore.ObjectEncoder) error
func (*Loader) Update ¶
Update a row in the DB, it is assumed the table exists, you can do a check before with HasTable()
func (*Loader) UpdateCursor ¶
func (l *Loader) UpdateCursor(ctx context.Context, tx *sql.Tx, moduleHash string, c *sink.Cursor) error
UpdateCursor updates the active cursor. If no cursor is active and no update occurred, returns ErrCursorNotFound. If the update was not successful on the database, returns an error.
type OnModuleHashMismatch ¶
type OnModuleHashMismatch uint
ENUM(
Ignore Warn Error
)
const ( // OnModuleHashMismatchIgnore is a OnModuleHashMismatch of type Ignore. OnModuleHashMismatchIgnore OnModuleHashMismatch = iota // OnModuleHashMismatchWarn is a OnModuleHashMismatch of type Warn. OnModuleHashMismatchWarn // OnModuleHashMismatchError is a OnModuleHashMismatch of type Error. OnModuleHashMismatchError )
func ParseOnModuleHashMismatch ¶
func ParseOnModuleHashMismatch(name string) (OnModuleHashMismatch, error)
ParseOnModuleHashMismatch attempts to convert a string to a OnModuleHashMismatch.
func (OnModuleHashMismatch) IsValid ¶
func (x OnModuleHashMismatch) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (OnModuleHashMismatch) MarshalText ¶
func (x OnModuleHashMismatch) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (OnModuleHashMismatch) String ¶
func (x OnModuleHashMismatch) String() string
String implements the Stringer interface.
func (*OnModuleHashMismatch) UnmarshalText ¶
func (x *OnModuleHashMismatch) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type OperationType ¶
type OperationType string
const ( OperationTypeInsert OperationType = "INSERT" OperationTypeUpdate OperationType = "UPDATE" OperationTypeDelete OperationType = "DELETE" )
type TableInfo ¶
type TableInfo struct {
// contains filtered or unexported fields
}
func NewTableInfo ¶
func NewTableInfo(name, primaryKeyColumnName string, columnsByName map[string]*ColumnInfo) (*TableInfo, error)