From cdce3c22205745483689f7a63a85fb250486dd85 Mon Sep 17 00:00:00 2001 From: docktermj Date: Thu, 5 Sep 2024 13:03:56 -0400 Subject: [PATCH] #104 Savepoint --- README.md | 2 ++ checker/checker.go | 27 +++++++++++++++------------ checker/main.go | 4 ++-- connector/connector.go | 6 ++++-- connector/main.go | 2 +- connectormssql/connectormssql.go | 7 +++++-- postgresql/main.go | 4 ++-- sqlexecutor/main.go | 4 ++-- sqlexecutor/sqlexecutor_basic.go | 12 ++++++------ 9 files changed, 39 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index fb141ea..2ffd28d 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,8 @@ Specific uses: See [main.go] for an example of use. +### Database URLs + ## References 1. [API documentation] diff --git a/checker/checker.go b/checker/checker.go index 15141b3..861a558 100644 --- a/checker/checker.go +++ b/checker/checker.go @@ -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 @@ -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. @@ -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 ( @@ -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. @@ -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. @@ -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. @@ -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. @@ -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 { @@ -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...) diff --git a/checker/main.go b/checker/main.go index a7a8b70..ea23e53 100644 --- a/checker/main.go +++ b/checker/main.go @@ -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).", diff --git a/connector/connector.go b/connector/connector.go index 6d765f6..76b13ef 100644 --- a/connector/connector.go +++ b/connector/connector.go @@ -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 diff --git a/connector/main.go b/connector/main.go index b407d67..03f7b29 100644 --- a/connector/main.go +++ b/connector/main.go @@ -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 diff --git a/connectormssql/connectormssql.go b/connectormssql/connectormssql.go index ae5352d..e4fd2b1 100644 --- a/connectormssql/connectormssql.go +++ b/connectormssql/connectormssql.go @@ -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 diff --git a/postgresql/main.go b/postgresql/main.go index 18dd740..dc3490c 100644 --- a/postgresql/main.go +++ b/postgresql/main.go @@ -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).", diff --git a/sqlexecutor/main.go b/sqlexecutor/main.go index 73a9cc0..38e7997 100644 --- a/sqlexecutor/main.go +++ b/sqlexecutor/main.go @@ -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).", diff --git a/sqlexecutor/sqlexecutor_basic.go b/sqlexecutor/sqlexecutor_basic.go index 8f253be..d7a9429 100644 --- a/sqlexecutor/sqlexecutor_basic.go +++ b/sqlexecutor/sqlexecutor_basic.go @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. @@ -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.