struct Crysda::HashBuilder

Overview

Custom Hashing helper. This provides a calculated hash of contents which is consistent on each and every run. This doesn't conflict with and/or override Crystal Hashing functionality which is used for object equality checks. Hash value generated by this builder is only used for internal grouping purposes to ensure the consistency on each and every run/invocation. Refer to CustomColumnValue for more details and usage purposes.

Defined in:

crysda/utils.cr

Constant Summary

HASH_NULL = Int64::MAX - 123000

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Class Method Detail

def self.combine(h1 : Int64, h2 : Int64) : Int64 #

Combine multiple hash values


[View source]
def self.hash_f64(val : Float64 | Nil, seed : Int64 = 17_i64) : Int64 #

Hash a single Float64 value (or null) - fast path using bit representation


[View source]
def self.hash_i32(val : Int32 | Nil, seed : Int64 = 17_i64) : Int64 #

Hash a single Int32 value (or null)


[View source]
def self.hash_i64(val : Int64 | Nil, seed : Int64 = 17_i64) : Int64 #

Hash a single Int64 value (or null)


[View source]
def self.hash_str(val : String | Nil, seed : Int64 = 17_i64) : Int64 #

Hash a single String value (or null)


[View source]

Instance Method Detail

def add(val : Bool) #

[View source]
def add(val : Char) #

[View source]
def add(val : String) #

[View source]
def add(val : AnyVal) #

[View source]
def add(val : Nil) #

[View source]
def add(val : Iterable) #

[View source]
def add(value : Float32) #

[View source]
def add(value : Float64) #

[View source]
def add(value : Float) #

[View source]
def add(val : Int) #

[View source]
def add(val : UUID) #

[View source]
def add(val : CustomColumnValue) #

[View source]
def add(val) #

[View source]
def hashcode(val) #

[View source]
def hashcode : Int64 #

[View source]