Documentation ¶
Index ¶
- type PBJSON
- func (o PBJSON[T]) IsValid() bool
- func (o PBJSON[T]) MarshalJSON() ([]byte, error)
- func (o PBJSON[T]) MarshalText() ([]byte, error)
- func (o *PBJSON[T]) Scan(value interface{}) error
- func (o *PBJSON[T]) UnmarshalJSON(data []byte) error
- func (o *PBJSON[T]) UnmarshalText(text []byte) error
- func (o PBJSON[T]) Value() (driver.Value, error)
- type PBO
- func (o PBO[T]) IsValid() bool
- func (o PBO[T]) MarshalJSON() ([]byte, error)
- func (o PBO[T]) MarshalText() ([]byte, error)
- func (o *PBO[T]) Scan(value interface{}) error
- func (o *PBO[T]) UnmarshalJSON(data []byte) error
- func (o *PBO[T]) UnmarshalText(text []byte) error
- func (o PBO[T]) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PBJSON ¶
PBJSON represents a protojson message of a specific type, controlled by the generic type parameter.
Note that this handles NULL in postgres separately from an empty protobuf object. A NULL column value will be represented with a false value for the Valid field.
func PBJSONFrom ¶
PBJSONFrom creates a new PBJSON from a valid protobuf object.
Note that proto.Message is inherently a pointer to a protobuf object and thus can be nil, but golang's type system isn't smart enough to allow nil checks against the generic type since it can't guarantee it's a pointer. As such, we have to resort to a lousy reflect check.
func (PBJSON[T]) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (PBJSON[T]) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*PBJSON[T]) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*PBJSON[T]) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
type PBO ¶
PBO represents a protobuf message of a specific type, controlled by the generic type parameter.
Note that this handles NULL in postgres separately from an empty protobuf object. A NULL column value will be represented with a false value for the Valid field.
func PBOFrom ¶
PBOFrom creates a new PBO from a valid protobuf object.
Note that proto.Message is inherently a pointer to a protobuf object and thus can be nil, but golang's type system isn't smart enough to allow nil checks against the generic type since it can't guarantee it's a pointer. As such, we have to resort to a lousy reflect check.
func (PBO[T]) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (PBO[T]) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*PBO[T]) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*PBO[T]) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.