json

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	Decode(v any) error  // Decode reads the next JSON-encoded value from its input and stores it in the value pointed to by v.
	Buffered() io.Reader // Buffered returns a reader of the data remaining in the Decoder's buffer. The reader is valid until the next call to Decode.
}

type Encoder

type Encoder interface {
	Encode(v any) error
}

type GoJson

type GoJson struct{}

func (GoJson) Marshal

func (GoJson) Marshal(v any) ([]byte, error)

func (GoJson) MarshalIndent

func (GoJson) MarshalIndent(v any, prefix string, indent string) ([]byte, error)

func (GoJson) NewDecoder

func (GoJson) NewDecoder(r io.Reader) Decoder

func (GoJson) NewEncoder

func (GoJson) NewEncoder(w io.Writer) Encoder

func (GoJson) Unmarshal

func (GoJson) Unmarshal(buf []byte, v any) error

type Jet

type Jet struct{}

func (Jet) Marshal

func (Jet) Marshal(v any) ([]byte, error)

func (Jet) MarshalIndent

func (Jet) MarshalIndent(v any, prefix string, indent string) ([]byte, error)

func (Jet) NewDecoder

func (Jet) NewDecoder(r io.Reader) Decoder

func (Jet) NewEncoder

func (Jet) NewEncoder(w io.Writer) Encoder

func (Jet) Unmarshal

func (Jet) Unmarshal(buf []byte, v any) error

type Json

type Json interface {
	Marshal(v any) ([]byte, error)
	MarshalIndent(v any, prefix string, indent string) ([]byte, error)
	Unmarshal(buf []byte, v any) error
	NewEncoder(w io.Writer) Encoder
	NewDecoder(r io.Reader) Decoder
}

The Json interface is used to customize the json handler. Five wrappers are provided by default. For detailed documentation, see: https://pkg.go.dev/github.com/3JoB/telebot/json.

Some methods use the default go-json because they are not under *Bot.

func NewGoJson

func NewGoJson() Json

func NewJet

func NewJet() Json

Since Jet only has the Marshal method, all other methods are still provided by go-json as is.

func NewOjg

func NewOjg() Json

func NewSonic

func NewSonic() Json

func NewStd

func NewStd() Json

type Ojg

type Ojg struct{}

func (Ojg) Marshal

func (Ojg) Marshal(v any) ([]byte, error)

func (Ojg) MarshalIndent

func (Ojg) MarshalIndent(v any, prefix string, indent string) ([]byte, error)

func (Ojg) NewDecoder

func (Ojg) NewDecoder(r io.Reader) Decoder

func (Ojg) NewEncoder

func (Ojg) NewEncoder(w io.Writer) Encoder

func (Ojg) Unmarshal

func (Ojg) Unmarshal(buf []byte, v any) error

type Sonic

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

func (Sonic) Marshal

func (s Sonic) Marshal(v any) ([]byte, error)

func (Sonic) MarshalIndent

func (s Sonic) MarshalIndent(v any, prefix, indent string) ([]byte, error)

func (Sonic) NewDecoder

func (s Sonic) NewDecoder(r io.Reader) Decoder

func (Sonic) NewEncoder

func (s Sonic) NewEncoder(w io.Writer) Encoder

func (Sonic) Unmarshal

func (s Sonic) Unmarshal(buf []byte, v any) error

type Std

type Std struct{}

func (Std) Marshal

func (Std) Marshal(v any) ([]byte, error)

func (Std) MarshalIndent

func (Std) MarshalIndent(v any, prefix string, indent string) ([]byte, error)

func (Std) NewDecoder

func (Std) NewDecoder(r io.Reader) Decoder

func (Std) NewEncoder

func (Std) NewEncoder(w io.Writer) Encoder

func (Std) Unmarshal

func (Std) Unmarshal(buf []byte, v any) error

Jump to

Keyboard shortcuts

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