Skip to content

Commit

Permalink
#242 Prepare for versioned release
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj committed Oct 1, 2024
1 parent 03ef2f3 commit 8cd00b3
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ and this project adheres to [Semantic Versioning].

-

## [0.8.3] - 2024-10-01

### Changed in 0.8.3

- Update dependencies

## [0.8.2] - 2024-09-11

### Changed in 0.8.2
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/senzing-garage/go-logging v1.5.1
github.com/senzing-garage/go-messaging v1.5.2
github.com/senzing-garage/go-observing v0.3.3
github.com/senzing-garage/sz-sdk-go v0.14.1
github.com/senzing-garage/sz-sdk-go v0.14.2
github.com/stretchr/testify v1.9.0
)

Expand All @@ -22,8 +22,8 @@ require (
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.66.1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f // indirect
google.golang.org/grpc v1.67.1 // indirect
google.golang.org/protobuf v1.34.2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
12 changes: 6 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ github.com/senzing-garage/go-messaging v1.5.2 h1:lU9W2HV3zKQsDU9Vs7lwe/C/LbHVCMn
github.com/senzing-garage/go-messaging v1.5.2/go.mod h1:iEWGVuDGWjolIkwLqnn9oJS7ifF3aoZjTtI44tf1gWQ=
github.com/senzing-garage/go-observing v0.3.3 h1:AhQYgOG012sDZtWXYcXVAaS5qEoDjlWmPYJDVCUZ/g0=
github.com/senzing-garage/go-observing v0.3.3/go.mod h1:qFUi5Dwb6vmd7izTZGjGbWKUGRHzWzsgbsX3oNSD198=
github.com/senzing-garage/sz-sdk-go v0.14.1 h1:bJOOHROg/SMEZ8KhCypVMr7scMzCuSpDpcMR9e4gzsA=
github.com/senzing-garage/sz-sdk-go v0.14.1/go.mod h1:9Kvr/NpNoU1DSKpVXmZ+91/WFMKvXmjuubFhAiS69Ts=
github.com/senzing-garage/sz-sdk-go v0.14.2 h1:1LksQW0+epSY0DhlxThxrnfeDwgyLPvyqG9NehZmz04=
github.com/senzing-garage/sz-sdk-go v0.14.2/go.mod h1:rj9HH6qo+kW5PsFSRnEIUQqDZBE34gZjQGsDvAxw6dI=
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/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk=
Expand All @@ -33,10 +33,10 @@ golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/grpc v1.66.1 h1:hO5qAXR19+/Z44hmvIM4dQFMSYX9XcWsByfoxutBpAM=
google.golang.org/grpc v1.66.1/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f h1:cUMEy+8oS78BWIH9OWazBkzbr090Od9tWBNtZHkOhf0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240930140551-af27646dc61f/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU=
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
58 changes: 58 additions & 0 deletions szengine/szengine.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,37 @@ func (client *Szengine) HowEntityByEntityID(ctx context.Context, entityID int64,
return result, err
}

/*
Method PreprocessRecord tests adding a record into the Senzing datastore.
Input
- ctx: A context to control lifecycle.
- recordDefinition: A JSON document containing the record to be tested against the Senzing datastore.
- flags: Flags used to control information returned.
Output
- A JSON document containing metadata as specified by the flags.
*/
func (client *Szengine) PreprocessRecord(ctx context.Context, recordDefinition string, flags int64) (string, error) {
var err error
var result string
if client.isTrace {
entryTime := time.Now()
client.traceEntry(77, recordDefinition, flags)
defer func() {
client.traceExit(78, recordDefinition, flags, result, err, time.Since(entryTime))
}()
}
result, err = client.preprocessRecord(ctx, recordDefinition, flags)
if client.observers != nil {
go func() {
details := map[string]string{}
notifier.Notify(ctx, client.observers, client.observerOrigin, ComponentID, 8035, err, details)
}()
}
return result, err
}

/*
Method PrimeEngine pre-initializes some of the heavier weight internal resources of the Senzing engine.
Expand Down Expand Up @@ -2121,6 +2152,33 @@ func (client *Szengine) primeEngine(ctx context.Context) error {
return err
}

/*
Method preprocessRecord tests adding a record into the Senzing datastore and returns information on the affected entities.
Input
- ctx: A context to control lifecycle.
- recordDefinition: A JSON document containing the record to be added to the Senzing datastore.
- flags: Flags used to control information returned.
Output
- A JSON document.
*/
func (client *Szengine) preprocessRecord(ctx context.Context, recordDefinition string, flags int64) (string, error) {
runtime.LockOSThread()
defer runtime.UnlockOSThread()
var err error
var resultResponse string
recordDefinitionForC := C.CString(recordDefinition)
defer C.free(unsafe.Pointer(recordDefinitionForC))
result := C.Sz_preprocessRecord_helper(recordDefinitionForC, C.longlong(flags))
if result.returnCode != noError {
err = client.newError(ctx, 4061, recordDefinition, flags, result.returnCode)
}
resultResponse = C.GoString(result.response)
C.SzHelper_free(unsafe.Pointer(result.response))
return resultResponse, err
}

/*
Method processRedoRecord processes given redo record.
Calling processRedoRecord() has the potential to create more redo records in certain situations.
Expand Down
14 changes: 14 additions & 0 deletions szengine/szengine_examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,20 @@ func ExampleSzengine_HowEntityByEntityID() {
// Output: {"HOW_RESULTS":{"FINAL_STATE":{"NEED_REEVALUATION":0,"VIRTUAL_ENTITIES":[{"MEMBER_RECORDS":[{"INTERNAL_ID":100001,"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":null}]},{"INTERNAL_ID":100002,"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":null}]}],"VIRTUAL_ENTITY_ID":"V100001-S1"}]},"RESOLUTION_STEPS":[{"INBOUND_VIRTUAL_ENTITY_ID":"V100002","MATCH_INFO":{"ERRULE_CODE":"CNAME_CFF_CEXCL","MATCH_KEY":"+NAME+DOB+PHONE"},"RESULT_VIRTUAL_ENTITY_ID":"V100001-S1","STEP":1,"VIRTUAL_ENTITY_1":{"MEMBER_RECORDS":[{"INTERNAL_ID":100001,"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":null}]}],"VIRTUAL_ENTITY_ID":"V100001"},"VIRTUAL_ENTITY_2":{"MEMBER_RECORDS":[{"INTERNAL_ID":100002,"RECORDS":[{"DATA_SOURCE":"CUSTOMERS","RECORD_ID":null}]}],"VIRTUAL_ENTITY_ID":"V100002"}}]}}
}

func ExampleSzengine_PreprocessRecord() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-core/blob/main/szengine/szengine_examples_test.go
ctx := context.TODO()
szEngine := getSzEngineExample(ctx)
recordDefinition := `{"DATA_SOURCE": "CUSTOMERS", "RECORD_ID": "1001", "RECORD_TYPE": "PERSON", "PRIMARY_NAME_LAST": "Smith", "PRIMARY_NAME_FIRST": "Robert", "DATE_OF_BIRTH": "12/11/1978", "ADDR_TYPE": "MAILING", "ADDR_LINE1": "123 Main Street, Las Vegas NV 89132", "PHONE_TYPE": "HOME", "PHONE_NUMBER": "702-919-1300", "EMAIL_ADDRESS": "[email protected]", "DATE": "1/2/18", "STATUS": "Active", "AMOUNT": "100"}`
flags := senzing.SzWithoutInfo
result, err := szEngine.PreprocessRecord(ctx, recordDefinition, flags)
if err != nil {
fmt.Println(err)
}
fmt.Println(result)
// Output: {}
}

func ExampleSzengine_PrimeEngine() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-core/blob/main/szengine/szengine_examples_test.go
ctx := context.TODO()
Expand Down
24 changes: 24 additions & 0 deletions szengine/szengine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1947,6 +1947,30 @@ func TestSzengine_HowEntityByEntityID_nilEntityID(test *testing.T) {
printActual(test, actual)
}

func TestSzengine_PreprocessRecord(test *testing.T) {
ctx := context.TODO()
szEngine := getTestObject(ctx, test)
flags := senzing.SzWithoutInfo
records := []record.Record{
truthset.CustomerRecords["1001"],
truthset.CustomerRecords["1002"],
}
for _, record := range records {
actual, err := szEngine.PreprocessRecord(ctx, record.JSON, flags)
require.NoError(test, err)
printActual(test, actual)
}
}

func TestSzengine_PreprocessRecord_badRecordDefinition(test *testing.T) {
ctx := context.TODO()
szEngine := getTestObject(ctx, test)
flags := senzing.SzWithoutInfo
actual, err := szEngine.PreprocessRecord(ctx, badRecordDefinition, flags)
require.NoError(test, err)
printActual(test, actual)
}

func TestSzengine_PrimeEngine(test *testing.T) {
ctx := context.TODO()
szEngine := getTestObject(ctx, test)
Expand Down

0 comments on commit 8cd00b3

Please sign in to comment.