package encode
Import Path
go.pact.im/x/phcformat/encode (on go.dev)
Dependency Relation
imports 3 packages, and imported by 2 packages
Involved Source Files
Package encode provides value encoders for [go.pact.im/x/phcformat] package.
Package-Level Type Names (total 12, all are exported)
Appender represents an encodable value that uses append-style API.
Append appends the encoded value to the dst and returns the resulting
slice.
Base64
Byte
Bytes
Concat
Empty
KV
List
Option
String
Uint
Type Parameters:
T: StringOrBytes
Base64 is an Appender that encodes string or byte slice using
base64.RawStdEncoding.
Data is the unencoded data.
Append implements the Appender interface.
Base64 : Appender
func NewBase64[T](data T) Base64[T]
Byte is an Appender that appends a single byte.
Append implements the Appender interface.
Byte : Appender
func NewByte(c byte) Byte
Bytes is an Appender that appends byte slice.
Append implements the Appender interface.
Bytes : Appender
func NewBytes(buf []byte) Bytes
Type Parameters:
T: Appender
U: Appender
Concat is an Appender that concatenates two values.
A is the first value to append.
B is the second value to append.
Append implements the Appender interface.
Concat : Appender
func NewConcat[T, U](a T, b U) Concat[T, U]
Empty is an Appender that does nothing.
Append implements the Appender interface.
Empty : Appender
func NewEmpty() Empty
Type Parameters:
KeyAppender: Appender
SepAppender: Appender
ValAppender: Appender
KV is an Appender that appends a key-value pair separated with the given
separator.
Key is the key in the key-value pair.
Sep is a separator that is appended between key and value.
Val is the value in the key-value pair.
Append implements the Appender interface.
KV : Appender
func NewKV[KeyAppender, SepAppender, ValAppender](sep SepAppender, k KeyAppender, v ValAppender) KV[KeyAppender, SepAppender, ValAppender]
Type Parameters:
SeparatorAppender: Appender
ElementAppender: Appender
List is an Appender that appends a list of values separated with the given
separator.
Elements is a list of elements to append.
Separator is a separator that is appended between elements.
Append implements the Appender interface.
List : Appender
func NewList[SeparatorAppender, ElementAppender](sep SeparatorAppender, elements ...ElementAppender) List[SeparatorAppender, ElementAppender]
Type Parameters:
T: Appender
Option is an Appender that appends optional value if it is set.
Option option.Of[T]
Append implements the Appender interface.
Option : Appender
func NewOption[T](opt option.Of[T]) Option[T]
func go.pact.im/x/phcformat.optionAppenderWithPrefix[PrefixAppender, OptionAppender](prefix PrefixAppender, opt option.Of[OptionAppender]) Option[Concat[PrefixAppender, OptionAppender]]
String is an Appender that appends string.
Append implements the Appender interface.
String : Appender
func NewString(s string) String
StringOrBytes is a union of string and byte slice types.
Package-Level Functions (total 12, in which 11 are exported)
Type Parameters:
T: StringOrBytes
NewBase64 returns a new Base64 instance.
NewByte returns a new Byte instance.
NewBytes returns a new Bytes instance.
NewEmpty returns a new Empty instance.
Type Parameters:
KeyAppender: Appender
SepAppender: Appender
ValAppender: Appender
NewKV returns a new KV instance.
Type Parameters:
SeparatorAppender: Appender
ElementAppender: Appender
NewList returns a new List instance.
Type Parameters:
T: Appender
NewOption returns a new Option instance.
NewString returns a new String instance.
NewUint returns a new Uint instance.
Nil returns a nil Appender option.
The pages are generated with Golds v0.4.9. (GOOS=linux GOARCH=amd64)