[go: up one dir, main page]

base

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsIn

func IsIn[T comparable, S1 ~[]T, S2 ~[]T](s S1, list S2) int

IsIn returns -1 if every item of a slice is in another slice. Returns index of the first item if it is not in the target slice.

func IsNotIn

func IsNotIn[T comparable, S1 ~[]T, S2 ~[]T](s S1, list S2) int

IsNotIn returns -1 if any item of a slice is not in another slice. Returns index of the first item if it is in the target slice.

func IsUnique

func IsUnique[T comparable, S ~[]T](s S) int

IsUnique returns -1 if every item of a slice is unique. Returns index of the first item if it is a duplication of another.

func IsUniqueBy added in v1.1.0

func IsUniqueBy[T any, U comparable, S ~[]T](s S, keyFn func(T) U) int

IsUniqueBy returns -1 if every value returned by the key function is unique. Returns index of the first item if it is a duplication of another.

func ToMap

func ToMap[T comparable, S ~[]T](s S) map[T]struct{}

ToMap transforms a slice to a map with slice items as map keys

Types

type ErrorParam

type ErrorParam struct {
	Key   string
	Value any
}

ErrorParam data structure for an error param

type Float

type Float gofn.FloatExt

Float interface of float types and float-derived types

type Int

type Int gofn.IntExt

Int interface of int types and int-derived types

type Number

type Number interface {
	Int | UInt | Float
}

Number interface of combined type of Int, UInt, and Float

type String

type String gofn.StringExt

String interface of string type and string-derived types

type Time

type Time interface {
	Compare(time.Time) int
	IsZero() bool
}

Time interface of time type

type UInt

type UInt gofn.UIntExt

UInt interface of uint types and uint-derived types

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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