utils

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2023 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWorkerToPool added in v1.1.0

func AddWorkerToPool(workerPool chan types.Worker, worker types.Worker)

AddWorkerToPool is a function that adds a worker to a pool of workers.

func CreateEmptyPool added in v1.1.0

func CreateEmptyPool(poolSize int) chan types.Worker

CreateEmptyPool is a function that creates a pool of workers. poolSize is the concurrency limiting factor. The returned channel is NOT populated with workers.

func CreatePupulatedPool added in v1.1.0

func CreatePupulatedPool(poolSize int) chan types.Worker

CreatePopulatedPool is a function that creates a pool of workers and populates it with the specified number of workers. poolSize is the concurrency limiting factor. The returned channel IS populated with workers.

func GetComponent

func GetComponent() string

GetComponent returns details about the caller function. It is utilized to populate the component field of a GoogleLogEntry, or any other log entry component field.

func GetFirebaseIDToken

func GetFirebaseIDToken(email, password, firebaseAPIKey string) (string, error)

GetFirebaseIDToken exchanges an email and password for a Firebase ID token. The email and password are used to authenticate with Firebase. The Firebase ID token is returned. If the request fails, an error is returned.

func GetSecretValue added in v1.0.8

func GetSecretValue(FS embed.FS, credentialsPath string, projectID string, secretID string, versionID string) ([]byte, error)

GetSecretValue is a function to retrieve a secret value from Google Cloud Secret Manager. FS is the embed.FS embedded filesystem to pass to the function. The credentialsPath parameter is the path to the credentials file. The projectID parameter is the ID of the Google Cloud project. The secretID parameter is the ID of the secret. The versionID parameter is the ID of the secret version. The secret value is returned as a byte slice.

func GetWorkerFromPool added in v1.1.0

func GetWorkerFromPool(workerPool chan types.Worker) types.Worker

GetWorkerFromPool is a function that gets a worker from a pool of workers.

func GetWorkerPoolCapacity added in v1.1.0

func GetWorkerPoolCapacity(workerPool chan types.Worker) int

GetWorkerPoolCapacity is a function that gets the capacity of a pool of workers.

func GetWorkerPoolSize added in v1.1.0

func GetWorkerPoolSize(workerPool chan types.Worker) int

GetWorkerPoolSize is a function that gets the size of a pool of workers.

func IsWorkerPoolEmpty added in v1.1.0

func IsWorkerPoolEmpty(workerPool chan types.Worker) bool

IsWorkerPoolEmpty is a function that checks if a pool of workers is empty.

func IsWorkerPoolFull added in v1.1.0

func IsWorkerPoolFull(workerPool chan types.Worker) bool

IsWorkerPoolFull is a function that checks if a pool of workers is full.

func IsWorkerPoolFullAndNotEmpty added in v1.1.0

func IsWorkerPoolFullAndNotEmpty(workerPool chan types.Worker) bool

IsWorkerPoolFullAndNotEmpty is a function that checks if a pool of workers is full and not empty.

func IsWorkerPoolFullOrEmpty added in v1.1.0

func IsWorkerPoolFullOrEmpty(workerPool chan types.Worker) bool

IsWorkerPoolFullOrEmpty is a function that checks if a pool of workers is full or empty.

func IsWorkerPoolNotEmpty added in v1.1.0

func IsWorkerPoolNotEmpty(workerPool chan types.Worker) bool

IsWorkerPoolNotEmpty is a function that checks if a pool of workers is not empty.

func IsWorkerPoolNotFull added in v1.1.0

func IsWorkerPoolNotFull(workerPool chan types.Worker) bool

IsWorkerPoolNotFull is a function that checks if a pool of workers is not full.

func IsWorkerPoolNotFullAndNotEmpty added in v1.1.0

func IsWorkerPoolNotFullAndNotEmpty(workerPool chan types.Worker) bool

IsWorkerPoolNotFullAndNotEmpty is a function that checks if a pool of workers is not full and not empty.

