utils

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// 	Logger      *slog.Logger                   // Logger is the default logger
	// 	LogLevel    string                         // logLevel is the log level
	Environment = tuUtils.GetEnvDefault("ENVIRONMENT", "dev") // Environment is the default environment
	Prefix      = tuUtils.GetEnvDefault("PREFIX", "data")     // Prefix is the default prefix
)

Functions

func CreateBytes

func CreateBytes(data any) []byte

func LinesFromReader

func LinesFromReader(r io.Reader) []string

LinesFromReader returns an array of strings representing each line read from the provided io.Reader.

The function takes an io.Reader as a parameter and scans it line by line using a bufio.Scanner. Each line is then appended to the `lines` array. After scanning is complete, the function checks for any errors and calls the MaybeDie function if there is any error. Finally, the `lines` array is returned.

func UrlToLines

func UrlToLines(url string, username string, password string) []string

UrlToLines retrieves the contents of a URL and returns them line by line.

Parameters: - url: the URL to retrieve the contents from. - username: the username for basic authentication. If not needed, leave it empty. - password: the password for basic authentication. If not needed, leave it empty.

Returns: - lines: an array of strings containing the lines of the retrieved content.

Types

This section is empty.

Jump to

Keyboard shortcuts

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