Documentation
¶
Index ¶
- type Encoder
- func (e *Encoder) Byte(b ...byte)
- func (e *Encoder) CloseArray()
- func (e *Encoder) CloseObject()
- func (e *Encoder) Comma()
- func (e Encoder) Error() error
- func (e *Encoder) Field(name string, val any)
- func (e *Encoder) Marshal(val any)
- func (e *Encoder) OpenArray()
- func (e *Encoder) OpenObject()
- func (e *Encoder) String(str string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder is a struct which is embedded in all generated encoders. It provides a number of helper functions to simplify generated code.
In order to keep this easy to use, we do not return an error at each step. Instead, we store the error in the `err` field, and skip future write operations if `err` is not nil. This allows us to keep performance in case of an error, but not require explicit error checks at every single step.
Errors can be checked for manually using the `Error()` method.
func NewEncoder ¶
func (*Encoder) CloseArray ¶
func (e *Encoder) CloseArray()
func (*Encoder) CloseObject ¶
func (e *Encoder) CloseObject()
func (*Encoder) OpenObject ¶
func (e *Encoder) OpenObject()
Click to show internal directories.
Click to hide internal directories.