cloudlib

package module
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 1 Imported by: 1

README

cloudlib

A "standard library" of go functions used to build portable cloud native apps

Documentation

Index

Constants

View Source
const (
	MsgMissingProvider         = "provider '%s' required"
	MsgUnsupportedProviderType = "unsupported provider type '%d'"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericProvider

type GenericProvider interface {
	Close() error
}

type InstanceProviderFunc

type InstanceProviderFunc func() interface{}

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...ProviderConfig) (*Provider, error)

New creates a new provider instance and configures it with provider implementations

func (*Provider) Close

func (p *Provider) Close() bool

Close iterates over all registered ProviderConfigs and asks them to 'close'

func (*Provider) Find

func (p *Provider) Find(providerType ProviderType) (interface{}, bool)

Find returns the registered provider instance if defined. The bool flag is set to true if there is a provider and false otherwise.

func (*Provider) RegisterProviders

func (p *Provider) RegisterProviders(ignoreExists bool, opts ...ProviderConfig) error

RegisterProviders registers one or more providers. An existing provider will be overwritten if ignoreExists is true, otherwise the function returns an error.

type ProviderConfig

type ProviderConfig struct {
	ID   string
	Type ProviderType
	Impl InstanceProviderFunc
}

func WithProvider

func WithProvider(ID string, providerType ProviderType, impl InstanceProviderFunc) ProviderConfig

WithProvider returns a populated ProviderConfig struct.

type ProviderType

type ProviderType int

Directories

Path Synopsis
Most of the code is lifted from https://github.com/googleapis/google-api-go-client/blob/main/internal/settings.go
Most of the code is lifted from https://github.com/googleapis/google-api-go-client/blob/main/internal/settings.go

Jump to

Keyboard shortcuts

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