util

package
v0.0.0-...-865bf36 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2015 License: LGPL-2.1 Imports: 3 Imported by: 0

Documentation

Overview

Contains standalone utility functions used by go-deje for the sake of convenience.

Nothing too interesting in here, but definitely useful.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneMarshal

func CloneMarshal(m interface{}, s interface{}) error

Uses json.Marshal and json.Unmarshal to copy from one object to another. Excellent way to turn a JSON Object into a struct, or vice-versa.

This makes its changes in-place, so always pass in the pointer to the struct object you're trying to fill.

func HashObject

func HashObject(object interface{}) (string, error)

Serialize an object to compact, deterministic JSON (no whitespace, fields in struct order or alphabetical), then take the SHA1 of that, and return the hex digest.

This is the algorithm we use for hashing events, topics, etc.

Types

This section is empty.

Jump to

Keyboard shortcuts

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