Skip to content

Commit

Permalink
#227 Update examples (#228)
Browse files Browse the repository at this point in the history
* #227 Savepoint

* #227 Savepoint

* #227 Savepoint

* #227 Savepoint

* #227 Savepoint

* #227 Prepare for versioned release
  • Loading branch information
docktermj authored Jan 31, 2025
1 parent 7f16ad5 commit 00fc351
Show file tree
Hide file tree
Showing 12 changed files with 776 additions and 323 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ this action runs [golangci-lint] to run multiple linters against the code.
- [.golangci.yaml]
- Uses:
- [actions/checkout]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/setup-go]
- [golangci/golangci-lint-action]

Expand All @@ -85,7 +85,7 @@ this action runs `go test` with coverage testing on macOS.
- [actions/checkout]
- [actions/setup-go]
- [gotesttools/gotestfmt-action]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/upload-artifact]
- [senzing-factory/build-resources/.../go-coverage.yaml]

Expand All @@ -100,7 +100,7 @@ this action runs `go test` with coverage testing on Linux.
- [actions/checkout]
- [actions/setup-go]
- [gotesttools/gotestfmt-action]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/upload-artifact]
- [senzing-factory/build-resources/.../go-coverage.yaml]

Expand All @@ -115,7 +115,7 @@ this action runs `go test` with coverage testing on Windows.
- [actions/checkout]
- [actions/setup-go]
- [gotesttools/gotestfmt-action]
- [senzing-factory/github-action-install-senzing-api]
- [senzing-factory/github-action-install-senzing-sdk]
- [actions/upload-artifact]
- [senzing-factory/build-resources/.../go-coverage.yaml]

