gtools

package
v0.0.0-...-e027c79 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//TimeZone ...
	TimeZone = "Asia/Shanghai"
	//Custom ...
	Custom = "2006-01-02 15:04:05"
)

Variables

View Source
var (
	MapT = &MapTool{}
)

...

Functions

func CopyBean

func CopyBean(src interface{}) interface{}

CopyBean ...拷贝一个对象

func DeepCopy

func DeepCopy(dst, src interface{}) error

DeepCopy 深度拷贝值

func GetFieldName

func GetFieldName(bean interface{}) []string

GetFieldName 获取结构体中字段的名称

func GetIDValue

func GetIDValue(bean interface{}) int64

GetIDValue 查询对象的ID,如果不包含ID字段,将会panic 返回ID的值

func GetTagName

func GetTagName(bean interface{}) []string

GetTagName 获取结构体中Tag的值,如果没有tag则返回字段值

func NewBean

func NewBean(bean interface{}) interface{}

NewBean 获取一个对象的初始化指针

func ObjectName

func ObjectName(obj interface{}) string

ObjectName gets the type name of the object

func SetTimeZone

func SetTimeZone() error

SetTimeZone ...Shanghai

Types

type JSONTime

type JSONTime time.Time

JSONTime ...

func Must2JSONTimeAddr

func Must2JSONTimeAddr(in string) *JSONTime

Must2JSONTimeAddr maybe panic

func NewJSONTimeOfTime

func NewJSONTimeOfTime(t time.Time) *JSONTime

NewJSONTimeOfTime 时间转换为JSONTime

func Now

func Now() *JSONTime

Now 当前时间

func ToDatetime

func ToDatetime(in string) (JSONTime, error)

ToDatetime ...

func Today

func Today() *JSONTime

Today ...今日日期

func (JSONTime) Addr

func (p JSONTime) Addr() *JSONTime

Addr ...

func (*JSONTime) Convert2Time

func (p *JSONTime) Convert2Time() time.Time

Convert2Time ...

func (*JSONTime) Date

func (p *JSONTime) Date() *JSONTime

Date ...返回一个日期0点的时间

func (*JSONTime) FromDB

func (p *JSONTime) FromDB(data []byte) error

FromDB ...

func (*JSONTime) GobDecode

func (p *JSONTime) GobDecode(data []byte) error

GobDecode implements the gob.GobDecoder interface.

func (*JSONTime) GobEncode

func (p *JSONTime) GobEncode() ([]byte, error)

GobEncode implements the gob.GobEncoder interface.

func (*JSONTime) MarshalJSON

func (p *JSONTime) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*JSONTime) Scan

func (p *JSONTime) Scan(v interface{}) error

Scan valueof time.Time

func (*JSONTime) SetByTime

func (p *JSONTime) SetByTime(timeVal time.Time)

SetByTime ...

func (*JSONTime) String

func (p *JSONTime) String() string

String ...

func (*JSONTime) StringFormat

func (p *JSONTime) StringFormat(layout string) string

StringFormat 转换为固定格式字符串

func (*JSONTime) Time

func (p *JSONTime) Time() time.Time

Time ...

func (*JSONTime) ToDB

func (p *JSONTime) ToDB() (b []byte, err error)

ToDB ...

func (*JSONTime) UnmarshalJSON

func (p *JSONTime) UnmarshalJSON(data []byte) error

UnmarshalJSON ...

func (*JSONTime) Value

func (p *JSONTime) Value() (driver.Value, error)

Value insert timestamp into mysql need this function.

type MapTool

type MapTool struct{}

MapTool ...

func (*MapTool) MapKeys

func (m *MapTool) MapKeys(bean interface{}) []string

MapKeys ...if bean is not a map or map pointer,this func must panic

func (*MapTool) MapValues

func (m *MapTool) MapValues(bean interface{}) []interface{}

MapValues ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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