X

package
v1.4812.1501 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 17 Imported by: 0

README

X

-- import "github.com/kokizzu/gotro/X"

Usage

func ArrToIntArr
func ArrToIntArr(any_arr []any) []int64

ArrToIntArr Convert array of any data type to array of int64

var m4 []any
m4 = []any{1}     // // tipe array
L.ParentDescribe(X.ArrToIntArr(m4)) // []int64{1}
func ArrToStrArr
func ArrToStrArr(any_arr []any) []string

ArrToStrArr convert array of any data type to array of string

var m4 []any
m4 = []any{1}     // // tipe array
L.ParentDescribe(X.ArrToStrArr(m4)) // []string{"1"}
func FromMsgp
func FromMsgp(byt []byte, v any) bool

FromMsgp convert Msgpack bytes to anything

ok := X.FromMsgp(\x81\xa1A\x01, &struct{ A int }{})

func ToAF
func ToAF(x any) []float64

ToAF convert to []float64

func ToAX
func ToAX(x any) A.X

ToAX convert to []any

func ToArr
func ToArr(x any) []any

ToArr convert any data type to array of any

var m3 any
m3 = []any{1}   // tipe array
L.ParentDescribe(X.ToArr(m3)) // []interface {}{int(1),}
func ToBool
func ToBool(any any) bool

ToBool convert any data type to bool

var m any
m = `123`
L.ParentDescribe(X.ToBool(m)) // bool(true)
func ToByte
func ToByte(x any) byte

ToByte convert any data type to int8

var m any
m = `123`
L.ParentDescribe(X.ToByte(m)) // byte(123)
func ToF
func ToF(x any) float64

ToF Convert any data type to float64

var m any
m = `123.5`
L.ParentDescribe(X.ToF(m)) // float64(123.5)
func ToI
func ToI(x any) int64

ToI convert any data type to int64

var m any
m = `123`
L.ParentDescribe(X.ToI(m)) // int64(123)
func ToJson
func ToJson(any any) string

ToJson convert to standard json text

func ToJson5
func ToJson5(x any) string

ToJson5 convert to json5

func ToJsonPretty
func ToJsonPretty(any any) string

ToJsonPretty convert to beautiful json text

m:= []interface {}{true,`1`,23,`wabcd`}
L.Print(K.ToJsonPretty(m))
// [
//   true,
//   "1",
//   23,
//   "wabcd"
// ]
func ToMSS
func ToMSS(x any) M.SS

ToMSS convert to map[string]string

func ToMSX
func ToMSX(x any) M.SX

ToMSX convert to map[string]any

func ToMsgp
func ToMsgp(v any) (res []byte)

ToMsgp convert anything to Msgpack bytes

msgpStr := X.ToMsgp(struct{ A int }{A: 1})
func ToS
func ToS(x any) string

ToS convert any data type to string

var m any
m = `123`
L.ParentDescribe(X.ToS(m)) // `123`
func ToTime
func ToTime(x any) time.Time

ToTime convert any to time

func ToU
func ToU(x any) uint64

ToU convert any data type to uint

var m any
m = `123`
L.ParentDescribe(X.ToI(m)) // uint(123)
func ToYaml
func ToYaml(any any) string

ToYaml convert to yaml text

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrToIntArr

func ArrToIntArr(any_arr []any) []int64

ArrToIntArr Convert array of any data type to array of int64

var m4 []any
m4 = []any{1}     // // tipe array
L.ParentDescribe(X.ArrToIntArr(m4)) // []int64{1}

func ArrToStrArr

func ArrToStrArr(any_arr []any) []string

ArrToStrArr convert array of any data type to array of string

var m4 []any
m4 = []any{1}     // // tipe array
L.ParentDescribe(X.ArrToStrArr(m4)) // []string{"1"}

func FromMsgp

func FromMsgp(byt []byte, v any) bool

FromMsgp convert Msgpack bytes to anything

ok := X.FromMsgp(`\x81\xa1A\x01`, &struct{ A int }{})

func ToAF

func ToAF(x any) []float64

ToAF convert to []float64

func ToAX

func ToAX(x any) A.X

ToAX convert to []any

func ToArr

func ToArr(x any) []any

ToArr convert any data type to array of any

var m3 any
m3 = []any{1}   // tipe array
L.ParentDescribe(X.ToArr(m3)) // []interface {}{int(1),}

func ToBool

func ToBool(any any) bool

ToBool convert any data type to bool

var m any
m = `123`
L.ParentDescribe(X.ToBool(m)) // bool(true)

func ToByte

func ToByte(x any) byte

ToByte convert any data type to int8

var m any
m = `123`
L.ParentDescribe(X.ToByte(m)) // byte(123)

func ToF

func ToF(x any) float64

ToF Convert any data type to float64

var m any
m = `123.5`
L.ParentDescribe(X.ToF(m)) // float64(123.5)

func ToI

func ToI(x any) int64

ToI convert any data type to int64

var m any
m = `123`
L.ParentDescribe(X.ToI(m)) // int64(123)

func ToJson

func ToJson(any any) string

ToJson convert to standard json text

func ToJson5

func ToJson5(x any) string

ToJson5 convert to json5

func ToJsonPretty

func ToJsonPretty(any any) string

ToJsonPretty convert to beautiful json text

m:= []interface {}{true,`1`,23,`wabcd`}
L.Print(K.ToJsonPretty(m))
// [
//   true,
//   "1",
//   23,
//   "wabcd"
// ]

func ToMSS

func ToMSS(x any) M.SS

ToMSS convert to map[string]string

func ToMSX

func ToMSX(x any) M.SX

ToMSX convert to map[string]any

func ToMsgp

func ToMsgp(v any) (res []byte)

ToMsgp convert anything to Msgpack bytes

msgpStr := X.ToMsgp(struct{ A int }{A: 1})

func ToS

func ToS(x any) string

ToS convert any data type to string

var m any
m = `123`
L.ParentDescribe(X.ToS(m)) // `123`

func ToTime

func ToTime(x any) time.Time

ToTime convert any to time

func ToU

func ToU(x any) uint64

ToU convert any data type to uint

var m any
m = `123`
L.ParentDescribe(X.ToI(m)) // uint(123)

func ToYaml

func ToYaml(any any) string

ToYaml convert to yaml text

Types

This section is empty.

Jump to

Keyboard shortcuts

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