convert

package
v0.0.0-...-a450568 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromString

func FromString(value string, ntype string) (reflect.Value, error)

FromString 类型转换:string类型转其他类型

func SetField

func SetField(obj interface{}, name string, value interface{}) error

SetField 用map的值替换结构的值

func ToString

func ToString(v interface{}) string

func ToStruct

func ToStruct(m map[string]interface{}, s interface{}) error

ToStruct 用map填充结构

Types

type ImgCover

type ImgCover struct{}

func (*ImgCover) Base64ToImg

func (m *ImgCover) Base64ToImg(bytes []byte) ([]byte, error)

func (*ImgCover) GIFToBase64

func (m *ImgCover) GIFToBase64(img *image.RGBA) ([]byte, error)

GIFToBase64 gif to base64

func (*ImgCover) JPEGToBase64

func (m *ImgCover) JPEGToBase64(img *image.RGBA) ([]byte, error)

JPEGToBase64 jpeg to base64

func (*ImgCover) PNGToBase64

func (m *ImgCover) PNGToBase64(img *image.RGBA) ([]byte, error)

PNGToBase64 png to base64

type StrConver

type StrConver string

StrConver 装饰者string,类似继承

func (StrConver) Bool

func (m StrConver) Bool() (bool, error)

Bool 将字符串转换为布尔值 它接受真值:1, t, T, TRUE, true, True 它接受假值:0, f, F, FALSE, false, False. 其它任何值都返回一个错误

func (StrConver) Float32

func (m StrConver) Float32() (float32, error)

Float32

func (StrConver) Float64

func (m StrConver) Float64() (float64, error)

Float64

func (StrConver) Hex

func (m StrConver) Hex() (uint64, error)

Hex

func (StrConver) Int

func (m StrConver) Int() (int, error)

Int

func (StrConver) Int16

func (m StrConver) Int16() (int16, error)

Int16

func (StrConver) Int32

func (m StrConver) Int32() (int32, error)

Int32

func (StrConver) Int64

func (m StrConver) Int64() (int64, error)

Int64

func (StrConver) Int8

func (m StrConver) Int8() (int8, error)

Int8

func (StrConver) String

func (m StrConver) String() string

String

func (StrConver) Time

func (m StrConver) Time() (time.Time, error)

Time

func (StrConver) Uint

func (m StrConver) Uint() (uint, error)

Uint

func (StrConver) Uint64

func (m StrConver) Uint64() (uint64, error)

Uint64

Jump to

Keyboard shortcuts

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