fix
This commit is contained in:
		
							parent
							
								
									9f0dd430e8
								
							
						
					
					
						commit
						4b6de48764
					
				| 
						 | 
					@ -12,14 +12,19 @@ import (
 | 
				
			||||||
 | 
					
 | 
				
			||||||
type OCSSTime time.Time
 | 
					type OCSSTime time.Time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (t *OCSSTime) MarshalJSON() ([]byte, error) {
 | 
					func (t OCSSTime) MarshalJSON() ([]byte, error) {
 | 
				
			||||||
	// do your serializing here
 | 
						// do your serializing here
 | 
				
			||||||
	stamp := fmt.Sprintf("%v", time.Time(*t).Unix())
 | 
						stamp := fmt.Sprintf("%v", time.Time(t).Unix())
 | 
				
			||||||
	return []byte(stamp), nil
 | 
						return []byte(stamp), nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (v *OCSSTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
 | 
					func (v OCSSTime) MarshalBSONValue() (bsontype.Type, []byte, error) {
 | 
				
			||||||
	return bson.MarshalValue(time.Time(*v))
 | 
						return bson.MarshalValue(time.Time(v))
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func (t OCSSTime) ToTime() time.Time {
 | 
				
			||||||
 | 
						time := time.Time(t)
 | 
				
			||||||
 | 
						return time
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (t *OCSSTime) UnmarshalJSON(b []byte) error {
 | 
					func (t *OCSSTime) UnmarshalJSON(b []byte) error {
 | 
				
			||||||
| 
						 | 
					@ -50,12 +55,3 @@ func (t *OCSSTime) UnmarshalBSONValue(bt bsontype.Type, b []byte) error {
 | 
				
			||||||
	*t = OCSSTime(datetime)
 | 
						*t = OCSSTime(datetime)
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
func (t *OCSSTime) ToTime() *time.Time {
 | 
					 | 
				
			||||||
	if t == nil {
 | 
					 | 
				
			||||||
		return nil
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	time := time.Time(*t)
 | 
					 | 
				
			||||||
	return &time
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue