Skip to content

Commit

Permalink
Fix broken redirection for nulls (#427)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislas-m committed Aug 26, 2019
1 parent e7efc96 commit 5755dac
Show file tree
Hide file tree
Showing 14 changed files with 62 additions and 14 deletions.
6 changes: 5 additions & 1 deletion nulls/bool.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// Bool replaces sql.NullBool with an implementation
// that supports proper JSON encoding/decoding.
type Bool nulls.Bool
//
// Deprecated: use github.com/gobuffalo/nulls#Bool instead.
type Bool = nulls.Bool

// NewBool returns a new, properly instantiated
// Bool object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewBool instead.
var NewBool = nulls.NewBool
6 changes: 5 additions & 1 deletion nulls/byte_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// ByteSlice adds an implementation for []byte
// that supports proper JSON encoding/decoding.
type ByteSlice nulls.ByteSlice
//
// Deprecated: use github.com/gobuffalo/nulls#ByteSlice instead.
type ByteSlice = nulls.ByteSlice

// NewByteSlice returns a new, properly instantiated
// ByteSlice object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewByteSlice instead.
var NewByteSlice = nulls.NewByteSlice
6 changes: 5 additions & 1 deletion nulls/float32.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// Float32 adds an implementation for float32
// that supports proper JSON encoding/decoding.
type Float32 nulls.Float32
//
// Deprecated: use github.com/gobuffalo/nulls#Float32 instead.
type Float32 = nulls.Float32

// NewFloat32 returns a new, properly instantiated
// Float32 object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewFloat32 instead.
var NewFloat32 = nulls.NewFloat32
6 changes: 5 additions & 1 deletion nulls/float64.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// Float64 replaces sql.NullFloat64 with an implementation
// that supports proper JSON encoding/decoding.
type Float64 nulls.Float64
//
// Deprecated: use github.com/gobuffalo/nulls#Float64 instead.
type Float64 = nulls.Float64

// NewFloat64 returns a new, properly instantiated
// Float64 object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewFloat64 instead.
var NewFloat64 = nulls.NewFloat64
6 changes: 5 additions & 1 deletion nulls/int.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// Int adds an implementation for int
// that supports proper JSON encoding/decoding.
type Int nulls.Int
//
// Deprecated: use github.com/gobuffalo/nulls#Int instead.
type Int = nulls.Int

// NewInt returns a new, properly instantiated
// Int object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewInt instead.
var NewInt = nulls.NewInt
6 changes: 5 additions & 1 deletion nulls/int32.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// Int32 adds an implementation for int32
// that supports proper JSON encoding/decoding.
type Int32 nulls.Int32
//
// Deprecated: use github.com/gobuffalo/nulls#Int32 instead.
type Int32 = nulls.Int32

// NewInt32 returns a new, properly instantiated
// Int object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewInt32 instead.
var NewInt32 = nulls.NewInt32
6 changes: 5 additions & 1 deletion nulls/int64.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// Int64 replaces sql.Int64 with an implementation
// that supports proper JSON encoding/decoding.
type Int64 nulls.Int64
//
// Deprecated: use github.com/gobuffalo/nulls#Int64 instead.
type Int64 = nulls.Int64

// NewInt64 returns a new, properly instantiated
// Int64 object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewInt64 instead.
var NewInt64 = nulls.NewInt64
2 changes: 1 addition & 1 deletion nulls/int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package nulls_test
import (
"testing"

"github.com/gobuffalo/nulls"
"github.com/gobuffalo/pop/nulls"
"github.com/stretchr/testify/require"
)

Expand Down
6 changes: 5 additions & 1 deletion nulls/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// String replaces sql.NullString with an implementation
// that supports proper JSON encoding/decoding.
type String nulls.String
//
// Deprecated: use github.com/gobuffalo/nulls#String instead.
type String = nulls.String

// NewString returns a new, properly instantiated
// String object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewString instead.
var NewString = nulls.NewString
6 changes: 5 additions & 1 deletion nulls/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// Time replaces sql.NullTime with an implementation
// that supports proper JSON encoding/decoding.
type Time nulls.Time
//
// Deprecated: use github.com/gobuffalo/nulls#Time instead.
type Time = nulls.Time

// NewTime returns a new, properly instantiated
// Time object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewTime instead.
var NewTime = nulls.NewTime
6 changes: 5 additions & 1 deletion nulls/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
"testing"
"time"

. "github.com/gobuffalo/nulls"
"github.com/gobuffalo/nulls"

. "github.com/gobuffalo/pop/nulls"
"github.com/gofrs/uuid"
"github.com/jmoiron/sqlx"
_ "github.com/mattn/go-sqlite3"
Expand Down Expand Up @@ -44,6 +46,8 @@ const schema = `CREATE TABLE "main"."foos" (
"uid" uuid
);`

// Ensure legacy package is still compatible with new package types.
var _ nulls.Bool = NewBool(true)
var uid, _ = uuid.NewV4()
var now = time.Now()

Expand Down
6 changes: 5 additions & 1 deletion nulls/uint32.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// UInt32 adds an implementation for int
// that supports proper JSON encoding/decoding.
type UInt32 nulls.UInt32
//
// Deprecated: use github.com/gobuffalo/nulls#UInt32 instead.
type UInt32 = nulls.UInt32

// NewUInt32 returns a new, properly instantiated
// Int object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewUInt32 instead.
var NewUInt32 = nulls.NewUInt32
6 changes: 5 additions & 1 deletion nulls/uuid.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import (

// UUID can be used with the standard sql package to represent a
// UUID value that can be NULL in the database
type UUID nulls.UUID
//
// Deprecated: use github.com/gobuffalo/nulls#UUID instead.
type UUID = nulls.UUID

// NewUUID returns a new, properly instantiated
// UUID object.
//
// Deprecated: use github.com/gobuffalo/nulls#NewUUID instead.
var NewUUID = nulls.NewUUID
2 changes: 1 addition & 1 deletion nulls/uuid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"testing"

"github.com/gobuffalo/nulls"
"github.com/gobuffalo/pop/nulls"
"github.com/gofrs/uuid"
"github.com/stretchr/testify/require"
)
Expand Down

0 comments on commit 5755dac

Please sign in to comment.