utils

package
v0.0.0-...-9b4e82f Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2019 License: MIT Imports: 7 Imported by: 9

Documentation

Overview

deepcopy makes deep copies of things. A standard copy will copy the pointers: deep copy copies the values pointed to. Unexported field values are not copied.

Copyright (c)2014-2016, Joel Scoble (github.com/mohae), all rights reserved. License: MIT, for more details check the included LICENSE file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(src interface{}) interface{}

Copy creates a deep copy of whatever is passed to it and returns the copy in an interface{}. The returned value will need to be asserted to the correct type.

func CreateBool

func CreateBool(x bool) *bool

func CreateFloat

func CreateFloat(x float64) *float64

func CreateInt

func CreateInt(x int64) *int64

func Iface

func Iface(iface interface{}) interface{}

Iface is an alias to Copy; this exists for backwards compatibility reasons.

func MapNumFloat

func MapNumFloat(value, inMin, inMax, outMin, outMax float64) float64

map a number from one range to another range

func MapNumInt

func MapNumInt(value, inMin, inMax, outMin, outMax int64) int64

func PrintJson

func PrintJson(e interface{})

func RandRangInt

func RandRangInt(min, max int64) int64

func RandRangeFloat

func RandRangeFloat(min, max float64) float64

generate a random number between two floats

func Round

func Round(f float64) float64

Round a float to the nearest int

func RoundPlus

func RoundPlus(f float64, places int) float64

Round f to nearest number of decimal points

func Spin

func Spin(duration time.Duration)

Types

type Duration

type Duration struct {
	time.Duration
}

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type Interface

type Interface interface {
	DeepCopy() interface{}
}

Interface for delegating copy process to type

Jump to

Keyboard shortcuts

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