utils

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterOptionAbsent added in v0.0.3

func FilterOptionAbsent[T any](item mo.Option[T], _ int) bool

func FilterOptionPresent added in v0.0.3

func FilterOptionPresent[T any](item mo.Option[T], _ int) bool

func FromMap

func FromMap[T any, MK comparable, MV any](m map[MK]MV) (*T, error)

func FromString

func FromString[T any](str string) (T, error)

func FromStringOrEmpty

func FromStringOrEmpty[T any](str string) T

func GetByJSONPath

func GetByJSONPath[T any](input any, template string) T

func GetByJSONPathWithoutConvert

func GetByJSONPathWithoutConvert(input any, template string) (string, error)

func IsNumber

func IsNumber(str string) bool

func MapOptionMust added in v0.0.3

func MapOptionMust(item mo.Option[error], _ int) error

func MapOptionOrEmpty added in v0.0.3

func MapOptionOrEmpty[T any](item mo.Option[T], _ int) T

func MapOptionsPresent added in v0.0.3

func MapOptionsPresent[T any](items []mo.Option[T]) []T

func NewJSONResponseError added in v0.1.0

func NewJSONResponseError(statusCode int, responseBody io.Reader) mo.Result[*JSONResponseError]

func NewTextResponseError added in v0.1.0

func NewTextResponseError(statusCode int, responseBody io.Reader) mo.Result[*TextResponseError]

func ReadAsJSON

func ReadAsJSON(reader io.Reader) (*bytes.Buffer, map[string]any, error)

func ReadAsJSONWithClose

func ReadAsJSONWithClose(readCloser io.ReadCloser) (*bytes.Buffer, map[string]any, error)

func ResultToOption added in v0.0.3

func ResultToOption[T any](item mo.Result[T]) mo.Option[T]

Types

type JSONResponseError added in v0.1.0

type JSONResponseError struct {
	StatusCode int    `json:"status_code"`
	Message    string `json:"message"`
	// contains filtered or unexported fields
}

func (*JSONResponseError) Error added in v0.1.0

func (r *JSONResponseError) Error() string

type TextResponseError added in v0.1.0

type TextResponseError struct {
	StatusCode int    `json:"status_code"`
	Body       string `json:"body"`
}

func (*TextResponseError) Error added in v0.1.0

func (r *TextResponseError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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