protosql

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoolMarshaller

type BoolMarshaller struct {
	*wrapperspb.BoolValue
}

BoolMarshaller marshals a wrapped *wrapperspb.BoolValue value, inserting null if the pointer is null, or the inner value if it is not.

func Bool added in v0.2.1

func Bool(wrapper *wrapperspb.BoolValue) BoolMarshaller

Bool returns a BoolMarshaller with an inner value set to wrapper.

func (*BoolMarshaller) Scan

func (value *BoolMarshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (BoolMarshaller) Value

func (value BoolMarshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type BytesMarshaller

type BytesMarshaller struct {
	*wrapperspb.BytesValue
}

BytesMarshaller marshals a wrapped *wrapperspb.BytesValue value, inserting null if the pointer is null, or the inner value if it is not.

func Bytes added in v0.2.1

func Bytes(wrapper *wrapperspb.BytesValue) BytesMarshaller

Bytes returns a BytesMarshaller with an inner value set to wrapper.

func (*BytesMarshaller) Scan

func (value *BytesMarshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (BytesMarshaller) Value

func (value BytesMarshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type DoubleMarshaller

type DoubleMarshaller struct {
	*wrapperspb.DoubleValue
}

DoubleMarshaller marshals a wrapped *wrapperspb.DoubleValue value, inserting null if the pointer is null, or the inner value if it is not.

func Double added in v0.2.1

func Double(wrapper *wrapperspb.DoubleValue) DoubleMarshaller

Double returns a DoubleMarshaller with an inner value set to wrapper.

func (*DoubleMarshaller) Scan

func (value *DoubleMarshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (DoubleMarshaller) Value

func (value DoubleMarshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type EnumStringMarshaller

type EnumStringMarshaller struct {
	// Enum is the value to encode as a string when marshalling.
	//
	// When unmarshalling, this field must contain a value of the desired Enum type
	// to receive.
	Enum protoEnum
}

EnumStringMarshaller marshals and unmarshalls a string for sql db values.

func Enum

func Enum(enumVal protoEnum) *EnumStringMarshaller

Enum creates a new EnumStringMarshaller for marshalling or unmarshalling protobuf enums to and from strings.

To unmarshal an enum, a concrete value of the TYPE of enum you are expecting must be provided. This inner value will be nilled if the db passed back a null value.

When marshalling, if enumVal is nil, a NULL value will be added to the database.

func (*EnumStringMarshaller) Scan

func (enum *EnumStringMarshaller) Scan(src interface{}) error

Scan received a string value from the database and transforms it into a new value.

func (EnumStringMarshaller) Value

func (enum EnumStringMarshaller) Value() (driver.Value, error)

Value encodes the protobuf Enum to a string.

type FloatMarshaller

type FloatMarshaller struct {
	*wrapperspb.FloatValue
}

FloatMarshaller marshals a wrapped *wrapperspb.FloatValue value, inserting null if the pointer is null, or the inner value if it is not.

func Float added in v0.2.1

func Float(wrapper *wrapperspb.FloatValue) FloatMarshaller

Float returns a FloatMarshaller with an inner value set to wrapper.

func (*FloatMarshaller) Scan

func (value *FloatMarshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (FloatMarshaller) Value

func (value FloatMarshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type Int32Marshaller

type Int32Marshaller struct {
	*wrapperspb.Int32Value
}

Int32Marshaller marshals a wrapped *wrapperspb.Int32Value value, inserting null if the pointer is null, or the inner value if it is not.

func Int32 added in v0.2.1

func Int32(wrapper *wrapperspb.Int32Value) Int32Marshaller

Int32 returns a Int32Marshaller with an inner value set to wrapper.

func (*Int32Marshaller) Scan

func (value *Int32Marshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (Int32Marshaller) Value

func (value Int32Marshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type Int64Marshaller

type Int64Marshaller struct {
	*wrapperspb.Int64Value
}

Int64Marshaller marshals a wrapped *wrapperspb.Int64Value value, inserting null if the pointer is null, or the inner value if it is not.

func Int64 added in v0.2.1

func Int64(wrapper *wrapperspb.Int64Value) Int64Marshaller

Int64 returns a Int64Marshaller with an inner value set to wrapper.

func (*Int64Marshaller) Scan

func (value *Int64Marshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (Int64Marshaller) Value

func (value Int64Marshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type MessageBlobMarshaller added in v0.2.2

type MessageBlobMarshaller struct {
	proto.Message
}

MessageBlobMarshaller marshals a proto message to a blob and back for storing protobufs directly to a blob field.

func Message added in v0.2.2

func Message(message proto.Message) *MessageBlobMarshaller

Message creates a new MessageBlobMarshaller for storing / reading an entire protobuf message to / from a blob field.

func (*MessageBlobMarshaller) Scan added in v0.2.2

func (message *MessageBlobMarshaller) Scan(src interface{}) error

Scan converts the value from time.Time for the sql driver to handle.

func (MessageBlobMarshaller) Value added in v0.2.2

func (message MessageBlobMarshaller) Value() (driver.Value, error)

Value converts the value to a blob ([]byte) value for the sql driver to handle

type StringMarshaller

type StringMarshaller struct {
	*wrapperspb.StringValue
}

StringMarshaller marshals a wrapped *wrapperspb.StringValue value, inserting null if the pointer is null, or the inner value if it is not.

func String added in v0.2.1

func String(wrapper *wrapperspb.StringValue) StringMarshaller

String returns a StringMarshaller with an inner value set to wrapper.

func (*StringMarshaller) Scan

func (value *StringMarshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (StringMarshaller) Value

func (value StringMarshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type TimestampMarshaller

type TimestampMarshaller struct {
	*timestamppb.Timestamp
}

TimestampMarshaller wraps a *timestamppb.Timestamp value for marshalling to an SQL database.

func Timestamp added in v0.2.1

func Timestamp(value *timestamppb.Timestamp) TimestampMarshaller

Timestamp creates a new TimestampMarshaller for a given value

func (*TimestampMarshaller) Scan

func (timestamp *TimestampMarshaller) Scan(src interface{}) error

Scan converts the value from time.Time for the sql driver to handle.

func (TimestampMarshaller) Value

func (timestamp TimestampMarshaller) Value() (driver.Value, error)

Value converts the value to a time.Time value for the sql driver to handle

type UInt32Marshaller

type UInt32Marshaller struct {
	*wrapperspb.UInt32Value
}

UInt32Marshaller marshals a wrapped *wrapperspb.UInt32Value value, inserting null if the pointer is null, or the inner value if it is not.

func UInt32 added in v0.2.1

func UInt32(wrapper *wrapperspb.UInt32Value) UInt32Marshaller

UInt32 returns a UInt32Marshaller with an inner value set to wrapper.

func (*UInt32Marshaller) Scan

func (value *UInt32Marshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (UInt32Marshaller) Value

func (value UInt32Marshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type UInt64Marshaller

type UInt64Marshaller struct {
	*wrapperspb.UInt64Value
}

UInt64Marshaller marshals a wrapped *wrapperspb.UInt64Value value, inserting null if the pointer is null, or the inner value if it is not.

func UInt64 added in v0.2.1

func UInt64(wrapper *wrapperspb.UInt64Value) UInt64Marshaller

UInt64 returns a UInt64Marshaller with an inner value set to wrapper.

func (*UInt64Marshaller) Scan

func (value *UInt64Marshaller) Scan(src interface{}) error

Scan converts a value from the database.

func (UInt64Marshaller) Value

func (value UInt64Marshaller) Value() (driver.Value, error)

Value converts the value to a database-friendly format, or nil if the inner value is nil.

type UUIDHexMarshaller

type UUIDHexMarshaller struct {
	*cereal.UUID
}

UUIDHexMarshaller wraps *cereal.UUID and marshals to a hex-string format.

func UUIDHex added in v0.2.1

func UUIDHex(uuid *cereal.UUID) UUIDHexMarshaller

UUIDHex creates a new hex string marshaller for cereal.UUID values.

func (*UUIDHexMarshaller) Scan

func (uuid *UUIDHexMarshaller) Scan(src interface{}) error

func (UUIDHexMarshaller) Value

func (uuid UUIDHexMarshaller) Value() (driver.Value, error)

Value converts the value to a time.Time value for the sql driver to handle

Jump to

Keyboard shortcuts

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