Skip to content

Commit

Permalink
#104 Savepoint
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj committed Sep 5, 2024
1 parent 4b08de9 commit cdce3c2
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 29 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ Specific uses:

See [main.go] for an example of use.

### Database URLs

## References

1. [API documentation]
Expand Down
27 changes: 15 additions & 12 deletions checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
// Types
// ----------------------------------------------------------------------------

// BasicChecker is the default implementation of the SqlExecutor interface.
// Type BasicChecker struct is the default implementation of the [Checker] interface.
type BasicChecker struct {
DatabaseConnector driver.Connector
isTrace bool
Expand Down Expand Up @@ -49,7 +49,7 @@ var traceOptions = []interface{}{
// ----------------------------------------------------------------------------

/*
The IsInstalled verifies that the Senzing schema has been installed.
Method IsSchemaInstalled verifies that the Senzing schema has been installed.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -100,10 +100,13 @@ func (schemaChecker *BasicChecker) IsSchemaInstalled(ctx context.Context) (bool,
}

/*
The IsInstalled verifies that the Senzing schema has been installed.
Method RecordCount retrieves the number of records ingested into the Senzing datastore.
Input
- ctx: A context to control lifecycle.
Output
- Number of records in Senzing datastore.
*/
func (schemaChecker *BasicChecker) RecordCount(ctx context.Context) (int64, error) {
var (
Expand Down Expand Up @@ -151,7 +154,7 @@ func (schemaChecker *BasicChecker) RecordCount(ctx context.Context) (int64, erro
}

/*
The RegisterObserver method adds the observer to the list of observers notified.
Method RegisterObserver adds the observer to the list of observers notified.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -180,7 +183,7 @@ func (schemaChecker *BasicChecker) RegisterObserver(ctx context.Context, observe
}

/*
The SetLogLevel method sets the level of logging.
Method SetLogLevel sets the level of logging.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -214,7 +217,7 @@ func (schemaChecker *BasicChecker) SetLogLevel(ctx context.Context, logLevelName
}

/*
The SetObserverOrigin method sets the "origin" value in future Observer messages.
Method SetObserverOrigin sets the "origin" value in future Observer messages.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -275,7 +278,7 @@ func (schemaChecker *BasicChecker) SetObserverOrigin(ctx context.Context, origin
}

/*
The UnregisterObserver method removes the observer to the list of observers notified.
Method UnregisterObserver removes the observer to the list of observers notified.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -310,7 +313,7 @@ func (schemaChecker *BasicChecker) UnregisterObserver(ctx context.Context, obser
// Internal methods
// ----------------------------------------------------------------------------

// Get the Logger singleton.
// Method getLogger gets the Logger singleton.
func (schemaChecker *BasicChecker) getLogger() logging.Logging {
var err error
if schemaChecker.logger == nil {
Expand All @@ -322,24 +325,24 @@ func (schemaChecker *BasicChecker) getLogger() logging.Logging {
return schemaChecker.logger
}

// Log message.
// Method log logs a message.
func (schemaChecker *BasicChecker) log(messageNumber int, details ...interface{}) {
schemaChecker.getLogger().Log(messageNumber, details...)
}

// Debug.
// Method debug logs a debug message.
func (schemaChecker *BasicChecker) debug(messageNumber int, details ...interface{}) {
details = append(details, debugOptions...)
schemaChecker.getLogger().Log(messageNumber, details...)
}

// Trace method entry.
// Method traceEntry logs an entry Trace message.
func (schemaChecker *BasicChecker) traceEntry(messageNumber int, details ...interface{}) {
details = append(details, traceOptions...)
schemaChecker.getLogger().Log(messageNumber, details...)
}

// Trace method exit.
// Method traceExit logs an exit Trace message.
func (schemaChecker *BasicChecker) traceExit(messageNumber int, details ...interface{}) {
details = append(details, traceOptions...)
schemaChecker.getLogger().Log(messageNumber, details...)
Expand Down
4 changes: 2 additions & 2 deletions checker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ type Checker interface {
// Constants
// ----------------------------------------------------------------------------

// Identfier of the package found messages having the format "senzing-6423xxxx".
// Identfier of the package found messages having the format "SZSDK6423xxxx".
const ComponentID = 6424

// ----------------------------------------------------------------------------
// Variables
// ----------------------------------------------------------------------------

// Message templates for sqlfiler implementation.
// Message templates for checker implementation.
var IDMessages = map[int]string{
1: "Enter IsSchemaInstalled().",
2: "Exit IsSchemaInstalled() returned (%i).",
Expand Down
6 changes: 4 additions & 2 deletions connector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ import (
// ----------------------------------------------------------------------------

/*
A factory for producing the correct driver.Connector for a given database URL.
Function NewConnector is a factory for producing the correct driver.Connector for a given database URL.
Input
- databaseUrl: A properly formed URL containing database connection information
For acceptable database URLs, see https://....
For acceptable database URLs, see [Database URLs].
[Database URLs]: https://github.com/senzing-garage/go-databasing/blob/main/README.md#use
*/
func NewConnector(ctx context.Context, databaseURL string) (driver.Connector, error) {
var result driver.Connector
Expand Down
2 changes: 1 addition & 1 deletion connector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ package connector
// Constants
// ----------------------------------------------------------------------------

// Identfier of the package found messages having the format "senzing-6421xxxx".
// Identfier of the package found messages having the format "SZSDK6421xxxx".
const ComponentID = 6421
7 changes: 5 additions & 2 deletions connectormssql/connectormssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ import (
// ----------------------------------------------------------------------------

/*
Wrapper for https://pkg.go.dev/github.com/microsoft/go-mssqldb#NewConnector
Function NewConnector is a wrapper for [Microsoft's MSSQL connector].
Input
- configuration: See https://github.com/microsoft/go-mssqldb
- configuration: See [microsoft/go-mssqldb].
[Microsoft's MSSQL connector]: https://pkg.go.dev/github.com/microsoft/go-mssqldb#NewConnector
[microsoft/go-mssqldb]: https://github.com/microsoft/go-mssqldb
*/
func NewConnector(ctx context.Context, dsn string) (driver.Connector, error) {
_ = ctx
Expand Down
4 changes: 2 additions & 2 deletions postgresql/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ type Postgresql interface {
// Constants
// ----------------------------------------------------------------------------

// Identfier of the package found messages having the format "senzing-6423xxxx".
// Identfier of the package found messages having the format "SZSDK6423xxxx".
const ComponentID = 6423

// ----------------------------------------------------------------------------
// Variables
// ----------------------------------------------------------------------------

// Message templates for sqlfiler implementation.
// Message templates for postgresql implementation.
var IDMessages = map[int]string{
1: "Enter GetCurrentWatermark().",
2: "Exit GetCurrentWatermark() returned (%s, %d, %v).",
Expand Down
4 changes: 2 additions & 2 deletions sqlexecutor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ type SQLExecutor interface {
// Constants
// ----------------------------------------------------------------------------

// Identfier of the package found messages having the format "senzing-6422xxxx".
// Identfier of the package found messages having the format "SZSDK6422xxxx".
const ComponentID = 6422

// ----------------------------------------------------------------------------
// Variables
// ----------------------------------------------------------------------------

// Message templates for sqlfiler implementation.
// Message templates for sqlexecutor implementation.
var IDMessages = map[int]string{
1: "Enter ProcessFileName(%s).",
2: "Exit ProcessFileName(%s) returned (%v).",
Expand Down
12 changes: 6 additions & 6 deletions sqlexecutor/sqlexecutor_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// Types
// ----------------------------------------------------------------------------

// BasicSQLExecutor is the default implementation of the SqlExecutor interface.
// BasicSQLExecutor is the default implementation of the [SQLExecutor] interface.
type BasicSQLExecutor struct {
DatabaseConnector driver.Connector `json:"databaseConnector,omitempty"`
isTrace bool
Expand All @@ -48,7 +48,7 @@ var traceOptions = []interface{}{
// ----------------------------------------------------------------------------

/*
The ProcessFileName is a convenience method for calling method ProcessScanner using a filename.
Method ProcessFileName is a convenience method for calling method [BasicSQLExecutor.ProcessScanner] using a filename.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -97,7 +97,7 @@ func (sqlExecutor *BasicSQLExecutor) ProcessFileName(ctx context.Context, filena
}

/*
The ProcessScanner does a database call for each line scanned.
Method ProcessScanner does a database call for each line scanned.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -174,7 +174,7 @@ func (sqlExecutor *BasicSQLExecutor) ProcessScanner(ctx context.Context, scanner
}

/*
The RegisterObserver method adds the observer to the list of observers notified.
Method RegisterObserver method adds the observer to the list of observers notified.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -211,7 +211,7 @@ func (sqlExecutor *BasicSQLExecutor) RegisterObserver(ctx context.Context, obser
}

/*
The SetLogLevel method sets the level of logging.
Method SetLogLevel method sets the level of logging.
Input
- ctx: A context to control lifecycle.
Expand Down Expand Up @@ -247,7 +247,7 @@ func (sqlExecutor *BasicSQLExecutor) SetLogLevel(ctx context.Context, logLevelNa
}

/*
The SetObserverOrigin method sets the "origin" value in future Observer messages.
Method SetObserverOrigin method sets the "origin" value in future Observer messages.
Input
- ctx: A context to control lifecycle.
Expand Down

0 comments on commit cdce3c2

Please sign in to comment.