Skip to content

Commit

Permalink
#186 Update documentation - 1
Browse files Browse the repository at this point in the history
  • Loading branch information
docktermj committed Aug 23, 2024
1 parent ae7eb4d commit 1184d47
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 4 deletions.
7 changes: 7 additions & 0 deletions doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Module szabstractfactory implements convenience methods for creating Senzing abstract factories.
The [Abstract Factory Pattern] ensures common settings across all created objects.
[Abstract Factory Pattern]: https://en.wikipedia.org/wiki/Abstract_factory_pattern
*/
package main
2 changes: 1 addition & 1 deletion docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ Create a code coverage map.

1. If a web page doesn't appear, visit [localhost:6060].
1. Senzing documentation will be in the "Third party" section.
`github.com` > `senzing-garage` > `template-go`
`github.com` > `senzing-garage` > `go-sdk-abstract-factory`

1. When a versioned release is published with a `v0.0.0` format tag,
the reference can be found by clicking on the following badge at the top of the README.md page.
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/senzing-garage/sz-sdk-go v0.14.0
github.com/senzing-garage/sz-sdk-go-core v0.8.0
github.com/senzing-garage/sz-sdk-go-grpc v0.8.0
github.com/senzing-garage/sz-sdk-go-mock v0.8.0
github.com/stretchr/testify v1.9.0
google.golang.org/grpc v1.65.0
)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ github.com/senzing-garage/sz-sdk-go-core v0.8.0 h1:cUvAZ82ZedmxAwK1TOXwZPvBEqQrX
github.com/senzing-garage/sz-sdk-go-core v0.8.0/go.mod h1:b2bLdApK/a03UrK0PMWCXAnjG1gHZ1Zkf73qGB7wTxk=
github.com/senzing-garage/sz-sdk-go-grpc v0.8.0 h1:bHAmYQkdH4gLHVBbcaRqWBBDRBciUnBnmUpP9Y9lwqg=
github.com/senzing-garage/sz-sdk-go-grpc v0.8.0/go.mod h1:+LmOdW6RnweJRAv/jm/OH9YUXSRtQC5uqerVn8eXTAk=
github.com/senzing-garage/sz-sdk-go-mock v0.8.0 h1:ucDEaJ9Qli2YO5dOFlrM5n1uR9+WF6Xdrmu7HOv3Pjg=
github.com/senzing-garage/sz-sdk-go-mock v0.8.0/go.mod h1:W9xAwNEq7DIc5pUYcTg2vRkGwnKluqtQC8uHejU53Yk=
github.com/senzing-garage/sz-sdk-proto v0.7.6 h1:mHiZr094UTBcRW1OkNam1Pu/pMLZRO/4cIIyjQ/yDlY=
github.com/senzing-garage/sz-sdk-proto v0.7.6/go.mod h1:7CZSZ5yEVmT2T0yiijjdq7dWsdQ/KtRgvKRqCy+j7SI=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
Expand Down
3 changes: 1 addition & 2 deletions szfactorycreator/doc.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/*
TODO: Write description for szfactorycreator
The szfactorycreator package...
Package szfactorycreator implements CreateXxxxAbstractFactory functions.
*/
package szfactorycreator
47 changes: 46 additions & 1 deletion szfactorycreator/main.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
Supported abstract factories:
- [szabstractfactorycore.Szabstractfactory]
- [szabstractfactorygrpc.Szabstractfactory]
- [szabstractfactorymock.Szabstractfactory]
*/
package szfactorycreator

import (
szabstractfactorycore "github.com/senzing-garage/sz-sdk-go-core/szabstractfactory"
szabstractfactorygrpc "github.com/senzing-garage/sz-sdk-go-grpc/szabstractfactory"
szabstractfactorymock "github.com/senzing-garage/sz-sdk-go-mock/szabstractfactory"

"google.golang.org/grpc"

"github.com/senzing-garage/sz-sdk-go/senzing"
Expand All @@ -19,6 +27,20 @@ const ComponentID = 6041
// Factory builders
// ----------------------------------------------------------------------------

/*
Function CreateCoreAbstractFactory returns a Senzing Abstract Factory
that is used to create Senzing objects
which run natively.
Input
- instanceName: A name for the auditing node, to help identify it within system logs.
- settings: A JSON string containing configuration parameters.
- verboseLogging: A flag to enable deeper logging of the Sz processing. 0 for no Senzing logging; 1 for logging.
- configID: The configuration ID used for the initialization. 0 for current default configuration.
Output
- A [szabstractfactorycore.Szabstractfactory] implementation conforming to the [senzing.SzAbstractFactory] interface.
*/
func CreateCoreAbstractFactory(instanceName string, settings string, verboseLogging int64, configID int64) (senzing.SzAbstractFactory, error) {
szAbstractFactory := &szabstractfactorycore.Szabstractfactory{
ConfigID: configID,
Expand All @@ -29,13 +51,36 @@ func CreateCoreAbstractFactory(instanceName string, settings string, verboseLogg
return szAbstractFactory, nil
}

/*
Function CreateGrpcAbstractFactory returns a Senzing Abstract Factory
that is used to create Senzing objects
which communicate with a [Senzing gRPC server].
Input
- grpcConnection: A connection to a Senzing gRPC server.
Output
- A [szabstractfactorygrpc.Szabstractfactory] implementation conforming to the [senzing.SzAbstractFactory] interface.
[Senzing gRPC server]: https://github.com/senzing-garage/serve-grpc
*/
func CreateGrpcAbstractFactory(grpcConnection *grpc.ClientConn) (senzing.SzAbstractFactory, error) {
szAbstractFactory := &szabstractfactorygrpc.Szabstractfactory{
GrpcConnection: grpcConnection,
}
return szAbstractFactory, nil
}

/*
Function CreateMockAbstractFactory returns a Senzing Abstract Factory
that is used to create Senzing [mock objects].
Output
- A [szabstractfactorymock.Szabstractfactory] implementation conforming to the [senzing.SzAbstractFactory] interface.
[mock objects]: https://en.wikipedia.org/wiki/Mock_object
*/
func CreateMockAbstractFactory() (senzing.SzAbstractFactory, error) {
return nil, nil
szAbstractFactory := &szabstractfactorymock.Szabstractfactory{}
return szAbstractFactory, nil
}

0 comments on commit 1184d47

Please sign in to comment.