utils

package
v0.0.0-...-260b785 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendConfigToDisk

func AppendConfigToDisk(specObj *model.SpecObject, filename string) error

AppendConfigToDisk creates a yml file or appends to existing

func CloseTheCloser

func CloseTheCloser(r io.Closer)

CloseTheCloser closes an io read closer while explicitly ignoring the error

func CreateCorsObject

func CreateCorsObject() *cors.Cors

CreateCorsObject returns a new cors object

func GetInternalServiceDomain

func GetInternalServiceDomain(projectID, serviceID, version string) string

GetInternalServiceDomain is used for getting internal service domain

func GetServiceDomain

func GetServiceDomain(projectID, serviceID string) string

GetServiceDomain is used for getting the main service domain

func GetToken

func GetToken(r *http.Request) (token string)

GetToken retrieves the json web token present in the request

Types

type Debounce

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

Debounce is a functionality which helps make sure a certain piece of logic doesn't get called multiple times.

func NewDebounce

func NewDebounce() *Debounce

NewDebounce creates a new debounce object

func (*Debounce) Wait

func (d *Debounce) Wait(key string, cb func() error) error

Wait makes a caller wait on a certain key. The function provided will be called just once per unique key even though the caller may call it multiple times. It is important that the same callback is passes for each given key.

type DebounceArray

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

DebounceArray is the entity which holds the channels the callers are waiting on

func NewDebounceArray

func NewDebounceArray() (*DebounceArray, chan error)

NewDebounceArray creates a new debounce array object

func (*DebounceArray) Add

func (a *DebounceArray) Add(ch chan error) int

Add adds a new caller to the wait list

func (*DebounceArray) Notify

func (a *DebounceArray) Notify(err error)

Notify signals all interested callers that the event is completed

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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