Documentation ¶
Index ¶
- type ProtoConverter
- func (c *ProtoConverter) Error() error
- func (c *ProtoConverter) ToCheckpointState(x checkpointv1.State) model.State
- func (c *ProtoConverter) ToCheckpointv1State(state string) checkpointv1.State
- func (c *ProtoConverter) ToDoubleWrapper(x float64) *wrapperspb.DoubleValue
- func (c *ProtoConverter) ToInt32(i int) int32
- func (c *ProtoConverter) ToMetricGroup(x apiv1.MetricType) model.MetricGroup
- func (c *ProtoConverter) ToStringList(x []uuid.UUID) []string
- func (c *ProtoConverter) ToStruct(x map[string]interface{}, what string) *structpb.Struct
- func (c *ProtoConverter) ToTimestamp(x time.Time) *timestamppb.Timestamp
- func (c *ProtoConverter) ToUUID(x string) uuid.UUID
- func (c *ProtoConverter) ToUUIDList(x []string) []uuid.UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProtoConverter ¶
type ProtoConverter struct {
// contains filtered or unexported fields
}
ProtoConverter just holds errors, allowing you to convert a large number of fields on a protobuf struct without checking errors until afterwards.
func (*ProtoConverter) Error ¶
func (c *ProtoConverter) Error() error
Error returns the error collected during the conversions, if any.
func (*ProtoConverter) ToCheckpointState ¶
func (c *ProtoConverter) ToCheckpointState(x checkpointv1.State) model.State
ToCheckpointState converts a proto chechkpoint state internal state representation.
func (*ProtoConverter) ToCheckpointv1State ¶
func (c *ProtoConverter) ToCheckpointv1State(state string) checkpointv1.State
ToCheckpointv1State converts a model.State string into a checkpointv1.State. TODO, rewrite, safer.
func (*ProtoConverter) ToDoubleWrapper ¶
func (c *ProtoConverter) ToDoubleWrapper(x float64) *wrapperspb.DoubleValue
ToDoubleWrapper converts a float64 to a double wrapper.
func (*ProtoConverter) ToInt32 ¶
func (c *ProtoConverter) ToInt32(i int) int32
ToInt32 converts an int to an int32.
func (*ProtoConverter) ToMetricGroup ¶
func (c *ProtoConverter) ToMetricGroup(x apiv1.MetricType) model.MetricGroup
ToMetricGroup converts a proto metric group to internal metric group representation.
func (*ProtoConverter) ToStringList ¶
func (c *ProtoConverter) ToStringList(x []uuid.UUID) []string
ToStringList converts a list of uuid.UUIDs to list of strings.
func (*ProtoConverter) ToStruct ¶
func (c *ProtoConverter) ToStruct(x map[string]interface{}, what string) *structpb.Struct
ToStruct converts a model.JSONObj-like type into a structpb.Struct type, remembering the error if any is encountered.
func (*ProtoConverter) ToTimestamp ¶
func (c *ProtoConverter) ToTimestamp(x time.Time) *timestamppb.Timestamp
ToTimestamp converts a time.Time into a timestamppb.Timestamp.
func (*ProtoConverter) ToUUID ¶
func (c *ProtoConverter) ToUUID(x string) uuid.UUID
ToUUID converts a string to a uuid.UUID.
func (*ProtoConverter) ToUUIDList ¶
func (c *ProtoConverter) ToUUIDList(x []string) []uuid.UUID
ToUUIDList converts a list of strings to a list of uuid.UUIDs.