utils

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 8 Imported by: 135

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForEachRange added in v0.4.39

func ForEachRange(totalSize int, maxSubRangeSize int, handler func(from, to int) error) error

ForEachRange is simple utility calling given function for each sub-range defined within [0-totalSize]. It wont be called however if range is empty. For example, MakeRanges(35, 10, fc) will result in fc being called 4 times with arguments: * 0-10 * 10-20 * 20-30 * 30-35 It can be used to split slice into smaller ones. Params totalSize must not be less than 0, maxSubRangeSize must be bigger than 0. If those are not met, function panics. If given function returns error, iteration stops and ForEachRange returns that error

func GetFieldTypeForOneOf added in v0.9.2

func GetFieldTypeForOneOf(protoMsg proto.Message, fieldDesc preflect.FieldDescriptor) (reflect.StructField, bool)

func IsNil

func IsNil(v interface{}) bool

func JsonMarshal

func JsonMarshal(v interface{}) ([]byte, error)

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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