godutils

package module
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

README

GodUtils

GoLang utilities for common tasks.

Installation

go get github.com/ThatAnonyG/godutils

Todo

  • Add more utilities
  • Add tests
  • Add documentation

License

This project is licensed under the GPL-3.0 License - see the LICENSE file for details.

Author

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertTimezone added in v1.0.6

func ConvertTimezone(t time.Time, currLoc *time.Location, newLoc *time.Location) time.Time

func FilterList added in v1.0.3

func FilterList[T any](list *[]T, fn func(T) bool) *[]T

func FilterListP added in v1.0.3

func FilterListP[T any](list *[]*T, fn func(*T) bool) *[]*T

func FindInList

func FindInList[T any](list *[]T, fn func(T) bool) *T

func FindInListP added in v1.0.3

func FindInListP[T any](list *[]*T, fn func(*T) bool) *T

func GetDynamicField

func GetDynamicField[T any](structPtr interface{}, fieldName string, vType T) (value T, err error)

func GetNullInt32

func GetNullInt32(v int) (nullInt32 sql.NullInt32)

func GetOrCreate

func GetOrCreate[K comparable, V any](mapObj map[K]*V, key K) *V

func GetOrigin

func GetOrigin(originHeader string) (origin string)

func InSameClock added in v1.0.5

func InSameClock(t time.Time, loc *time.Location) time.Time

func OffsetTime

func OffsetTime(t time.Time, offset int) (withOffset time.Time)

func OffsetToLoc

func OffsetToLoc(offset int) (loc *time.Location)

func RemoveSliceOrdered added in v1.0.8

func RemoveSliceOrdered[T any](slice *[]T, i int)

func RemoveSliceUnordered added in v1.0.8

func RemoveSliceUnordered[T any](slice *[]T, i int)

func SetDynamicField

func SetDynamicField[T any](structPtr interface{}, fieldName string, value T) (err error)

func TimezoneToOffset added in v1.0.6

func TimezoneToOffset(timezone string) int

func ToPascalCase added in v1.0.4

func ToPascalCase(str string) string

func ToSnakeCase added in v1.0.3

func ToSnakeCase(str string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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