generic

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 0 Imported by: 0

README

Go-Generic-Basic

This is a simple example of using generics in Go.

Dependencies

Usage

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 MustOrDefault

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

MustOrDefault 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.

Types

This section is empty.

Directories

Path Synopsis
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 types provides type definitions for various data types.
Package types provides type definitions for various data types.

Jump to

Keyboard shortcuts

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