@@ -52,6 +52,8 @@ const (
5252 TypeRepresentationTypeFloat32 TypeRepresentationType = "float32"
5353 // An IEEE-754 double-precision floating-point number
5454 TypeRepresentationTypeFloat64 TypeRepresentationType = "float64"
55+ // Arbitrary-precision integer string
56+ TypeRepresentationTypeBigInteger TypeRepresentationType = "biginteger"
5557 // Arbitrary-precision decimal string
5658 TypeRepresentationTypeBigDecimal TypeRepresentationType = "bigdecimal"
5759 // UUID string (8-4-4-4-12)
@@ -84,6 +86,7 @@ var enumValues_TypeRepresentationType = []TypeRepresentationType{
8486 TypeRepresentationTypeInt64 ,
8587 TypeRepresentationTypeFloat32 ,
8688 TypeRepresentationTypeFloat64 ,
89+ TypeRepresentationTypeBigInteger ,
8790 TypeRepresentationTypeBigDecimal ,
8891 TypeRepresentationTypeUUID ,
8992 TypeRepresentationTypeDate ,
@@ -346,6 +349,21 @@ func (ty TypeRepresentation) AsFloat64() (*TypeRepresentationFloat64, error) {
346349 }, nil
347350}
348351
352+ // AsBigInteger tries to convert the current type to TypeRepresentationBigInteger
353+ func (ty TypeRepresentation ) AsBigInteger () (* TypeRepresentationBigInteger , error ) {
354+ t , err := ty .Type ()
355+ if err != nil {
356+ return nil , err
357+ }
358+ if t != TypeRepresentationTypeBigInteger {
359+ return nil , fmt .Errorf ("invalid TypeRepresentation type; expected %s, got %s" , TypeRepresentationTypeBigInteger , t )
360+ }
361+
362+ return & TypeRepresentationBigInteger {
363+ Type : t ,
364+ }, nil
365+ }
366+
349367// AsBigDecimal tries to convert the current type to TypeRepresentationBigDecimal
350368func (ty TypeRepresentation ) AsBigDecimal () (* TypeRepresentationBigDecimal , error ) {
351369 t , err := ty .Type ()
@@ -549,6 +567,8 @@ func (ty TypeRepresentation) InterfaceT() (TypeRepresentationEncoder, error) {
549567 return ty .AsFloat32 ()
550568 case TypeRepresentationTypeFloat64 :
551569 return ty .AsFloat64 ()
570+ case TypeRepresentationTypeBigInteger :
571+ return ty .AsBigInteger ()
552572 case TypeRepresentationTypeBigDecimal :
553573 return ty .AsBigDecimal ()
554574 case TypeRepresentationTypeUUID :
@@ -775,6 +795,25 @@ func (ty TypeRepresentationFloat64) Encode() TypeRepresentation {
775795 }
776796}
777797
798+ // TypeRepresentationBigInteger represents an arbitrary-precision integer string
799+ type TypeRepresentationBigInteger struct {
800+ Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
801+ }
802+
803+ // NewTypeRepresentationBigInteger creates a new TypeRepresentationBigInteger instance
804+ func NewTypeRepresentationBigInteger () * TypeRepresentationBigInteger {
805+ return & TypeRepresentationBigInteger {
806+ Type : TypeRepresentationTypeBigInteger ,
807+ }
808+ }
809+
810+ // Encode returns the raw TypeRepresentation instance
811+ func (ty TypeRepresentationBigInteger ) Encode () TypeRepresentation {
812+ return map [string ]any {
813+ "type" : ty .Type ,
814+ }
815+ }
816+
778817// TypeRepresentationBigDecimal represents an arbitrary-precision decimal string
779818type TypeRepresentationBigDecimal struct {
780819 Type TypeRepresentationType `json:"type" yaml:"type" mapstructure:"type"`
0 commit comments