resp

package
v0.1.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

type Field struct {
	// contains filtered or unexported fields
}

A Field contains metadata about a JSON field that was unmarshalled from a response.

To check if the field was unmarshalled successfully, use the Field.IsPresent method.

Use the Field.IsExplicitNull method to check if the JSON value is "null".

If the Field.Raw is the empty string, then the field was omitted.

Otherwise, if the field was invalid and couldn't be marshalled successfully, Field.IsPresent will be false, and Field.Raw will not be empty.

func NewInvalidField

func NewInvalidField(raw string) Field

func NewNullField

func NewNullField() Field

func NewValidField

func NewValidField(raw string) Field

func (Field) IsExplicitNull

func (j Field) IsExplicitNull() bool

Returns true if the field is the JSON value "null".

func (Field) IsPresent

func (j Field) IsPresent() bool

IsPresent returns true if the field was unmarshalled successfully. If IsPresent is false, the field was either omitted, the JSON value "null", or an unexpected type.

func (Field) Raw

func (j Field) Raw() string

Returns the raw JSON value of the field.

Jump to

Keyboard shortcuts

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