This is an automated email from the ASF dual-hosted git repository.
zeroshade pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 49e60a0d49 MINOR: [Go] Add "IsSignedInteger" (#35050)
49e60a0d49 is described below
commit 49e60a0d4935acde515bfce9fa5ec18ffd7c2202
Author: Igor Izvekov <[email protected]>
AuthorDate: Wed Apr 12 17:50:04 2023 +0300
MINOR: [Go] Add "IsSignedInteger" (#35050)
### Rationale for this change
Return true, if data type is signed integer(int8, int16, int32, int64).
### What changes are included in this PR?
Implementation "IsSignedInteger"
### Are these changes tested?
No
### Are there any user-facing changes?
Yes
Authored-by: izveigor <[email protected]>
Signed-off-by: Matt Topol <[email protected]>
---
go/arrow/datatype.go | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/go/arrow/datatype.go b/go/arrow/datatype.go
index 9f20931fb9..8f9ad2e264 100644
--- a/go/arrow/datatype.go
+++ b/go/arrow/datatype.go
@@ -286,6 +286,16 @@ func IsUnsignedInteger(t Type) bool {
return false
}
+// IsSignedInteger is a helper that returns true if the type ID provided is
+// one of the int integral types (int8, int16, int32, int64)
+func IsSignedInteger(t Type) bool {
+ switch t {
+ case INT8, INT16, INT32, INT64:
+ return true
+ }
+ return false
+}
+
// IsFloating is a helper that returns true if the type ID provided is
// one of Float16, Float32, or Float64
func IsFloating(t Type) bool {