Categorygithub.com/nano-interactive/go-utils/v2
modulepackage
2.3.1
Repository: https://github.com/nano-interactive/go-utils.git
Documentation: pkg.go.dev

# README

GoUtils

Documentation

Testing codecov Go Report Card

## This is a collection of useful packages including:
  • Config
  • Environment
  • Logging
  • Signals
  • Testing

Config

package main

import (
    "github.com/nano-interactive/go-utils/v2/config
)

// Defaults

var DefaultConfig = Config {
    Env: "development",
    Name: "config",
    Type: "yaml",
}

func main() {
    config, err := config.New(config.Config)

    if err != nil {
        // Failed to load configuration
    }
}

Environment

Logging

Signals

Testing

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Slices IP address byte slice and writes 0 to last octet Example: AnonymizeIp([]byte{'1','9','2','.','1','7','2','.','9','0','.','7','0'}) Returns []byte{'1','9','2','.','1','7','2','.','9','0','.','0'}.
Provides a way of copying bytes into new byte slice Returns byte slice.
Provides a way of creating directory with permissions for a given path Returns string path of created directory and error if fails.
Provides a way of creating a directory from a path Returns created directory path and error if fails.
Creates file for given directory with flags and permissions for directory and file Returns file instance and error if it fails.
Creates write only appendable file with permission 0o744 for directory and file for given path.
No description provided by the author
No description provided by the author
No description provided by the author
Provides a way of checking if file exists.
Returns absolute path string for a given directory and error if directory doesent exist.
No description provided by the author
No description provided by the author
Returns ENV string.
Returns IP address of local machine, empty string if fails.
Returns strinngs slice of IP found on local machine.
Returns 32 character string of random bytes.
No description provided by the author
Provides a way of testing if type is integer Returns bool value depending if its integer or not.
Returns bool value of HTTP status code if its failure or success.
Returns random string of given length.
Extracts first ip address from Peekable interface seperated by coma Returns nil if no values are presemt.
No description provided by the author
No description provided by the author
Truncates a given url.
No description provided by the author
Returns unique slice back.
nolint:gosec#nosec G103*/.
nolint:gosec#nosec G103*/.

# Constants

No description provided by the author
No description provided by the author
MaxEncodedLength.
RequestIdLength.
No description provided by the author

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Interfaces

No description provided by the author