Personal Git forge.

Code git clone ssh://git.poy.ooo:6969/~poyo/farga ZIP
db/types/time.go / 837B #3d4f6d00
Raw
package typesimport (	"database/sql/driver"	"time")type ISOTime time.Timefunc (t ISOTime) String() string {	return time.Time(t).Format(time.RFC3339)}func (t ISOTime) MarshalJSON() ([]byte, error) {	return []byte(`"` + t.String() + `"`), nil}func (t *ISOTime) UnmarshalJSON(data []byte) error {	s := string(data)	s = s[1 : len(s)-1] // strip surrounding quotes	parsed, err := time.Parse(time.RFC3339, s)	if err != nil {		return err	}	*t = ISOTime(parsed)	return nil}// this is for GORM. lets it read a time.Time as ISOTime.func (t *ISOTime) Scan(value interface{}) error {	if v, ok := value.(time.Time); ok {		*t = ISOTime(v)	}	return nil}// this is for GORM. lets it return it back into time.Time.func (t ISOTime) Value() (driver.Value, error) {	return time.Time(t), nil}type CreatedAt time.Time