Split compat files into go 1.8 and pre-go 1.8 files
Project: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/repo Commit: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/commit/8a9e358b Tree: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/tree/8a9e358b Diff: http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/diff/8a9e358b Branch: refs/heads/master Commit: 8a9e358b69cc9cd83980f4ceaea7f89aa37fd8c3 Parents: 36cfe22 Author: Francis Chuang <francis.chu...@boostport.com> Authored: Fri Mar 10 16:57:19 2017 +1100 Committer: Julian Hyde <jh...@apache.org> Committed: Thu Aug 10 18:47:11 2017 -0700 ---------------------------------------------------------------------- compat.go | 35 +++++++++++++++++++++++++++++++++++ compat_go18.go | 32 ++------------------------------ 2 files changed, 37 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/blob/8a9e358b/compat.go ---------------------------------------------------------------------- diff --git a/compat.go b/compat.go new file mode 100644 index 0000000..5b1b783 --- /dev/null +++ b/compat.go @@ -0,0 +1,35 @@ +package avatica + +import ( + "database/sql/driver" +) + +type namedValue struct { + Name string + Ordinal int + Value driver.Value +} + +func driverValueToNamedValue(values []driver.Value) []namedValue { + list := make([]namedValue, len(values)) + + for i, v := range values { + list[i] = namedValue{ + Ordinal: i + 1, + Value: v, + } + } + + return list +} + +type isoLevel int32 + +const ( + isolationUseCurrent isoLevel = -1 + isolationNone isoLevel = 0 + isolationReadUncommitted isoLevel = 1 + isolationReadComitted isoLevel = 2 + isolationRepeatableRead isoLevel = 4 + isolationSerializable isoLevel = 8 +) http://git-wip-us.apache.org/repos/asf/calcite-avatica-go/blob/8a9e358b/compat_go18.go ---------------------------------------------------------------------- diff --git a/compat_go18.go b/compat_go18.go index 6c60866..47d9832 100644 --- a/compat_go18.go +++ b/compat_go18.go @@ -1,3 +1,5 @@ +// +build go1.8 + package avatica import ( @@ -5,25 +7,6 @@ import ( "fmt" ) -type namedValue struct { - Name string - Ordinal int - Value driver.Value -} - -func driverValueToNamedValue(values []driver.Value) []namedValue { - list := make([]namedValue, len(values)) - - for i, v := range values { - list[i] = namedValue{ - Ordinal: i + 1, - Value: v, - } - } - - return list -} - func driverNamedValueToNamedValue(values []driver.NamedValue) ([]namedValue, error) { list := make([]namedValue, len(values)) @@ -37,14 +20,3 @@ func driverNamedValueToNamedValue(values []driver.NamedValue) ([]namedValue, err return list, nil } - -type isoLevel int32 - -const ( - isolationUseCurrent isoLevel = -1 - isolationNone isoLevel = 0 - isolationReadUncommitted isoLevel = 1 - isolationReadComitted isoLevel = 2 - isolationRepeatableRead isoLevel = 4 - isolationSerializable isoLevel = 8 -)