body

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package body parses and composes the request body for write operations.

Two baseline sources (mutually exclusive), then field-flag overlay:

  1. --file <path> baseline JSON read from a file ("-" = stdin)
  2. --json <inline> baseline JSON given inline on the command line
  3. --<field> / --<a>.<b> structured field flags overlay on top of the baseline

The result is a Go value ready to hand off to the HTTP client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compose

func Compose(baseline interface{}, fields map[string]string) (interface{}, error)

Compose merges baseline (from --file/--json) with structured field flags. Field flag values override baseline fields at matching dot-paths. Field values are JSON-parsed when possible (numbers, booleans, arrays, objects) so callers can pass typed scalars; otherwise the value is treated as a string.

Returns nil when the resulting body is empty (no baseline, no flags).

func Parse

func Parse(file, inline string) (interface{}, error)

Parse converts the --file or --json argument into a Go value. Exactly one of `file` and `inline` may be non-empty (caller validates). Both empty → returns nil (caller may still merge field flags).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL