convert

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camel2Case

func Camel2Case(name string) string

Camel2Case 驼峰式写法转为下划线写法

func Case2Camel

func Case2Camel(name string) string

Case2Camel 下划线写法转为驼峰写法

func Div added in v0.0.18

func Div(Num int) string

Div 把十进制数字转成 ABCD

func GetFloat32ValueInMap added in v0.0.18

func GetFloat32ValueInMap(mapData map[string]interface{}, key string) float32

func GetInt32ValueInMap added in v0.0.18

func GetInt32ValueInMap(mapData map[string]interface{}, key string) int32

GetInt32ValueInMap 提取数据

func GetInt64ValueInMap added in v0.0.18

func GetInt64ValueInMap(mapData map[string]interface{}, key string) int64

func InterfaceToInt32 added in v0.0.18

func InterfaceToInt32(v interface{}) int32

InterfaceToInt32 转int32

func JSONDecode

func JSONDecode(data []byte, v interface{}) error

JSONDecode 规避json解析浮点数出现的精度问题 https://www.jianshu.com/p/2b4a3cda0f6f

func JSONEncode

func JSONEncode(data interface{}, format ...bool) ([]byte, error)

JSONEncode 将结构体转成json字节流, 结构体以驼峰展示,且输出格式化

func LcFirst

func LcFirst(str string) string

LcFirst 首字母小写

func StructAssign added in v0.1.2

func StructAssign(binding interface{}, value interface{})

StructAssign 将value 中的值赋值到 bingding 中, 需要字段名, 字段类型一致 binding type interface 要修改的结构体 value type interace 有数据的结构体

func ToMap added in v0.0.4

func ToMap(in interface{}, tagName string) (map[string]interface{}, error)

ToMap 结构体转为Map[string]interface{}

func UcFirst

func UcFirst(str string) string

UcFirst 首字母大写

Types

type Buffer

type Buffer struct {
	*bytes.Buffer
}

Buffer 内嵌bytes.Buffer,支持连写

func NewBuffer

func NewBuffer() *Buffer

func (*Buffer) Append

func (b *Buffer) Append(i interface{}) *Buffer

type JsonCamelCase

type JsonCamelCase struct {
	Value interface{}
}

JsonCamelCase json struct 驼峰自动转下划线

func (JsonCamelCase) MarshalJSON

func (c JsonCamelCase) MarshalJSON() ([]byte, error)

type JsonSnakeCase

type JsonSnakeCase struct {
	Value interface{}
}

JsonSnakeCase json struct 驼峰自动转下划线

func (JsonSnakeCase) MarshalJSON

func (c JsonSnakeCase) MarshalJSON() ([]byte, error)

type StrTo

type StrTo string

func (StrTo) Int

func (s StrTo) Int() (int, error)

func (StrTo) Int32

func (s StrTo) Int32() (int32, error)

func (StrTo) Int64

func (s StrTo) Int64() (int64, error)

func (StrTo) Int8

func (s StrTo) Int8() (int8, error)

func (StrTo) MustInt

func (s StrTo) MustInt() int

func (StrTo) MustInt32

func (s StrTo) MustInt32() int32

func (StrTo) MustInt64

func (s StrTo) MustInt64() int64

func (StrTo) MustInt8

func (s StrTo) MustInt8() int8

func (StrTo) MustUInt32

func (s StrTo) MustUInt32() uint32

func (StrTo) MustUInt64

func (s StrTo) MustUInt64() uint64

func (StrTo) String

func (s StrTo) String() string

func (StrTo) ToIntArr

func (s StrTo) ToIntArr() []int32

func (StrTo) UInt32

func (s StrTo) UInt32() (uint32, error)

func (StrTo) UInt64

func (s StrTo) UInt64() (uint64, error)

Jump to

Keyboard shortcuts

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