MCPcopy
hub / github.com/grpc-ecosystem/grpc-gateway / Bytes

Function Bytes

runtime/convert.go:181–190  ·  view source on GitHub ↗

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

(val string)

Source from the content-addressed store, hash-verified

179// Bytes converts the given string representation of a byte sequence into a slice of bytes
180// A bytes sequence is encoded in URL-safe base64 without padding
181func Bytes(val string) ([]byte, error) {
182 b, err := base64.StdEncoding.DecodeString(val)
183 if err != nil {
184 b, err = base64.URLEncoding.DecodeString(val)
185 if err != nil {
186 return nil, err
187 }
188 }
189 return b, nil
190}
191
192// BytesSlice converts 'val' where individual bytes sequences, encoded in URL-safe
193// base64 without padding, are separated by 'sep' into a slice of byte slices.

Callers 4

BytesSliceFunction · 0.85
BytesValueFunction · 0.85
parseFieldFunction · 0.85
parseMessageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected