helpers

package module
v0.0.0-...-049e726 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 6 Imported by: 0

README

GoHelpers

Go helper methods for me

Below is a template for simplifying imports.

package main

import (
	"errors"
	"fmt"
	"reflect"
	"testing"

	"github.com/areon546/go-helpers"
)

// helper functions

func Print(a ...any) { helpers.Print(a...) }

func Printf(s string, a ...any) { helpers.Printf(s, a...) }

func Format(s string, a ...any) string { return helpers.Format(s, a...) }

func Search[T any](item T, arr []T) (index int) {
	return helpers.Search(item, arr)
}

func ConvertToInteger(s string) (int, error) {
	return helpers.ConvertToInteger(s)
}

func Handle(err error) {
	helpers.Handle(err)
}

func AssertEquals(t testing.TB, expected, result fmt.Stringer) {
	t.Helper()
	
    helpers.AssertEquals(t, expected, result)
}

func AssertEqualsInt(t testing.TB, expected, result int) {
	t.Helper()

	helpers.AssertEqualsInt(t, expected, result)
}

func AssertError(t testing.TB, got, want error) {
	t.Helper()
    helpers.AssertError(t, got, want)
}

func AssertNoError(t testing.TB, err error) {
	t.Helper()
	AssertError(t, err, nil)
}



Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssertEquals

func AssertEquals(t testing.TB, expected, result fmt.Stringer)

func AssertEqualsInt

func AssertEqualsInt(t testing.TB, expected, result int)

func AssertError

func AssertError(t testing.TB, got, want error)

func AssertNoError

func AssertNoError(t testing.TB, err error)

func ConvertToInteger

func ConvertToInteger(s string) (int, error)

func Format

func Format(s string, a ...any) string

func Handle

func Handle(err error)

func Print

func Print(a ...any)

func Printf

func Printf(s string, a ...any)
func Search[T any](item T, arr []T) (index int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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