Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecated comments #65

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions generics/batch.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package generics

// Batch
//
// Deprecated: use slices.Batch.
func Batch[T any](slice []T, size int) [][]T {
if len(slice) == 0 {
Expand Down
4 changes: 4 additions & 0 deletions generics/ptr.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ package generics
import "github.com/upfluence/pkg/slices"

// Pointer pointers
//
// Deprecated: Use pointers.Ptr.
func Pointer[T comparable](v T) *T {
return &v
}

// NullablePtr return nil if the value is zero
//
// Deprecated: Use pointers.NullablePtr.
func NullablePtr[T comparable](v T) *T {
var zero T
Expand All @@ -26,12 +28,14 @@ func NullablePtr[T comparable](v T) *T {

// ReferenceSlice returns slice with the value of the slice in params as
// pointers.
//
// Deprecated: use slices.References instead.
func ReferenceSlice[T comparable](s []T) []*T {
return slices.References(s)
}

// IndirectSlice
//
// Deprecated: use slices.Indirect instead.
func IndirectSlice[T comparable](s []*T) []T {
return slices.Indirect(s)
Expand Down
2 changes: 2 additions & 0 deletions generics/unique.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package generics

// Unique creates a map with keys being the values of a slice
//
// Deprecated: use slices.Unique.
func Unique[T comparable](s []T) map[T]struct{} {
var m = make(map[T]struct{}, len(s))
Expand All @@ -16,6 +17,7 @@ func Unique[T comparable](s []T) map[T]struct{} {

// UniquePtr creates a map with keys being the de-referenced value of a pointer
// contained in a slice. Nil ptr are ignored.
//
// Deprecated: use slices.UniquePtr.
func UniquePtr[T comparable](s []*T) map[T]struct{} {
var m = make(map[T]struct{}, len(s))
Expand Down
Loading