Documentation ¶
Overview ¶
Package encoding implements the cloudstate Any encoding support.
Index ¶
- Constants
- Variables
- func Bool(b bool) *any.Any
- func Bytes(b []byte) *any.Any
- func DecodeBool(a *any.Any) bool
- func DecodeBytes(a *any.Any) []byte
- func DecodeFloat32(a *any.Any) float32
- func DecodeFloat64(a *any.Any) float64
- func DecodeInt32(a *any.Any) int32
- func DecodeInt64(a *any.Any) int64
- func DecodeString(a *any.Any) string
- func DecodeStruct(a *any.Any, s interface{}) error
- func Float32(f float32) *any.Any
- func Float64(f float64) *any.Any
- func Int32(i int32) *any.Any
- func Int64(i int64) *any.Any
- func JSON(value interface{}) (*any.Any, error)
- func MarshalAny(pb interface{}) (*any.Any, error)
- func MarshalJSON(value interface{}) (*any.Any, error)
- func MarshalPrimitive(i interface{}) (*any.Any, error)
- func String(s string) *any.Any
- func StringMust(s string) *any.Any
- func Struct(s interface{}) (*any.Any, error)
- func UnmarshalAny(x *any.Any, p proto.Message) error
- func UnmarshalJSON(any *any.Any, target interface{}) error
- func UnmarshalPrimitive(any *any.Any) (interface{}, error)
- type AnyDecFunc
- type AnyEncFunc
Constants ¶
View Source
const ( PrimitiveTypeURLPrefix = "p.cloudstate.io" ProtoAnyBase = "type.googleapis.com" PrimitiveTypeURLPrefixInt32 = PrimitiveTypeURLPrefix + "/int32" PrimitiveTypeURLPrefixInt64 = PrimitiveTypeURLPrefix + "/int64" PrimitiveTypeURLPrefixString = PrimitiveTypeURLPrefix + "/string" PrimitiveTypeURLPrefixFloat = PrimitiveTypeURLPrefix + "/float" PrimitiveTypeURLPrefixDouble = PrimitiveTypeURLPrefix + "/double" PrimitiveTypeURLPrefixBool = PrimitiveTypeURLPrefix + "/bool" PrimitiveTypeURLPrefixBytes = PrimitiveTypeURLPrefix + "/bytes" )
View Source
const (
JSONTypeURLPrefix = "json.cloudstate.io"
)
Variables ¶
View Source
var Empty, _ = MarshalAny(&empty.Empty{})
View Source
var ErrMarshal = errors.New("unable to marshal a message")
View Source
var ErrNotMarshalled = errors.New("not marshalled")
View Source
var ErrNotUnmarshalled = errors.New("not unmarshalled")
Functions ¶
func DecodeBool ¶ added in v0.2.0
func DecodeBytes ¶ added in v0.2.0
func DecodeFloat32 ¶ added in v0.2.0
func DecodeFloat64 ¶ added in v0.2.0
func DecodeInt32 ¶ added in v0.2.0
func DecodeInt64 ¶ added in v0.2.0
func DecodeString ¶ added in v0.2.0
func DecodeStruct ¶ added in v0.2.0
func MarshalAny ¶ added in v0.2.0
MarshalAny marshals a proto.Message to an any.Any value.
func MarshalJSON ¶
MarshalJSON encodes a struct type into its Cloudstate Any JSON value.
func MarshalPrimitive ¶
func StringMust ¶ added in v0.2.0
func UnmarshalJSON ¶
UnmarshalPrimitive decodes a Cloudstate Any protobuf message into its JSON value.
func UnmarshalPrimitive ¶
UnmarshalPrimitive decodes a CloudState Any proto message into its primitive value.
Types ¶
type AnyDecFunc ¶ added in v0.2.0
type AnyEncFunc ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.