util

package
v0.0.0-...-ffc2279 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ServiceTypesFilename is the name of the service types file.
	ServiceTypesFilename = "service_types.yml"

	// IntegrationTypesFilename is the name of the integration types file.
	IntegrationTypesFilename = "integration_types.yml"

	// IntegrationEndpointTypesFilename is the name of the integration endpoint types file.
	IntegrationEndpointTypesFilename = "integration_endpoint_types.yml"
)
View Source
const EnvAivenProjectName = "AIVEN_PROJECT_NAME"

EnvAivenProjectName is the environment variable for the Aiven project name.

Variables

This section is empty.

Functions

func MeasureExecutionTime

func MeasureExecutionTime(logger *Logger) func()

MeasureExecutionTime prints the execution time of the caller when deferred.

func Min

func Min[T constraints.Ordered](a, b T) T

Min is a function that returns the minimum of two comparable values. It is advised to use this function instead of the built-in math.Min function if the values are not of type float64.

func Ref

func Ref[T any](v T) *T

Ref returns the reference (pointer) of the provided value.

func SetupClient

func SetupClient(client *aiven.Client) error

SetupClient sets up the Aiven client.

func SetupEnv

func SetupEnv(env EnvMap) error

SetupEnv populates the provided environment variables map.

func SetupLogger

func SetupLogger(logger *Logger)

SetupLogger sets up the logger.

Types

type EnvMap

type EnvMap map[string]string

EnvMap is a type for a map of environment variables.

type Logger

type Logger struct {
	// Info is the logger for info messages.
	Info *log.Logger

	// Error is the logger for error messages.
	Error *log.Logger
}

Logger is a struct that holds the loggers for the application.

Jump to

Keyboard shortcuts

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