rfc8259naturalnumber

package
v0.0.0-...-e93dbfa Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(runescanner io.RuneScanner, dst *NaturalNumber) error

Parse tries to parse a JSON natural-number literal. If it succeeds, then it return nil, and sets ‘dst’ to the parsed value. If it failed, it returns an error.

Example usage:

var rs io.RuneScaner

// ...

var value rfc8259naturalnumber.NaturalNumber
err := rfc8259naturalnumber.Parse(rs, &value)

if nil != err {
	return err
}

fmt.Printf("value = %#v\n", value)

Types

type NaturalNumber

type NaturalNumber struct {
	opt.Optional[string]
}

NaturalNumber represents the numbers: ..., -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7,....

I.e., the set of positive-integers, negative-integers, and zero.

From IETF RFC-8259 NaturalNumber represents the following:

[ minus ] int

This is part of the definition of:

number = [ minus ] int [ frac ] [ exp ]

Since a NaturalNumber is a common usage of a JSON number, NaturalNumber exists.

func NegativeOne

func NegativeOne() NaturalNumber

func Nothing

func Nothing() NaturalNumber

func One

func One() NaturalNumber

func Something

func Something(value string) NaturalNumber

func Zero

func Zero() NaturalNumber

func (NaturalNumber) GoString

func (receiver NaturalNumber) GoString() string

Jump to

Keyboard shortcuts

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