extdeps

package
v0.0.0-...-c05d2c9 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExtServices

type ExtServices struct {
	MailSender mailer.Mailer
	SQL        db.SQLDB
	Composer   notifications.Composer
	Ins        *obs.Insighter
}

ExtServices holds thread-safe instances to make use of external services.

func (*ExtServices) Clone

func (ed *ExtServices) Clone() *ExtServices

Clone creates a shallow copy of the external services, except for the insighter one, that will execute a clone.

type ExternalServicesBuilder

type ExternalServicesBuilder struct {
	MailSender mailer.Mailer
	SQL        db.SQLDB
	Composer   notifications.Composer
	// contains filtered or unexported fields
}

ExternalServicesBuilder holds references to services that could be needed to perform any operation and that must be configured at startup time, like and email sender, a sql db ...

func GetNopExternalServices

func GetNopExternalServices() *ExternalServicesBuilder

GetNopExternalServices creates No Op services: a mailer that does not sends emails, a notifier that does not send notifications, and an insighter that does not log, send metrics or traces. Useful for testing.

func NewExternalServicesBuilder

func NewExternalServicesBuilder(
	insighterBuilderFn obs.InsighterBuilderFn,
	insighterFlushFn func(),
	mailSender mailer.Mailer,
	sql db.SQLDB,
	composer notifications.Composer) *ExternalServicesBuilder

NewExternalServicesBuilder creates a new ExternalServices instance

func (*ExternalServicesBuilder) ExtServices

func (es *ExternalServicesBuilder) ExtServices() *ExtServices

ExtServices returns a new ExtServices to be used

func (*ExternalServicesBuilder) Insighter

func (es *ExternalServicesBuilder) Insighter() *obs.Insighter

Insighter returns an Insighter instance

func (*ExternalServicesBuilder) Shutdown

func (es *ExternalServicesBuilder) Shutdown()

Shutdown all the service references inside the ExternalServices

type ExternalServicesBuilderFn

type ExternalServicesBuilderFn func() *ExternalServicesBuilder

ExternalServicesBuilderFn defines the signature for building a ExternalServices. Usually used to create new instances for each served request

Jump to

Keyboard shortcuts

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