Expand Down Expand Up @@ -199,7 +199,7 @@ this action moves the PR on the "Garage" project board to "Done".
[senzing-factory/build-resources/.../make-go-github-file.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/make-go-github-file.yaml
[senzing-factory/build-resources/.../move-pr-to-done-dependabot.yaml]: https://github.com/senzing-factory/build-resources/blob/main/.github/workflows/move-pr-to-done-dependabot.yaml
[senzing-factory/github-action-docker-buildx-build]: https://github.com/senzing-factory/github-action-docker-buildx-build
[senzing-factory/github-action-install-senzing-api]: https://github.com/senzing-factory/github-action-install-senzing-api
[senzing-factory/github-action-install-senzing-sdk]: https://github.com/senzing-factory/github-action-install-senzing-sdk
[senzing-factory/github-action-make-go-tag]: https://github.com/senzing-factory/github-action-make-go-tag
[super-linter]: https://github.com/super-linter/super-linter
[testcoverage.yaml]: ../coverage/README.md#testcoverageyaml
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ and this project adheres to [Semantic Versioning].

-

## [0.8.6] - 2024-12-17
## [0.8.7] - 2025-01-31

### Changed in 0.8.7

- Update dependencies

## [0.8.6] - 2024-12-17

### Changed in 0.8.6

- Fixed `Reinitialize()`

## [0.8.5] - 2024-12-10
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ require (
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sys v0.28.0 // indirect
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c // indirect
golang.org/x/net v0.34.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 // indirect
google.golang.org/protobuf v1.36.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 // indirect
google.golang.org/protobuf v1.36.4 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiy
go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ=
go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM=
go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA=
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
golang.org/x/net v0.33.0 h1:74SYHlV8BIgHIFC/LrYkOGIwL19eTYXQ5wc6TBuO36I=
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c h1:KL/ZBHXgKGVmuZBZ01Lt57yE5ws8ZPSkkihmEyq7FXc=
golang.org/x/exp v0.0.0-20250128182459-e0ece0dbea4c/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU=
golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0=
golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k=
golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU=
golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 h1:Z7FRVJPSMaHQxD0uXU8WdgFh8PseLM8Q8NzhnpMrBhQ=
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287 h1:J1H9f+LEdWAfHcez/4cvaVBox7cOYT+IU6rgqj5x++8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20250127172529-29210b9bc287/go.mod h1:8BS3B93F/U1juMFq9+EDk+qOT5CO1R9IzXxG3PTqiRk=
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
google.golang.org/protobuf v1.36.0 h1:mjIs9gYtt56AzC4ZaffQuh88TZurBGhIJMBZGSxNerQ=
google.golang.org/protobuf v1.36.0/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM=
google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
Expand Down
57 changes: 38 additions & 19 deletions szabstractfactory/szabstractfactory_examples_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
//go:build linux

package szabstractfactory
package szabstractfactory_test

import (
"context"
"fmt"

"github.com/senzing-garage/sz-sdk-go-grpc/szabstractfactory"
"github.com/senzing-garage/sz-sdk-go/senzing"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)

var (
grpcAddress = "localhost:8261"
)

// ----------------------------------------------------------------------------
Expand All @@ -16,11 +23,11 @@ import (
func ExampleSzabstractfactory_CreateConfig() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-grpc/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szAbstractFactory := getSzAbstractFactory(ctx)
defer func() { handleError(szAbstractFactory.Destroy(ctx)) }()
szConfig, err := szAbstractFactory.CreateConfig(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
_ = szConfig // szConfig can now be used.
// Output:
Expand All @@ -29,11 +36,11 @@ func ExampleSzabstractfactory_CreateConfig() {
func ExampleSzabstractfactory_CreateConfigManager() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-grpc/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szAbstractFactory := getSzAbstractFactory(ctx)
defer func() { handleError(szAbstractFactory.Destroy(ctx)) }()
szConfigManager, err := szAbstractFactory.CreateConfigManager(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
_ = szConfigManager // szConfigManager can now be used.
// Output:
Expand All @@ -42,11 +49,11 @@ func ExampleSzabstractfactory_CreateConfigManager() {
func ExampleSzabstractfactory_CreateDiagnostic() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-grpc/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szAbstractFactory := getSzAbstractFactory(ctx)
defer func() { handleError(szAbstractFactory.Destroy(ctx)) }()
szDiagnostic, err := szAbstractFactory.CreateDiagnostic(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
_ = szDiagnostic // szDiagnostic can now be used.
// Output:
Expand All @@ -55,11 +62,11 @@ func ExampleSzabstractfactory_CreateDiagnostic() {
func ExampleSzabstractfactory_CreateEngine() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-grpc/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szAbstractFactory := getSzAbstractFactory(ctx)
defer func() { handleError(szAbstractFactory.Destroy(ctx)) }()
szEngine, err := szAbstractFactory.CreateEngine(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
_ = szEngine // szEngine can now be used.
// Output:
Expand All @@ -68,11 +75,11 @@ func ExampleSzabstractfactory_CreateEngine() {
func ExampleSzabstractfactory_CreateProduct() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-grpc/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szAbstractFactory := getSzAbstractFactory(ctx)
defer func() { handleError(szAbstractFactory.Destroy(ctx)) }()
szProduct, err := szAbstractFactory.CreateProduct(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
_ = szProduct // szProduct can now be used.
// Output:
Expand All @@ -81,30 +88,30 @@ func ExampleSzabstractfactory_CreateProduct() {
func ExampleSzabstractfactory_Destroy() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-grpc/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szAbstractFactory := getSzAbstractFactory(ctx)
err := szAbstractFactory.Destroy(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
// Output:
}

func ExampleSzabstractfactory_Reinitialize() {
// For more information, visit https://github.com/senzing-garage/sz-sdk-go-grpc/blob/main/szabstractfactory/szabstractfactory_examples_test.go
ctx := context.TODO()
szAbstractFactory := getSzAbstractFactoryExample(ctx)
szAbstractFactory := getSzAbstractFactory(ctx)
defer func() { handleError(szAbstractFactory.Destroy(ctx)) }()
szConfigManager, err := szAbstractFactory.CreateConfigManager(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
configID, err := szConfigManager.GetDefaultConfigID(ctx)
if err != nil {
fmt.Println(err)
handleError(err)
}
err = szAbstractFactory.Reinitialize(ctx, configID)
if err != nil {
fmt.Println(err)
handleError(err)
}
// Output:
}
Expand All @@ -113,10 +120,22 @@ func ExampleSzabstractfactory_Reinitialize() {
// Helper functions
// ----------------------------------------------------------------------------

func getSzAbstractFactoryExample(ctx context.Context) senzing.SzAbstractFactory {
result, err := getSzAbstractFactory(ctx)
func getSzAbstractFactory(ctx context.Context) senzing.SzAbstractFactory {
var err error
var result senzing.SzAbstractFactory
_ = ctx
grpcConnection, err := grpc.NewClient(grpcAddress, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
panic(err)
}
result = &szabstractfactory.Szabstractfactory{
GrpcConnection: grpcConnection,
}
return result
}

func handleError(err error) {
if err != nil {
fmt.Println("Error:", err)
}
}
4 changes: 4 additions & 0 deletions szabstractfactory/szabstractfactory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ func TestSzAbstractFactory_Reinitialize(test *testing.T) {
ctx := context.TODO()
szAbstractFactory := getTestObject(ctx, test)
defer func() { handleError(szAbstractFactory.Destroy(ctx)) }()
_, err := szAbstractFactory.CreateDiagnostic(ctx)
require.NoError(test, err)
_, err = szAbstractFactory.CreateEngine(ctx)
require.NoError(test, err)
szConfigManager, err := szAbstractFactory.CreateConfigManager(ctx)
require.NoError(test, err)
configID, err := szConfigManager.GetDefaultConfigID(ctx)
Expand Down
Loading

0 comments on commit 00fc351

Please sign in to comment.