util

package
v0.0.0-...-8240420 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2019 License: LGPL-3.0 Imports: 12 Imported by: 26

Documentation

Index

Constants

View Source
const (
	IPv4 = syscall.AF_INET
	IPv6 = syscall.AF_INET6
)

Possible address families.

Variables

This section is empty.

Functions

func AddrFamily

func AddrFamily(ip net.IP) int

AddrFamily returns the address family of an IP address.

func InterfaceIPs

func InterfaceIPs(device string) (ips []net.IP, _ error)

InterfaceIPs returns a slice of interface IP addresses.

func MustMarshal

func MustMarshal(object interface{}, options JSONOptions) []byte

MustMarshal will try to convert the given object to JSON or panic if there's an error.

func ParseInterval

func ParseInterval(s string) (time.Duration, error)

ParseInterval parses an interval string and returns the corresponding duration.

Types

type DynamicMap

type DynamicMap map[string]interface{}

DynamicMap are arbitrary options passed directly to the driver.

func (DynamicMap) Get

func (do DynamicMap) Get(key string, d interface{}) interface{}

Get returns a typed option or a default value if the option is not set.

type JSONOptions

type JSONOptions struct {
	Indent bool
}

JSONOptions configure JSON marshalling behavior.

Jump to

Keyboard shortcuts

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