-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Int64Slice,StrSlice,Float64Slice and BoolSlice #27
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made some small remarks. Nothing about design of code.
types/boolslice_test.go
Outdated
vx, err := nullBoolSlice.Value() | ||
So(err, ShouldEqual, nil) | ||
So(string(vx.([]byte)), ShouldEqual, `[true,false,true]`) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line.
types/float64slice_test.go
Outdated
vx, err := nullFloat64Slice.Value() | ||
So(err, ShouldEqual, nil) | ||
So(string(vx.([]byte)), ShouldEqual, `[1.1,2.2,3.3]`) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line.
types/int64slice_test.go
Outdated
vx, err := nullInt64Slice.Value() | ||
So(err, ShouldEqual, nil) | ||
So(string(vx.([]byte)), ShouldEqual, `[1,2,3]`) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line.
// | ||
// | ||
// package main | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment ALL the example code (even blank lines)
types/strslice_test.go
Outdated
vx, err := nullStrSlice.Value() | ||
So(err, ShouldEqual, nil) | ||
So(string(vx.([]byte)), ShouldEqual, `["a","b","c"]`) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Blank line.
types/boolslice_test.go
Outdated
Convey("Given BoolSlice", t, func() { | ||
Convey("valid value", func() { | ||
v := []bool{true, false, true} | ||
nullBoolSlice := BoolSlice(v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why using nullBoolSlice in every tests, even when there is no involved null/nil values ?
(same for all tests of all new types).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first I also added Null*
types to these new types, but that was redundant as slices can be nil
. Those null...
named variables are spoils from that try. All "null
" can be renamed to "v
" so it will become for example vBoolSlice
for BoolSlice
. Thanks.
Added
Int64Slice,Float64Slice,BoolSlice
andStrSlice
totypes
package.StrSlice
converts[]string{"a","b","c"}
to JSON bytes["a","b","c"]
which can be saved toBLOB, VARCHAR, TEXT
. And when it reads["a","b","c"]
from DB, it converts to[]string{"a","b","c"}
Int64Slice
converts[]int64{1,2,3}
to JSON bytes[1,2,3]
which can be saved toBLOB, VARCHAR, TEXT
. And when it reads[1,2,3]
from DB, it converts to[]int64{1,2,3}
Float64Slice
converts[]float64{1.1,2.2,3.3}
to JSON bytes[1.1,2.2,3.3]
which can be saved toBLOB, VARCHAR, TEXT
. And when it reads[1.1,2.2,3.3]
from DB, it converts to[]float64{1.1,2.2,3.3}
Bool64Slice
converts[]bool{true,false,true}
to JSON bytes[true,false,true]
which can be saved toBLOB, VARCHAR, TEXT
. And when it reads[true,false,true]
from DB, it converts to[]bool{true,false,true}
Each can be nil also.
Closes #28