func IsWorkerPoolNotFullOrEmpty added in v1.1.0

func IsWorkerPoolNotFullOrEmpty(workerPool chan types.Worker) bool

IsWorkerPoolNotFullOrEmpty is a function that checks if a pool of workers is not full or empty.

func IsWorkerPoolNotPopulated added in v1.1.0

func IsWorkerPoolNotPopulated(workerPool chan types.Worker) bool

IsWorkerPoolNotPopulated is a function that checks if a pool of workers is not populated.

func IsWorkerPoolNotPopulatedAndNotEmpty added in v1.1.0

func IsWorkerPoolNotPopulatedAndNotEmpty(workerPool chan types.Worker) bool

IsWorkerPoolNotPopulatedAndNotEmpty is a function that checks if a pool of workers is not populated and not empty.

func IsWorkerPoolNotPopulatedAndNotFull added in v1.1.0

func IsWorkerPoolNotPopulatedAndNotFull(workerPool chan types.Worker) bool

IsWorkerPoolNotPopulatedAndNotFull is a function that checks if a pool of workers is not populated and not full.

func IsWorkerPoolNotPopulatedOrEmpty added in v1.1.0

func IsWorkerPoolNotPopulatedOrEmpty(workerPool chan types.Worker) bool

IsWorkerPoolNotPopulatedOrEmpty is a function that checks if a pool of workers is not populated or empty.

func IsWorkerPoolNotPopulatedOrFull added in v1.1.0

func IsWorkerPoolNotPopulatedOrFull(workerPool chan types.Worker) bool

IsWorkerPoolNotPopulatedOrFull is a function that checks if a pool of workers is not populated or full.

func IsWorkerPoolPopulated added in v1.1.0

func IsWorkerPoolPopulated(workerPool chan types.Worker) bool

IsWorkerPoolPopulated is a function that checks if a pool of workers is populated.

func IsWorkerPoolPopulatedAndNotEmpty added in v1.1.0

func IsWorkerPoolPopulatedAndNotEmpty(workerPool chan types.Worker) bool

IsWorkerPoolPopulatedAndNotEmpty is a function that checks if a pool of workers is populated and not empty.

func IsWorkerPoolPopulatedAndNotFull added in v1.1.0

func IsWorkerPoolPopulatedAndNotFull(workerPool chan types.Worker) bool

IsWorkerPoolPopulatedAndNotFull is a function that checks if a pool of workers is populated and not full.

func IsWorkerPoolPopulatedOrEmpty added in v1.1.0

func IsWorkerPoolPopulatedOrEmpty(workerPool chan types.Worker) bool

IsWorkerPoolPopulatedOrEmpty is a function that checks if a pool of workers is populated or empty.

func IsWorkerPoolPopulatedOrFull added in v1.1.0

func IsWorkerPoolPopulatedOrFull(workerPool chan types.Worker) bool

IsWorkerPoolPopulatedOrFull is a function that checks if a pool of workers is populated or full.

func RemoveWorkerFromPool added in v1.1.0

func RemoveWorkerFromPool(workerPool chan types.Worker)

RemoveWorkerFromPool is a function that removes a worker from a pool of workers.

func WriteErrorResponse added in v1.0.7

func WriteErrorResponse(w http.ResponseWriter, msg string, errorCode int)

WriteErrorResponse writes an error response to the response writer with appropriate headers. It does NOT return an error because it is used to write an error response. Instead, if an error occurs internally, it writes the error to the response writer with http.Error.

func WriteGzipJSONResponse

func WriteGzipJSONResponse(w http.ResponseWriter, data interface{}, code int) error

WriteGzippedJSONResponse compresses the JSON data and writes it to the response writer with appropriate headers. The Content-Encoding header is set to gzip and the Content-Type header is set to application/json. The Content-Length header is set with the length of the compressed data. The status code is set based on the provided code parameter. If the data cannot be serialized to JSON, an error is returned. If the compressed data cannot be written to the response writer, an error is returned.

Types

This section is empty.

Jump to

Keyboard shortcuts

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