sdk

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NonNil = struct{}{}

	Errorf = fmt.Errorf

	Fprintf = fmt.Fprintf
	Printf  = func(format string, a ...any) (n int, err error) { return Fprintf(new(bytes.Buffer), format, a...) }
	Sprintf = fmt.Sprintf

	Fprint = fmt.Fprint
	Print  = func(a ...any) (n int, err error) { return Fprint(new(bytes.Buffer), a...) }
	Sprint = fmt.Sprint

	Fprintln = fmt.Fprintln
	Println  = func(a ...any) (n int, err error) { return Fprintln(new(bytes.Buffer), a...) }
	Sprintln = fmt.Sprintln

	Scan   = fmt.Scan
	Scanln = fmt.Scanln
	Scanf  = fmt.Scanf

	Sscan   = fmt.Sscan
	Sscanln = fmt.Sscanln
	Sscanf  = fmt.Sscanf

	Fscan   = fmt.Fscan
	Fscanln = fmt.Fscanln
	Fscanf  = fmt.Fscanf
)

Functions

func Apply

func Apply[T any](opt T, opts ...func(T)) T

func IfThenElse

func IfThenElse[T any](cond bool, this, that T) T

func Nop

func Nop(...any)

Nop do nothing, to let us skip the blank _

Nop(a, err)

func Ref

func Ref[T any](v T) *T

func Val

func Val[T any](v *T) T

func Yield

func Yield[T any](v T) func() T

Types

type Decoder

type Decoder interface{ Decode(v any) error }

type Encoder

type Encoder interface{ Encode(v any) error }

type ErrorWrapper

type ErrorWrapper interface {
	error
	Unwrap() error
	As(target any) bool
	Is(target error) bool
}

type Errors

type Errors []error

Errors combine multiple errors into one error.

func (Errors) Error

func (errs Errors) Error() string

func (Errors) Filter

func (errs Errors) Filter(fn func(error) bool) Errors

type Formatter

type Formatter = fmt.Formatter

type GoStringer

type GoStringer = fmt.GoStringer

type Parser

type Parser interface {
	Marshal(v any) (p []byte, err error)
	Unmarshal(p []byte, v any) (err error)
	NewEncoder(w io.Writer) Encoder
	NewDecoder(r io.Reader) Decoder
}
var (
	// JSON ...
	JSON Parser = _json{json.ConfigFastest}
	// XML ...
	XML Parser = _xml{}
	// YAML ...
	YAML Parser = _yaml{}
	// TOML ...
	TOML Parser = _toml{}
)

type ScanState

type ScanState = fmt.ScanState

type Scanner

type Scanner = fmt.Scanner

type State

type State = fmt.State

type Stringer

type Stringer = fmt.Stringer

type WrapError

type WrapError struct {
	Err error
	Msg string

	// default error string
	Redact string
}

func (*WrapError) As

func (err *WrapError) As(target any) bool

func (*WrapError) Error

func (err *WrapError) Error() string

func (*WrapError) Is

func (err *WrapError) Is(target error) bool

func (*WrapError) MarshalJSON

func (err *WrapError) MarshalJSON() ([]byte, error)

func (*WrapError) Unwrap

func (err *WrapError) Unwrap() error

type XMLName

type XMLName = xml.Name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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