generic

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 0 Imported by: 1

README

Go-Generic-Basic

This is a simple example of using generics in Go.

Dependencies

API Documentation

Please see the API Documentation for api documentation.

License

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

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Must

func Must[T any](v T, err error) T

Must is a utility function that ensures a value is not nil and returns it. If the error is not nil, it panics with the error message.

func Must2

func Must2[T any, U any](v T, u U, err error) (T, U)

Must2 is a utility function that ensures a value is not nil and returns it.

func MustLookup

func MustLookup[T any](v T, ok bool) T

MustLookup is a utility function that ensures a value is not nil and returns it. If the error is not nil, it panics with the error message.

func MustLookupOr

func MustLookupOr[T any](def T, v T, ok bool) T

MustLookupOr is a utility function that ensures a value is not nil and returns it. If the error is not nil, it returns the default value.

func MustLookupOrNil

func MustLookupOrNil[T any](v *T, ok bool) *T

MustLookupOrNil is a utility function that ensures a value is not nil and returns it. If the error is not nil, it returns nil.

func MustLookupOrZero

func MustLookupOrZero[T any](v T, ok bool) T

MustLookupOrZero is a utility function that ensures a value is not nil and returns it. If the error is not nil, it returns a zero value.

func MustOr

func MustOr[T any](def T, v T, err error) T

MustOr is a utility function that ensures a value is not nil and returns it. If the error is not nil, it returns the default value.

func MustOrNil

func MustOrNil[T any](v *T, err error) *T

MustOrNil is a utility function that ensures a value is not nil and returns it. If the error is not nil, it returns nil.

func MustOrZero

func MustOrZero[T any](v T, err error) T

MustOrZero is a utility function that ensures a value is not nil and returns it. If the error is not nil, it returns a zero value.

func OrNil

func OrNil[T any](_ T, err error) error

OrNil is a utility function that ensures a value is not nil and returns it.

func OrNil2

func OrNil2[T any](_, _ T, err error) error

OrNil2 is a utility function that ensures a value is not nil and returns it.

Types

This section is empty.

Directories

Path Synopsis
Package maps implements the functions, types, and interfaces for the module.
Package maps implements the functions, types, and interfaces for the module.
Package settings implements the functions, types, and interfaces for the module.
Package settings implements the functions, types, and interfaces for the module.
Package thread provides a simple way to run functions in goroutines with error handling.
Package thread provides a simple way to run functions in goroutines with error handling.
Package trans implements the functions, types, and interfaces for the module.
Package trans implements the functions, types, and interfaces for the module.
Package types implements the functions, types, and interfaces for the module.
Package types implements the functions, types, and interfaces for the module.

Jump to

Keyboard shortcuts

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