types

package
v0.0.0-...-ec844c3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONBBoolObject

type JSONBBoolObject map[string]bool

func (JSONBBoolObject) GormDBDataType

func (s JSONBBoolObject) GormDBDataType(db *gorm.DB, _ *schema.Field) string

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

func (JSONBBoolObject) Value

func (s JSONBBoolObject) Value() (driver.Value, error)

Value returns the json-marshaled value of 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

func (s JSONBObject) GormDBDataType(db *gorm.DB, field *schema.Field) string

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.

func (JSONBObject) Value

func (s JSONBObject) Value() (driver.Value, error)

Value returns the json-marshaled value of the receiver

type JSONUntypedObject

type JSONUntypedObject map[string]any

func (JSONUntypedObject) GormDBDataType

func (s JSONUntypedObject) GormDBDataType(db *gorm.DB, _ *schema.Field) string

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

func (JSONUntypedObject) Value

func (s JSONUntypedObject) Value() (driver.Value, error)

Value returns the json-marshaled value of 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL