fmutil

package
v0.0.0-...-c5b316a Latest Latest
Warning

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

Go to latest
Published: May 10, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsBool

func AsBool(v any, defs ...bool) bool

func AsFloat64

func AsFloat64(n any, defs ...float64) float64

func AsInt64

func AsInt64(n any, defs ...int64) int64

func AsString

func AsString(v any, defs ...string) string

func BuildUrl

func BuildUrl(base, path string, params Map) string

func Def

func Def[T any](defArgs []T, def T) (ret T)

func DefZero

func DefZero[T any](defArgs []T) (ret T)

func If

func If[T any](v bool, t, f T) T

func IfZero

func IfZero[T any](v T, def T) (ret T)

func JsonEncode

func JsonEncode(v any) []byte

func JsonEncodeString

func JsonEncodeString(v any) string

func MustNoError

func MustNoError(err error, msgArgs ...any)

func MustNoError2

func MustNoError2(_ any, err error, msgArgs ...any)

func MustTrue

func MustTrue(v bool, msg string, args ...any)

func Panic

func Panic(msg string, args ...any)

func Ptr

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

func SqlDatetime

func SqlDatetime(t *time.Time) string

Types

type AnyJsonDataProvider

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

func (*AnyJsonDataProvider) JsonData

func (a *AnyJsonDataProvider) JsonData() any

type JsonDataProvider

type JsonDataProvider interface {
	JsonData() any
}

func AsJsonDataProvider

func AsJsonDataProvider(v any) JsonDataProvider

type JsonValue

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

func JsonDecodeBytesWithError

func JsonDecodeBytesWithError(buf []byte) (*JsonValue, error)

func JsonDecodeReader

func JsonDecodeReader(r io.Reader) (*JsonValue, error)

func JsonDecodeString

func JsonDecodeString(s string) *JsonValue

func (*JsonValue) AsFloat64

func (jv *JsonValue) AsFloat64(defs ...float64) float64

func (*JsonValue) AsInt64

func (jv *JsonValue) AsInt64(defs ...int64) int64

func (*JsonValue) AsInterface

func (jv *JsonValue) AsInterface() any

func (*JsonValue) AsMap

func (jv *JsonValue) AsMap() Map

func (*JsonValue) AsString

func (jv *JsonValue) AsString(defs ...string) string

func (*JsonValue) Get

func (jv *JsonValue) Get(key string) *JsonValue

func (*JsonValue) GetInt64

func (jv *JsonValue) GetInt64(key string, defs ...int64) int64

func (*JsonValue) GetString

func (jv *JsonValue) GetString(key string, defs ...string) string

func (*JsonValue) JsonData

func (jv *JsonValue) JsonData() any

type Map

type Map map[string]any

func (Map) GetBool

func (m Map) GetBool(key string, defs ...bool) bool

func (Map) GetInt64

func (m Map) GetInt64(key string, defs ...int64) int64

func (Map) GetString

func (m Map) GetString(key string, defs ...string) string

func (Map) JsonData

func (m Map) JsonData() any

Jump to

Keyboard shortcuts

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