utils

package
v0.0.0-...-6e4d973 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package utils provides utility functions for the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllContains

func AllContains[T comparable](slices1 []T, slices2 []T) bool

AllContains checks if all of the slices contain a specific element

func AnyContains

func AnyContains[T comparable](slices1 []T, slices2 []T) bool

AnyContains checks if any of the slices contains a specific element

func Contains

func Contains[T comparable](slice []T, elem T) bool

Contains checks if a slice contains a specific element

func GenerateUniqueID

func GenerateUniqueID() string

GenerateUniqueID generates a unique ID

func GetTerminalSize

func GetTerminalSize() (int, int, error)

GetTerminalSize returns the width and height of the terminal.

func SetFocus

func SetFocus(app *tview.Application, primitive tview.Primitive)

SetFocus sets the focus to the specified primitive

func UnmarshalJSON

func UnmarshalJSON(data []byte, v any) error

UnmarshalJSON unmarshals JSON data into a struct

Types

type Broadcaster

type Broadcaster[T any] struct {
	// contains filtered or unexported fields
}

func NewBroadcaster

func NewBroadcaster[T any]() *Broadcaster[T]

func (*Broadcaster[T]) Broadcast

func (b *Broadcaster[T]) Broadcast(value T) <-chan struct{}

func (*Broadcaster[T]) Close

func (b *Broadcaster[T]) Close()

func (*Broadcaster[T]) Subscribe

func (b *Broadcaster[T]) Subscribe() <-chan T

func (*Broadcaster[T]) Unsubscribe

func (b *Broadcaster[T]) Unsubscribe(ch chan T)

type DelayedTransport

type DelayedTransport struct {
	Transport http.RoundTripper
	Delay     time.Duration
}

func (*DelayedTransport) RoundTrip

func (d *DelayedTransport) RoundTrip(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