Documentation
¶
Index ¶
- func Equal(value1, value2 *structpb.Value) bool
- func FromProtoRecord(protoRecord *dbdata.Record) (map[string]interface{}, error)
- func FromProtoValue(protoValue *structpb.Value) (any, error)
- func ToProtoRecord(record map[string]interface{}) (*dbdata.Record, error)
- func ToProtoValue(value interface{}) (*structpb.Value, error)
- type Utils
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FromProtoRecord ¶ added in v0.0.22
fromProtoRecord converts a protobuf record to a map record. It iterates over the fields in the protobuf record, converts each protobuf value to a Go value using fromProtoValue function, and adds the converted value to the map record. It returns the converted map record and an error if the conversion of any value fails.
func FromProtoValue ¶ added in v0.0.22
fromProtoValue converts a protobuf value to a Go value. It supports conversion for protobuf string value and protobuf number value. For protobuf string value, it attempts to parse the string as an int and returns the int value if the parsing is successful. If the parsing fails, it returns the string value. For protobuf number value, it returns the number value. For other types, it directly returns the value as interface{}. It returns the converted Go value and an error if the conversion fails.
func ToProtoRecord ¶ added in v0.0.22
ToProtoRecord converts a map record to a protobuf record. It iterates over the fields in the map record, converts each Go value to a protobuf value using toProtoValue function, and adds the converted value to the protobuf record. It returns the converted protobuf record and an error if the conversion of any value fails.
func ToProtoValue ¶ added in v0.0.22
toProtoValue converts a given value to a protobuf value. It supports conversion for int, int32, int64, float32, float64 and other types that can be directly converted to a protobuf value. For int, int32 and int64, it converts the value to a string and then to a protobuf string value. For float32 and float64, it converts the value to a protobuf number value. For other types, it directly converts the value to a protobuf value. It returns the converted protobuf value and an error if the conversion fails.
Types ¶
type Utils ¶
type Utils struct {
// contains filtered or unexported fields
}
Utils is a utility structure that holds the AES key.
func NewUtils ¶
NewUtils creates a new Utils instance with the AES key from the environment variable. The AES key must be exactly 32 bytes (256 bits) long.