Use Go casing convention for JSON(B)
This commit is contained in:
+19
-19
@@ -5,27 +5,27 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type Jsonb Json
|
||||
type JSONB JSON
|
||||
|
||||
func (dst *Jsonb) Set(src interface{}) error {
|
||||
return (*Json)(dst).Set(src)
|
||||
func (dst *JSONB) Set(src interface{}) error {
|
||||
return (*JSON)(dst).Set(src)
|
||||
}
|
||||
|
||||
func (dst *Jsonb) Get() interface{} {
|
||||
return (*Json)(dst).Get()
|
||||
func (dst *JSONB) Get() interface{} {
|
||||
return (*JSON)(dst).Get()
|
||||
}
|
||||
|
||||
func (src *Jsonb) AssignTo(dst interface{}) error {
|
||||
return (*Json)(src).AssignTo(dst)
|
||||
func (src *JSONB) AssignTo(dst interface{}) error {
|
||||
return (*JSON)(src).AssignTo(dst)
|
||||
}
|
||||
|
||||
func (dst *Jsonb) DecodeText(ci *ConnInfo, src []byte) error {
|
||||
return (*Json)(dst).DecodeText(ci, src)
|
||||
func (dst *JSONB) DecodeText(ci *ConnInfo, src []byte) error {
|
||||
return (*JSON)(dst).DecodeText(ci, src)
|
||||
}
|
||||
|
||||
func (dst *Jsonb) DecodeBinary(ci *ConnInfo, src []byte) error {
|
||||
func (dst *JSONB) DecodeBinary(ci *ConnInfo, src []byte) error {
|
||||
if src == nil {
|
||||
*dst = Jsonb{Status: Null}
|
||||
*dst = JSONB{Status: Null}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -37,16 +37,16 @@ func (dst *Jsonb) DecodeBinary(ci *ConnInfo, src []byte) error {
|
||||
return fmt.Errorf("unknown jsonb version number %d", src[0])
|
||||
}
|
||||
|
||||
*dst = Jsonb{Bytes: src[1:], Status: Present}
|
||||
*dst = JSONB{Bytes: src[1:], Status: Present}
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
func (src *Jsonb) EncodeText(ci *ConnInfo, buf []byte) ([]byte, error) {
|
||||
return (*Json)(src).EncodeText(ci, buf)
|
||||
func (src *JSONB) EncodeText(ci *ConnInfo, buf []byte) ([]byte, error) {
|
||||
return (*JSON)(src).EncodeText(ci, buf)
|
||||
}
|
||||
|
||||
func (src *Jsonb) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
|
||||
func (src *JSONB) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
|
||||
switch src.Status {
|
||||
case Null:
|
||||
return nil, nil
|
||||
@@ -59,11 +59,11 @@ func (src *Jsonb) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
// Scan implements the database/sql Scanner interface.
|
||||
func (dst *Jsonb) Scan(src interface{}) error {
|
||||
return (*Json)(dst).Scan(src)
|
||||
func (dst *JSONB) Scan(src interface{}) error {
|
||||
return (*JSON)(dst).Scan(src)
|
||||
}
|
||||
|
||||
// Value implements the database/sql/driver Valuer interface.
|
||||
func (src *Jsonb) Value() (driver.Value, error) {
|
||||
return (*Json)(src).Value()
|
||||
func (src *JSONB) Value() (driver.Value, error) {
|
||||
return (*JSON)(src).Value()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user