slices

package
v0.0.0-...-04c5af6 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2020 License: BSD-3-Clause, MIT Imports: 1 Imported by: 0

README

slices

Utilities for Go slice http://godoc.org/github.com/polaris1119/slices

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StructsInt64Slice

func StructsInt64Slice(s interface{}, fieldName string) []int64

StructInt64Slice returns a slice of int64. For more info refer to Slice types StructInt64Slice() method.

func StructsIntSlice

func StructsIntSlice(s interface{}, fieldName string) []int

StructsIntSlice returns a slice of int. For more info refer to Slice types StructIntSlice() method.

Types

type Slice

type Slice struct {
	// contains filtered or unexported fields
}

func New

func New(s interface{}) *Slice

New returns a new *Slice with the slice s. It panics if the s's kind is not slice.

func (*Slice) Name

func (this *Slice) Name() string

Name returns the slice's type name within its package. For more info refer to Name() function.

func (*Slice) StructInt64Slice

func (this *Slice) StructInt64Slice(fieldName string) []int64

StructInt64Slice extracts the given s slice's every element, which is struct, to []int64 by the field. It panics if the s's element is not struct, or field is not exits, or the value of field is not signed integer.

func (*Slice) StructIntSlice

func (this *Slice) StructIntSlice(fieldName string) []int

StructIntSlice extracts the given s slice's every element, which is struct, to []int by the field. It panics if the s's element is not struct, or field is not exits, or the value of field is not signed integer.

Jump to

Keyboard shortcuts

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