feat!: rework the public API to json/v2-style variadic options
Test / test (push) Successful in 1m49s
Test / test (push) Successful in 1m49s
Assisted-by: GLM 5.3 Flash
This commit is contained in:
@@ -111,12 +111,22 @@ func getEncoderBuf() *bytes.Buffer {
|
||||
return b
|
||||
}
|
||||
|
||||
// encodeConfig carries the public emission options one Marshal call applies;
|
||||
// the names and defaults are documented on the MarshalOption constructors.
|
||||
type encodeConfig struct {
|
||||
layout LayoutKind
|
||||
omitEmptyArrays bool
|
||||
literalMultilineAt int
|
||||
inlineTablesAt int
|
||||
emitFieldComments bool
|
||||
}
|
||||
|
||||
// encoder produces a TOML document from a Go value via a small intermediate
|
||||
// representation that preserves the order in which fields were declared.
|
||||
type encoder struct {
|
||||
buf *bytes.Buffer
|
||||
ctx context.Context
|
||||
opts Encoder
|
||||
opts encodeConfig
|
||||
|
||||
// inlineDepth is the nesting level inside inline tables, which decides
|
||||
// their indentation.
|
||||
@@ -329,7 +339,7 @@ type entry struct {
|
||||
type tomlDoc struct {
|
||||
entries []entry
|
||||
ctx context.Context // inherited from encoder; nil-safe
|
||||
opts Encoder // inherited from encoder; options drive emit-time behaviour
|
||||
opts encodeConfig // inherited from encoder; options drive emit-time behaviour
|
||||
depth int
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user