package pgtype

import (
	
	
)

type JSONB JSON

func ( *JSONB) ( interface{}) error {
	return (*JSON)().Set()
}

func ( JSONB) () interface{} {
	return (JSON)().Get()
}

func ( *JSONB) ( interface{}) error {
	return (*JSON)().AssignTo()
}

func (JSONB) () int16 {
	return TextFormatCode
}

func ( *JSONB) ( *ConnInfo,  []byte) error {
	return (*JSON)().DecodeText(, )
}

func ( *JSONB) ( *ConnInfo,  []byte) error {
	if  == nil {
		* = JSONB{Status: Null}
		return nil
	}

	if len() == 0 {
		return fmt.Errorf("jsonb too short")
	}

	if [0] != 1 {
		return fmt.Errorf("unknown jsonb version number %d", [0])
	}

	* = JSONB{Bytes: [1:], Status: Present}
	return nil

}

func (JSONB) () int16 {
	return TextFormatCode
}

func ( JSONB) ( *ConnInfo,  []byte) ([]byte, error) {
	return (JSON)().EncodeText(, )
}

func ( JSONB) ( *ConnInfo,  []byte) ([]byte, error) {
	switch .Status {
	case Null:
		return nil, nil
	case Undefined:
		return nil, errUndefined
	}

	 = append(, 1)
	return append(, .Bytes...), nil
}
Scan implements the database/sql Scanner interface.
func ( *JSONB) ( interface{}) error {
	return (*JSON)().Scan()
}
Value implements the database/sql/driver Valuer interface.
func ( JSONB) () (driver.Value, error) {
	return (JSON)().Value()
}

func ( JSONB) () ([]byte, error) {
	return (JSON)().MarshalJSON()
}

func ( *JSONB) ( []byte) error {
	return (*JSON)().UnmarshalJSON()