protoconvert

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(val string) (bool, error)

Bool converts the given string representation of a boolean value into bool.

func BoolP

func BoolP(val string) (*bool, error)

BoolP parses the given string representation of a boolean value, and returns a pointer to a bool whose value is same as the parsed value.

func BoolSlice

func BoolSlice(val, sep string) ([]bool, error)

BoolSlice converts 'val' where individual booleans are separated by 'sep' into a bool slice.

func BoolValue

func BoolValue(val string) (*wrapperspb.BoolValue, error)

BoolValue well-known type support as wrapper around bool type

func Bytes

func Bytes(val string) ([]byte, error)

Bytes converts the given string representation of a byte sequence into a slice of bytes A bytes sequence is encoded in URL-safe base64 without padding

func BytesSlice

func BytesSlice(val, sep string) ([][]byte, error)

BytesSlice converts 'val' where individual bytes sequences, encoded in URL-safe base64 without padding, are separated by 'sep' into a slice of bytes slices slice.

func BytesValue

func BytesValue(val string) (*wrapperspb.BytesValue, error)

BytesValue well-known type support as wrapper around bytes[] type

func DoubleValue

func DoubleValue(val string) (*wrapperspb.DoubleValue, error)

DoubleValue well-known type support as wrapper around float64 type

func Duration

func Duration(val string) (*durationpb.Duration, error)

Duration converts the given string into a timestamp.Duration.

func Enum

func Enum(val string, enumValMap map[string]int32) (int32, error)

Enum converts the given string into an int32 that should be type casted into the correct enum proto type.

func EnumSlice

func EnumSlice(val, sep string, enumValMap map[string]int32) ([]int32, error)

EnumSlice converts 'val' where individual enums are separated by 'sep' into a int32 slice. Each individual int32 should be type casted into the correct enum proto type.

func Float32

func Float32(val string) (float32, error)

Float32 converts the given string representation of a floating point number into float32.

func Float32P

func Float32P(val string) (*float32, error)

Float32P parses the given string representation of a floating point number, and returns a pointer to a float32 whose value is same as the parsed number.

func Float32Slice

func Float32Slice(val, sep string) ([]float32, error)

Float32Slice converts 'val' where individual floating point numbers are separated by 'sep' into a float32 slice.

func Float64

func Float64(val string) (float64, error)

Float64 converts the given string representation into representation of a floating point number into float64.

func Float64P

func Float64P(val string) (*float64, error)

Float64P parses the given string representation of a floating point number, and returns a pointer to a float64 whose value is same as the parsed number.

func Float64Slice

func Float64Slice(val, sep string) ([]float64, error)

Float64Slice converts 'val' where individual floating point numbers are separated by 'sep' into a float64 slice.

func FloatValue

func FloatValue(val string) (*wrapperspb.FloatValue, error)

FloatValue well-known type support as wrapper around float32 type

func Int32

func Int32(val string) (int32, error)

Int32 converts the given string representation of an integer into int32.

func Int32P

func Int32P(val string) (*int32, error)

Int32P parses the given string representation of an integer and returns a pointer to a int32 whose value is same as the parsed integer.

func Int32Slice

func Int32Slice(val, sep string) ([]int32, error)

Int32Slice converts 'val' where individual integers are separated by 'sep' into a int32 slice.

func Int32Value

func Int32Value(val string) (*wrapperspb.Int32Value, error)

Int32Value well-known type support as wrapper around int32 type

func Int64

func Int64(val string) (int64, error)

Int64 converts the given string representation of an integer into int64.

func Int64P

func Int64P(val string) (*int64, error)

Int64P parses the given string representation of an integer and returns a pointer to a int64 whose value is same as the parsed integer.

func Int64Slice

func Int64Slice(val, sep string) ([]int64, error)

Int64Slice converts 'val' where individual integers are separated by 'sep' into a int64 slice.

func Int64Value

func Int64Value(val string) (*wrapperspb.Int64Value, error)

Int64Value well-known type support as wrapper around int64 type

func String

func String(val string) (string, error)

String just returns the given string. It is just for compatibility to other types.

func StringP

func StringP(val string) (*string, error)

StringP returns a pointer to a string whose pointee is same as the given string value.

func StringSlice

func StringSlice(val, sep string) ([]string, error)

StringSlice converts 'val' where individual strings are separated by 'sep' into a string slice.

func StringValue

func StringValue(val string) (*wrapperspb.StringValue, error)

StringValue well-known type support as wrapper around string type

func Timestamp

func Timestamp(val string) (*timestamppb.Timestamp, error)

Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp.

func UInt32Value

func UInt32Value(val string) (*wrapperspb.UInt32Value, error)

UInt32Value well-known type support as wrapper around uint32 type

func UInt64Value

func UInt64Value(val string) (*wrapperspb.UInt64Value, error)

UInt64Value well-known type support as wrapper around uint64 type

func Uint32

func Uint32(val string) (uint32, error)

Uint32 converts the given string representation of an integer into uint32.

func Uint32P

func Uint32P(val string) (*uint32, error)

Uint32P parses the given string representation of an integer and returns a pointer to a uint32 whose value is same as the parsed integer.

func Uint32Slice

func Uint32Slice(val, sep string) ([]uint32, error)

Uint32Slice converts 'val' where individual integers are separated by 'sep' into a uint32 slice.

func Uint64

func Uint64(val string) (uint64, error)

Uint64 converts the given string representation of an integer into uint64.

func Uint64P

func Uint64P(val string) (*uint64, error)

Uint64P parses the given string representation of an integer and returns a pointer to a uint64 whose value is same as the parsed integer.

func Uint64Slice

func Uint64Slice(val, sep string) ([]uint64, error)

Uint64Slice converts 'val' where individual integers are separated by 'sep' into a uint64 slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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