Skip to content

Commit

Permalink
126.dockter.3 (#144)
Browse files Browse the repository at this point in the history
* #126 move szinterface to sz

* #126 Rename SzConfig methods

* #126 Rename SzConfig methods

* #126 Update dependencies

* #126 Delete obsolete code

* #126 Update SzAbstractFactory

* #126 Remove non-senzing API method signatures

* #126 Refactor to sorted order

* #126 Update workflows

* #126 Modify szabstractfactory method names

* #126 Remove ReplaceRecord()

* #126 Normalize DataSource capitalization

* #126 Updated szerror

* #126 Prepare for versioned release

* #126 Prepare for versioned release
  • Loading branch information
docktermj authored Apr 19, 2024
1 parent 84379cd commit 49198ed
Show file tree
Hide file tree
Showing 15 changed files with 74 additions and 179 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gosec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
uses: actions/checkout@v4

- name: run Gosec Security Scanner
uses: securego/gosec@master
uses: securego/gosec@v2.19.0
with:
args: ./...
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

-

## [0.12.0] - 2024-04-19

### Changed in 0.12.0

- Updated to Senzing V4 method signatures
- Updated dependencies

## [0.11.1] - 2024-04-02

### Changed in 0.11.1
Expand Down
19 changes: 0 additions & 19 deletions bin/response-testcases.json
Original file line number Diff line number Diff line change
Expand Up @@ -44509,25 +44509,6 @@
}
}
},
"SzEngineReplaceRecordResponse": {
"tests": {
"test-001": {
"AFFECTED_ENTITIES": [
{
"ENTITY_ID": 1
},
{
"ENTITY_ID": 1
}
],
"DATA_SOURCE": "blank",
"INTERESTING_ENTITIES": {
"ENTITIES": []
},
"RECORD_ID": "blank"
}
}
},
"SzEngineSearchByAttributesResponse": {
"tests": {
"test-001": {
Expand Down
11 changes: 3 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,15 @@ go 1.21

require (
github.com/aquilax/truncate v1.0.0
github.com/senzing-garage/go-observing v0.3.0
github.com/senzing-garage/sz-sdk-json-type-definition v0.2.4
github.com/stretchr/testify v1.9.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
33 changes: 14 additions & 19 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,32 +1,27 @@
github.com/aquilax/truncate v1.0.0 h1:UgIGS8U/aZ4JyOJ2h3xcF5cSQ06+gGBnjxH2RUHJe0U=
github.com/aquilax/truncate v1.0.0/go.mod h1:BeMESIDMlvlS3bmg4BVvBbbZUNwWtS8uzYPAKXwwhLw=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/senzing-garage/go-observing v0.3.0 h1:uWKZtiW4dwQJx8i7Y+7QrdrBJ8NPSOTZu2+6q0gy1DI=
github.com/senzing-garage/go-observing v0.3.0/go.mod h1:Bxl4c7G9hQ8iqSxZp/omolUhmkEdrbCzLt0s0VkPdnw=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/senzing-garage/sz-sdk-json-type-definition v0.2.4 h1:mM3yu8Ntbupl92I78Z1VzOMguL7/4oI/0LmfB8pLifM=
github.com/senzing-garage/sz-sdk-json-type-definition v0.2.4/go.mod h1:UlKL1vflvcE8rNOpbptlNiw57SixFAUWk5ftu5gHL9Y=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY=
google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk=
google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
29 changes: 1 addition & 28 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,4 @@
*/
package main

func main() {
// ctx := context.TODO()

// Create a Subject.

// mySenzing := &senzing.SenzingImpl{
// GrpcDialOptions: []grpc.DialOption{},
// GrpcTarget: "",
// ObserverOrigin: "",
// Observers: []observer.Observer{},
// }

// G2 style.

// g2Engine := mySenzing.GetG2Engine(ctx)
// jsonString := ``
// result, err := g2Engine.AddRecord(jsonString)

// Senzing style.

// engine := mySenzing.GetEngine(ctx)
// engineAddRecordRequest := &senzing.EngineAddRecordRequest{} // Uses existing import of senzing
// engineAddRecordRequest := &engine.AddRecordRequest{} // Requires an import of senzing/engine

// engineAddRecordResponse, err := engine.AddRecord(engineAddRecordRequest)
// x := engineAddRecordResponse.Bob

}
func main() {}
6 changes: 0 additions & 6 deletions senzing/unmarshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,6 @@ func UnmarshalSzEngineReevaluateRecordResponse(ctx context.Context, jsonString s
return result, err
}

func UnmarshalSzEngineReplaceRecordResponse(ctx context.Context, jsonString string) (*typedef.SzEngineReplaceRecordResponse, error) {
result := &typedef.SzEngineReplaceRecordResponse{}
err := json.Unmarshal([]byte(jsonString), result)
return result, err
}

func UnmarshalSzEngineSearchByAttributesResponse(ctx context.Context, jsonString string) (*typedef.SzEngineSearchByAttributesResponse, error) {
result := &typedef.SzEngineSearchByAttributesResponse{}
err := json.Unmarshal([]byte(jsonString), result)
Expand Down
9 changes: 1 addition & 8 deletions senzing/unmarshal_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// DO NOT EDIT. This code is generated.
// Generated by: sz-sdk-go/bin/generate_senzing_unmarshal_test.py
// Generated for: sz-sdk-go/senzing/unmarshal_test.go
// Generated date: 2024-04-02T15:02:30.657781+00:00
// Generated date: 2024-04-17T20:16:34.055460+00:00

package senzing

Expand Down Expand Up @@ -1099,13 +1099,6 @@ func TestSzEngineReevaluateRecordResponseTest001(test *testing.T) {
testError(test, ctx, err)
printActual(test, result)
}
func TestSzEngineReplaceRecordResponseTest001(test *testing.T) {
ctx := context.TODO()
jsonString := `{"AFFECTED_ENTITIES":[{"ENTITY_ID":1},{"ENTITY_ID":1}],"DATA_SOURCE":"blank","INTERESTING_ENTITIES":{"ENTITIES":[]},"RECORD_ID":"blank"}`
result, err := UnmarshalSzEngineReplaceRecordResponse(ctx, jsonString)
testError(test, ctx, err)
printActual(test, result)
}
func TestSzEngineSearchByAttributesResponseTest001(test *testing.T) {
ctx := context.TODO()
jsonString := `{"RESOLVED_ENTITIES":[],"SEARCH_STATISTICS":[{"CANDIDATE_KEYS":{"FEATURE_TYPES":[{"FOUND":1,"FTYPE_CODE":"blank","GENERIC":1,"NOT_FOUND":1},{"FOUND":1,"FTYPE_CODE":"blank","GENERIC":1,"NOT_FOUND":1},{"FOUND":1,"FTYPE_CODE":"blank","GENERIC":1,"NOT_FOUND":1}],"SUMMARY":{"FOUND":1,"GENERIC":1,"NOT_FOUND":1}}}]}`
Expand Down
2 changes: 1 addition & 1 deletion szinterface/flags.go → sz/flags.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package szinterface
package sz

// ----------------------------------------------------------------------------
// Constants
Expand Down
67 changes: 14 additions & 53 deletions szinterface/main.go → sz/main.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package szinterface
package sz

import (
"context"

"github.com/senzing-garage/go-observing/observer"
)

// ----------------------------------------------------------------------------
Expand All @@ -20,23 +18,25 @@ type StringFragment struct {
// Types - interface
// ----------------------------------------------------------------------------

// The SzAbstractFactory interface is the interface for all Senzing factories in the Abstract Factory pattern
type SzAbstractFactory interface {
CreateSzConfig(ctx context.Context) (SzConfig, error)
CreateSzConfigManager(ctx context.Context) (SzConfigManager, error)
CreateSzDiagnostic(ctx context.Context) (SzDiagnostic, error)
CreateSzEngine(ctx context.Context) (SzEngine, error)
CreateSzProduct(ctx context.Context) (SzProduct, error)
}

// The SzConfig interface is a Golang representation of Senzing's libg2config.h
type SzConfig interface {
AddDataSource(ctx context.Context, configHandle uintptr, dataSourceCode string) (string, error)
Close(ctx context.Context, configHandle uintptr) error
Create(ctx context.Context) (uintptr, error)
CloseConfig(ctx context.Context, configHandle uintptr) error
CreateConfig(ctx context.Context) (uintptr, error)
DeleteDataSource(ctx context.Context, configHandle uintptr, dataSourceCode string) error
Destroy(ctx context.Context) error
ExportConfig(ctx context.Context, configHandle uintptr) (string, error)
GetDataSources(ctx context.Context, configHandle uintptr) (string, error)
GetJsonString(ctx context.Context, configHandle uintptr) (string, error)
GetObserverOrigin(ctx context.Context) string
GetSdkId(ctx context.Context) string
Initialize(ctx context.Context, instanceName string, settings string, verboseLogging int64) error
Load(ctx context.Context, configDefinition string) (uintptr, error)
RegisterObserver(ctx context.Context, observer observer.Observer) error
SetLogLevel(ctx context.Context, logLevelName string) error
SetObserverOrigin(ctx context.Context, origin string)
UnregisterObserver(ctx context.Context, observer observer.Observer) error
ImportConfig(ctx context.Context, configDefinition string) (uintptr, error)
}

// The SzConfigManager interface is a Golang representation of Senzing's libg2configmgr.h
Expand All @@ -46,30 +46,16 @@ type SzConfigManager interface {
GetConfig(ctx context.Context, configId int64) (string, error)
GetConfigList(ctx context.Context) (string, error)
GetDefaultConfigId(ctx context.Context) (int64, error)
GetObserverOrigin(ctx context.Context) string
GetSdkId(ctx context.Context) string
Initialize(ctx context.Context, instanceName string, settings string, verboseLogging int64) error
RegisterObserver(ctx context.Context, observer observer.Observer) error
ReplaceDefaultConfigId(ctx context.Context, currentDefaultConfigId int64, newDefaultConfigId int64) error
SetDefaultConfigId(ctx context.Context, configId int64) error
SetLogLevel(ctx context.Context, logLevelName string) error
SetObserverOrigin(ctx context.Context, origin string)
UnregisterObserver(ctx context.Context, observer observer.Observer) error
}

// The SzDiagnostic interface is a Golang representation of Senzing's libg2diagnostic.h
type SzDiagnostic interface {
CheckDatabasePerformance(ctx context.Context, secondsToRun int) (string, error)
Destroy(ctx context.Context) error
GetObserverOrigin(ctx context.Context) string
GetSdkId(ctx context.Context) string
Initialize(ctx context.Context, instanceName string, settings string, verboseLogging int64, configId int64) error
PurgeRepository(ctx context.Context) error
RegisterObserver(ctx context.Context, observer observer.Observer) error
Reinitialize(ctx context.Context, configId int64) error
SetLogLevel(ctx context.Context, logLevelName string) error
SetObserverOrigin(ctx context.Context, origin string)
UnregisterObserver(ctx context.Context, observer observer.Observer) error
}

// The SzEngine interface is a Golang representation of Senzing's libg2.h
Expand All @@ -91,51 +77,26 @@ type SzEngine interface {
GetActiveConfigId(ctx context.Context) (int64, error)
GetEntityByEntityId(ctx context.Context, entityId int64, flags int64) (string, error)
GetEntityByRecordId(ctx context.Context, dataSourceCode string, recordId string, flags int64) (string, error)
GetObserverOrigin(ctx context.Context) string
GetRecord(ctx context.Context, dataSourceCode string, recordId string, flags int64) (string, error)
GetRedoRecord(ctx context.Context) (string, error)
GetRepositoryLastModifiedTime(ctx context.Context) (int64, error)
GetSdkId(ctx context.Context) string
GetStats(ctx context.Context) (string, error)
GetVirtualEntityByRecordId(ctx context.Context, recordList string, flags int64) (string, error)
HowEntityByEntityId(ctx context.Context, entityId int64, flags int64) (string, error)
Initialize(ctx context.Context, instanceName string, settings string, verboseLogging int64, configId int64) error
PrimeEngine(ctx context.Context) error
ProcessRedoRecord(ctx context.Context, redoRecord string, flags int64) (string, error)
ReevaluateEntity(ctx context.Context, entityId int64, flags int64) (string, error)
ReevaluateRecord(ctx context.Context, dataSourceCode string, recordId string, flags int64) (string, error)
RegisterObserver(ctx context.Context, observer observer.Observer) error
Reinitialize(ctx context.Context, configId int64) error
ReplaceRecord(ctx context.Context, dataSourceCode string, recordId string, recordDefinition string, flags int64) (string, error)
SearchByAttributes(ctx context.Context, attributes string, searchProfile string, flags int64) (string, error)
SetLogLevel(ctx context.Context, logLevelName string) error
SetObserverOrigin(ctx context.Context, origin string)
UnregisterObserver(ctx context.Context, observer observer.Observer) error
WhyEntities(ctx context.Context, entityId1 int64, entityId2 int64, flags int64) (string, error)
WhyRecordInEntity(ctx context.Context, dataSourceCode string, recordId string, flags int64) (string, error)
WhyRecords(ctx context.Context, dataSourceCode1 string, recordId1 string, dataSourceCode2 string, recordId2 string, flags int64) (string, error)
}

// The SzAbstractFactory interface is the interface for all Senzing factories in the Abstract Factory pattern
type SzAbstractFactory interface {
Close(ctx context.Context) error
CreateConfig(ctx context.Context) (SzConfig, error)
CreateConfigMgr(ctx context.Context) (SzConfigManager, error)
CreateDiagnostic(ctx context.Context) (SzDiagnostic, error)
CreateEngine(ctx context.Context) (SzEngine, error)
CreateProduct(ctx context.Context) (SzProduct, error)
}

// The SzProduct interface is a Golang representation of Senzing's libg2product.h
type SzProduct interface {
Destroy(ctx context.Context) error
GetLicense(ctx context.Context) (string, error)
GetObserverOrigin(ctx context.Context) string
GetSdkId(ctx context.Context) string
GetVersion(ctx context.Context) (string, error)
Initialize(ctx context.Context, instanceName string, settings string, verboseLogging int64) error
RegisterObserver(ctx context.Context, observer observer.Observer) error
SetLogLevel(ctx context.Context, logLevelName string) error
SetObserverOrigin(ctx context.Context, origin string)
UnregisterObserver(ctx context.Context, observer observer.Observer) error
}
4 changes: 3 additions & 1 deletion szinterface/parameters.go → sz/parameters.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package szinterface
package sz

// ----------------------------------------------------------------------------
// Constants
Expand All @@ -8,7 +8,9 @@ const (
SZ_INITIALIZE_WITH_DEFAULT_CONFIGURATION int64 = 0
SZ_NO_ATTRIBUTES string = ""
SZ_NO_EXCLUSIONS string = ""
SZ_NO_LOGGING int64 = 0
SZ_NO_REQUIRED_DATASOURCES string = ""
SZ_NO_SEARCH_PROFILE string = ""
SZ_VERBOSE_LOGGING int64 = 1
SZ_WITHOUT_INFO int64 = 0
)
2 changes: 1 addition & 1 deletion szinterface/szapi_test.go → sz/sz_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package szinterface
package sz

import (
"testing"
Expand Down
Loading

0 comments on commit 49198ed

Please sign in to comment.