hash

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

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

Go to latest
Published: Nov 1, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package hash provides functions for computing a hash of vql values and AST nodes. Hash is ultimately used as an UID of a Table, so that it can be cached and reused across computations.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Zero is an all-zero hash value.
	Zero = Hash{}
)

Functions

This section is empty.

Types

type Hash

type Hash [hashBytes]byte

Hash uniquely identifies a Value or an AST node.

func Bool

func Bool(b bool) Hash

Bool hashes a boolean value.

func Bytes

func Bytes(data []byte) Hash

Bytes hashes a byte array.

func Float

func Float(v float64) Hash

Float hashes an float64 value.

func Int

func Int(v int64) Hash

Int hashes an int64 value.

func String

func String(s string) Hash

String hashes a string.

func Time

func Time(t time.Time) Hash

Time hashes a time.Time value.

func (Hash) Add

func (h Hash) Add(h2 Hash) Hash

Add merges two hash values commutatively.

∀ h, ∀ h2: h.Add(h2) == h2.Add(h)

func (Hash) Merge

func (h Hash) Merge(h2 Hash) Hash

Merge combines the two hashes. This function is not commutative or distributive.

func (Hash) String

func (h Hash) String() string

String returns a human-readable description.

Jump to

Keyboard shortcuts

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