custom_store

command
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 17, 2022 License: MIT Imports: 14 Imported by: 0

README

Custom Store Example

This example is shows the Connector in operation. The only dependency required for this example is a running PostgreSQL instance. You can easily set one up by running:

docker run --name pg -p 5432:5432 -e POSTGRES_PASSWORD=postgres -d postgres

Once the database is ready, you can run the example:

go run main.go

Creating a custom store and integrating it is very simple. See store.go in this directory for an example and main.go for how it would be used.

Stores must implement the driver.Store interface.

type Store interface {
    Get() (driver.Credentials, error)
    Refresh() (driver.Credentials, error)
}

The distinction between Get() and Refresh() is one that allows caching or other early retry mechanism before a more complex operation is done. An example of this would be if you had a token-based auth to a system that held credentials, you might want to use the token you have to try to get the creds via the Get() method. If, however, the token had expired or otherwise been invalidated, you may want to go through a more complex and lengthy process of renewing the token and then retrieving credentials by using Refresh().

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL