From 5427d1b22bcdf10386d02e69377d1b24e57b775a Mon Sep 17 00:00:00 2001 From: Daniel Montoya Date: Wed, 21 Jun 2017 13:25:40 -0500 Subject: [PATCH 1/5] Added support for custom string types. --- statement.go | 2 ++ statement_test.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 statement_test.go diff --git a/statement.go b/statement.go index ae223507f..628174b64 100644 --- a/statement.go +++ b/statement.go @@ -157,6 +157,8 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) { return int64(u64), nil case reflect.Float32, reflect.Float64: return rv.Float(), nil + case reflect.String: + return rv.String(), nil } return nil, fmt.Errorf("unsupported type %T, a %s", v, rv.Kind()) } diff --git a/statement_test.go b/statement_test.go new file mode 100644 index 000000000..63c9ce2be --- /dev/null +++ b/statement_test.go @@ -0,0 +1,13 @@ +package mysql + +import "testing" + +type customString string + +func TestConvertValueCustomTypes(t *testing.T) { + var cstr customString = "string" + c := converter{} + if _, err := c.ConvertValue(cstr); err != nil { + t.Errorf("custom string type should be valid") + } +} From d31d5ff3e41f37c32dc1f76fe6dc0ab9181a7c28 Mon Sep 17 00:00:00 2001 From: Daniel Montoya Date: Wed, 21 Jun 2017 13:48:43 -0500 Subject: [PATCH 2/5] Add author name --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index ac36be9a7..ca6a1daeb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -18,6 +18,7 @@ Asta Xie Bulat Gaifullin Carlos Nieto Chris Moos +Daniel Montoya Daniel Nichter Daniƫl van Eeden Dave Protasowski From 661c2e06aed33ffcfbefe190c339eb49172acd38 Mon Sep 17 00:00:00 2001 From: Daniel Montoya Date: Fri, 10 Nov 2017 19:49:01 -0600 Subject: [PATCH 3/5] Added license header --- statement_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/statement_test.go b/statement_test.go index 63c9ce2be..8de4a8b26 100644 --- a/statement_test.go +++ b/statement_test.go @@ -1,3 +1,11 @@ +// Go MySQL Driver - A MySQL-Driver for Go's database/sql package +// +// Copyright 2017 The Go-MySQL-Driver Authors. All rights reserved. +// +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// You can obtain one at http://mozilla.org/MPL/2.0/. + package mysql import "testing" From db6af9049fa84406c76edaf472a6b50f7eff1cc1 Mon Sep 17 00:00:00 2001 From: Daniel Montoya Date: Sun, 12 Nov 2017 23:03:08 -0600 Subject: [PATCH 4/5] Added a newline to force a commit. --- statement_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/statement_test.go b/statement_test.go index 8de4a8b26..0f7f06e7b 100644 --- a/statement_test.go +++ b/statement_test.go @@ -15,6 +15,7 @@ type customString string func TestConvertValueCustomTypes(t *testing.T) { var cstr customString = "string" c := converter{} + if _, err := c.ConvertValue(cstr); err != nil { t.Errorf("custom string type should be valid") } From 9292b24955e39639be69c5fb5242cc7b2c2367e6 Mon Sep 17 00:00:00 2001 From: Daniel Montoya Date: Wed, 15 Nov 2017 16:25:32 -0600 Subject: [PATCH 5/5] Remove newline. --- statement_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/statement_test.go b/statement_test.go index 0f7f06e7b..8de4a8b26 100644 --- a/statement_test.go +++ b/statement_test.go @@ -15,7 +15,6 @@ type customString string func TestConvertValueCustomTypes(t *testing.T) { var cstr customString = "string" c := converter{} - if _, err := c.ConvertValue(cstr); err != nil { t.Errorf("custom string type should be valid") }