 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package copier is github.com/jinzhu/copier, default option is add converters for time.Time <--> String
Index ¶
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  var Converter = copier.Option{ DeepCopy: true, Converters: []copier.TypeConverter{ { SrcType: time.Time{}, DstType: copier.String, Fn: func(src interface{}) (interface{}, error) { s, ok := src.(time.Time) if !ok { return nil, fmt.Errorf("expected time.Time got %T", src) } return s.Format(time.RFC3339), nil }, }, { SrcType: &time.Time{}, DstType: copier.String, Fn: func(src interface{}) (interface{}, error) { s, ok := src.(*time.Time) if !ok { return nil, fmt.Errorf("expected *time.Time got %T", src) } if s == nil { return "", nil } return s.Format(time.RFC3339), nil }, }, { SrcType: copier.String, DstType: time.Time{}, Fn: func(src interface{}) (interface{}, error) { s, ok := src.(string) if !ok { return nil, fmt.Errorf("expected string got %T", src) } if s == "" { return time.Time{}, nil } return time.Parse(time.RFC3339, s) }, }, { SrcType: copier.String, DstType: &time.Time{}, Fn: func(src interface{}) (interface{}, error) { s, ok := src.(string) if !ok { return nil, fmt.Errorf("expected string got %T", src) } if s == "" { return nil, nil } t, err := time.Parse(time.RFC3339, s) return &t, err }, }, }, }
Converter Converters for time.Time <--> String
Functions ¶
func Copy ¶
func Copy(dst interface{}, src interface{}) error
    Copy src to dst with option Converters for time.Time <--> String
func CopyDefault ¶
func CopyDefault(dst interface{}, src interface{}) error
    CopyDefault copy src to dst with default option
func CopyWithOption ¶
CopyWithOption copy src to dst with option
Types ¶
This section is empty.
 Click to show internal directories. 
   Click to hide internal directories.