Documentation
¶
Index ¶
- type JSONBBoolObject
- type JSONBObject
- func (s JSONBObject) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (s *JSONBObject) Map(target any) error
- func (s *JSONBObject) MarshalJSON() ([]byte, error)
- func (s *JSONBObject) Scan(value any) error
- func (s *JSONBObject) UnmarshalJSON(data []byte) error
- func (s JSONBObject) Value() (driver.Value, error)
- type JSONUntypedObject
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JSONBBoolObject ¶
func (JSONBBoolObject) GormDBDataType ¶
GormDBDataType returns JSONB if postgres, otherwise panics due to lack of DB type support
func (*JSONBBoolObject) Scan ¶
func (s *JSONBBoolObject) Scan(value any) error
Scan parses the input value (expected to be JSON) to []byte and then attempts to unmarshal it into the receiver
type JSONBObject ¶
type JSONBObject struct {
Object any
// contains filtered or unexported fields
}
func NewJSONBObject ¶
func NewJSONBObject(object any) (JSONBObject, error)
func (JSONBObject) GormDBDataType ¶
GormDBDataType returns JSONB if postgres, otherwise panics due to lack of DB type support
func (*JSONBObject) Map ¶
func (s *JSONBObject) Map(target any) error
Map maps the value of the JSON blob onto the given interface
func (*JSONBObject) MarshalJSON ¶
func (s *JSONBObject) MarshalJSON() ([]byte, error)
The raw byte slice is stored in the object, so only return that part of the object and let the json lib take over from there. This prevents the value from being returned under the Object attribute.
func (*JSONBObject) Scan ¶
func (s *JSONBObject) Scan(value any) error
Scan parses the input value (expected to be JSON) to []byte and then attempts to unmarshal it into the receiver
func (*JSONBObject) UnmarshalJSON ¶
func (s *JSONBObject) UnmarshalJSON(data []byte) error
Override default unmarshal behavior to save raw data in scannedBytes and to put the unmarshalled value directly into Object. This works around the lack of Object attribute in the displayed JSON.
type JSONUntypedObject ¶
func (JSONUntypedObject) GormDBDataType ¶
GormDBDataType returns JSONB if postgres, otherwise panics due to lack of DB type support
func (*JSONUntypedObject) Scan ¶
func (s *JSONUntypedObject) Scan(value any) error
Scan parses the input value (expected to be JSON) to []byte and then attempts to unmarshal it into the receiver
Directories
¶
| Path | Synopsis |
|---|---|
|
Package null contains SQL types that consider zero input and null input as separate values, with convenient support for JSON and text marshaling.
|
Package null contains SQL types that consider zero input and null input as separate values, with convenient support for JSON and text marshaling. |