Documentation
¶
Overview ¶
Package encode provides value encoders for go.pact.im/x/phcformat package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Appender ¶
type Appender interface { // Append appends the encoded value to the dst and returns the resulting // slice. Append(dst []byte) []byte }
Appender represents an encodable value that uses append-style API.
type Base64 ¶
type Base64[T StringOrBytes] struct { // Data is the unencoded data. Data T }
Base64 is an Appender that encodes string or byte slice using base64.RawStdEncoding.
func NewBase64 ¶
func NewBase64[T StringOrBytes](data T) Base64[T]
NewBase64 returns a new Base64 instance.
type Concat ¶
type Concat[T, U Appender] struct { // A is the first value to append. A T // B is the second value to append. B U }
Concat is an Appender that concatenates two values.
type KV ¶
type KV[KeyAppender, SepAppender, ValAppender Appender] struct { // Key is the key in the key-value pair. Key KeyAppender // Sep is a separator that is appended between key and value. Sep SepAppender // Val is the value in the key-value pair. Val ValAppender }
KV is an Appender that appends a key-value pair separated with the given separator.
type List ¶
type List[SeparatorAppender, ElementAppender Appender] struct { // Separator is a separator that is appended between elements. Separator SeparatorAppender // Elements is a list of elements to append. Elements []ElementAppender }
List is an Appender that appends a list of values separated with the given separator.
type Option ¶
Option is an Appender that appends optional value if it is set.
type StringOrBytes ¶
StringOrBytes is a union of string and byte slice types.
Click to show internal directories.
Click to hide internal directories.