Golang : Convert Data Types

Golang Convert Data Types

  • float64 to decimal.NullDecimal

    decimal.NullDecimal = shared.FloatToNullDecimal(float64)
    
  • float64 to decimal.Decimal

    decimal.Decimal = decimal.NewFromFloat(float64)
    
  • decimal.NullDecimal to decimal.Decimal

    decimal.Decimal = (decimal.NullDecimal).Decimal
    
  • String to float64

    float64,err = strconv.ParseFloat(String, 64)
    
  • String to null.String

null.String = null.StringFrom(String)

null.String = null.NewString(String, true)

Comparison Data Type

  • Decimal to Decimal
if buyPrice.Abs().GreaterThan(sellPrice.Abs()) {

	//your code here
}
author image

Founder of tarkiman.com, love programming and open source stuff. Subscribe him on Youtube Channel.

Comments