github.com/ronaksoft/rony@v0.16.26-0.20230807065236-1743dbfe6959/tools/constructor.go (about)

     1  package tools
     2  
     3  import (
     4  	"hash/crc64"
     5  	"reflect"
     6  )
     7  
     8  /*
     9     Creation Time: 2021 - Jul - 02
    10     Created by:  (ehsan)
    11     Maintainers:
    12        1.  Ehsan N. Moosa (E2)
    13     Auditor: Ehsan N. Moosa (E2)
    14     Copyright Ronak Software Group 2020
    15  */
    16  
    17  var (
    18  	crc64Table = crc64.MakeTable(crc64.ISO)
    19  )
    20  
    21  func ConstructorOf(x interface{}) int64 {
    22  	return int64(crc64.Checksum(S2B(reflect.ValueOf(x).Type().Name()), crc64Table))
    23  }