copierutil

package module
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StringToTimeConverter = copier.TypeConverter{
	SrcType: trans.Ptr(""),
	DstType: &time.Time{},
	Fn: func(src any) (any, error) {
		return timeutil.StringTimeToTime(src.(*string)), nil
	},
}
View Source
var StringToTimestamppbConverter = copier.TypeConverter{
	SrcType: trans.Ptr(""),
	DstType: &timestamppb.Timestamp{},
	Fn: func(src any) (any, error) {
		return timeutil.StringToTimestamppb(src.(*string)), nil
	},
}
View Source
var TimeToStringConverter = copier.TypeConverter{
	SrcType: &time.Time{},
	DstType: trans.Ptr(""),
	Fn: func(src any) (any, error) {
		return timeutil.TimeToTimeString(src.(*time.Time)), nil
	},
}
View Source
var TimeToTimestamppbConverter = copier.TypeConverter{
	SrcType: &time.Time{},
	DstType: &timestamppb.Timestamp{},
	Fn: func(src any) (any, error) {
		return timeutil.TimeToTimestamppb(src.(*time.Time)), nil
	},
}
View Source
var TimestamppbToStringConverter = copier.TypeConverter{
	SrcType: &timestamppb.Timestamp{},
	DstType: trans.Ptr(""),
	Fn: func(src any) (any, error) {
		return timeutil.TimestamppbToString(src.(*timestamppb.Timestamp)), nil
	},
}
View Source
var TimestamppbToTimeConverter = copier.TypeConverter{
	SrcType: &timestamppb.Timestamp{},
	DstType: &time.Time{},
	Fn: func(src any) (any, error) {
		return timeutil.TimestamppbToTime(src.(*timestamppb.Timestamp)), nil
	},
}

Functions

func NewDurationpbNumberConverterPair added in v0.0.8

func NewDurationpbNumberConverterPair[T int | int8 | int16 | int32 | int64 | uint | uint8 | uint16 | uint32 | uint64 | float32 | float64](timePrecision time.Duration) []copier.TypeConverter

func NewErrorHandlingGenericTypeConverterPair added in v0.0.3

func NewErrorHandlingGenericTypeConverterPair[A any, B any](srcType A, dstType B, fromFn func(src A) (B, error), toFn func(src B) (A, error)) []copier.TypeConverter

func NewGenericTypeConverterPair added in v0.0.3

func NewGenericTypeConverterPair[A any, B any](srcType A, dstType B, fromFn func(src A) B, toFn func(src B) A) []copier.TypeConverter

func NewStringTimestamppbConverterPair added in v0.0.7

func NewStringTimestamppbConverterPair() []copier.TypeConverter

func NewTimeStringConverterPair added in v0.0.3

func NewTimeStringConverterPair() []copier.TypeConverter

func NewTimeTimestamppbConverterPair added in v0.0.3

func NewTimeTimestamppbConverterPair() []copier.TypeConverter

func NewTypeConverter added in v0.0.3

func NewTypeConverter(srcType, dstType any, fn func(src any) (any, error)) copier.TypeConverter

func NewTypeConverterPair added in v0.0.3

func NewTypeConverterPair(srcType, dstType any, fromFn, toFn func(src any) (any, error)) []copier.TypeConverter

func TimeToString added in v0.0.5

func TimeToString(tm *time.Time) *string

Types

This section is empty.

Jump to

Keyboard shortcuts

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