Categorygithub.com/nuts-foundation/nuts-go-core
modulepackage
0.16.0
Repository: https://github.com/nuts-foundation/nuts-go-core.git
Documentation: pkg.go.dev

# README

nuts-go-core

Common resources for Nuts Go modules.

.. image:: https://circleci.com/gh/nuts-foundation/nuts-go-core.svg?style=svg :target: https://circleci.com/gh/nuts-foundation/nuts-go-core :alt: Build Status

.. image:: https://codecov.io/gh/nuts-foundation/nuts-go-core/branch/master/graph/badge.svg :target: https://codecov.io/gh/nuts-foundation/nuts-go-core

.. image:: https://api.codeclimate.com/v1/badges/641734b46b0950436e39/maintainability :target: https://codeclimate.com/github/nuts-foundation/nuts-go-core/maintainability :alt: Maintainability

Building

.. note::

Nuts-go uses Go version >= `1.13`.

.. code-block:: shell

go get github.com/nuts-foundation/nuts-go-core

For generating mocks

.. code-block:: shell

go get github.com/golang/mock/gomock go install github.com/golang/mock/mockgen

Then run

.. code-block:: shell

mockgen -destination=mock/mock_oapi.go -package=mock github.com/deepmap/oapi-codegen/pkg/runtime EchoRouter mockgen -destination=mock/mock_echo.go -package=mock github.com/labstack/echo/v4 Context

Testing

.. code-block:: shell

go test ./...

# Packages

No description provided by the author
Package mock is a generated GoMock package.

# Functions

DecodeURIPath is a echo middleware that decodes path parameters.
Errorf creates a new NutsEventError with given format and values.
NewError is a convenience method for creating a simple error.
NewLoggerEngine creates a new Engine for logging.
NewMetricsEngine creates a new Engine for exposing prometheus metrics via http.
NewNutsGlobalConfig creates a NutsGlobalConfig with the following defaults * Prefix: NUTS * Delimiter: '.' * IgnoredPrefixes: ["root","logging"].
NewPartyID creates a new PartyID.
NewStatusEngine creates a new Engine for viewing all engines.
NutsGlobalConfig returns a singleton global config.
ParsePartyID tries to parse the given input as URN-encoded OID (for example: urn:oid:1.2.3.4:foo).
RegisterEngine is a helper func to add an engine to the list of engines from a different lib/pkg.
StatusOK returns 200 OK with a "OK" body.
Wrap tries to identify the error and sets recoverable.

# Constants

ClientEngineMode is used for starting a node's engine in client mode.
GlobalCLIMode is used for starting the application in CLI mode, meaning it's used as CLI client administering for a remote Nuts node.
GlobalServerMode is used for starting the application in server mode, running as Nuts node.
NutsConsentClassesOID is the sub-OID used for consent classification.
No description provided by the author
NutsOID is the officially registered OID: http://oid-info.com/get/1.3.6.1.4.1.54851.
NutsVendorOID is the sub-OID used for vendor identifiers.
ServerEngineMode is used for starting a node's engine in server mode.

# Variables

No description provided by the author
ErrInvalidConfigTarget is an error used for invalid config target pointers.
ErrUnMutableConfigTarget is an error used when a struct member is accessible.

# Structs

Engine contains all the configuration options and callbacks needed by the executable to configure, start, monitor and shutdown the engines.
EngineCtl is the control structure where engines are registered.
GenericDiagnosticResult is a simple implementation of the DiagnosticResult interface.
NutsEventError is the main implementation adding a recoverable field to an error.
NutsGlobalConfig has the settings which influence all other settings.
PartyID is a data type uniquely identifying a party in the Nuts Network.

# Interfaces

DiagnosticResult are the result of different checks giving information on how well the system is doing.
EchoRouter is the interface the generated server API's will require as the Routes func argument.
Error is the interface that extends the default error interface.
NutsConfigValues exposes global configuration values.