shtypes

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package shtypes container wrappers for handling JSON types that may or may not be weird e.g.: numbers as strings or numbers, bools as anything that looks truthy it adds a little more flexibility around some of the types than the json.Number and related classes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolToInt

func BoolToInt(b bool) int

BoolToInt simple formatter for mapping a bool to a 1 or a zero.

Types

type MaybeBigInt

type MaybeBigInt int64

MaybeBigInt is a simple wrapper unmarshalling json responses that could be either an int or an int in a string.

func (*MaybeBigInt) UnmarshalJSON

func (fi *MaybeBigInt) UnmarshalJSON(b []byte) error

UnmarshalJSON is a helper interface for dealing with numbers that may be returned in json responses as either a string with a number in it or numbers.

type MaybeBool

type MaybeBool bool

MaybeBool is a simple wrapper unmarshalling json responses that could be either an int or an int in a string.

func (*MaybeBool) UnmarshalJSON

func (fi *MaybeBool) UnmarshalJSON(b []byte) error

UnmarshalJSON is a helper interface for dealing with things that may or may not be a string representing a bool, or number representing a bool.

type MaybeString

type MaybeString string

MaybeString is for things that may or may not be strings, but should be represented as a string.

func (*MaybeString) UnmarshalJSON

func (fi *MaybeString) UnmarshalJSON(b []byte) error

UnmarshalJSON is a helper interface for dealing with numbers that should be strings, but sometimes come through as number.

Jump to

Keyboard shortcuts

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