Documentation
¶
Overview ¶
Package local provides local date and datetime types for GORM and SQLight.
Index ¶
- type Date
- func (l Date) AddDays(days int) Date
- func (l Date) AddMonths(months int) Date
- func (l Date) AddYears(years int) Date
- func (l Date) After(b Date) bool
- func (l Date) Before(b Date) bool
- func (l Date) Day() int
- func (l Date) Equal(b Date) bool
- func (l Date) EqualMonth(b Date) bool
- func (l Date) EqualQuarter(b Date) bool
- func (l Date) EqualYear(b Date) bool
- func (Date) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (Date) GormDataType() string
- func (t Date) MarshalJSON() ([]byte, error)
- func (l Date) MinusDays(days int) Date
- func (l Date) MinusMonths(months int) Date
- func (l Date) MinusYears(years int) Date
- func (l Date) Month() int
- func (l Date) Quarter() Date
- func (t *Date) Scan(src interface{}) error
- func (t Date) String() string
- func (t *Date) UnmarshalJSON(data []byte) error
- func (t Date) Value() (driver.Value, error)
- func (l Date) Year() int
- type Time
- func (l Time) Add(d time.Duration) Time
- func (l Time) AddDays(days int) Time
- func (l Time) After(b Time) bool
- func (l Time) Before(b Time) bool
- func (Time) GormDBDataType(db *gorm.DB, field *schema.Field) string
- func (Time) GormDataType() string
- func (t Time) IsZero() bool
- func (t Time) MarshalJSON() ([]byte, error)
- func (t *Time) Scan(src interface{}) error
- func (t Time) String() string
- func (l Time) Sub(b Time) time.Duration
- func (t *Time) UnmarshalJSON(data []byte) error
- func (t Time) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
type Date struct {
// contains filtered or unexported fields
}
func FromString ¶
func (Date) AddMonths ¶
AddMonths returns a new date.Date with the specified number of months added to l.
func (Date) AddYears ¶
AddYears returns a new date.Date with the specified number of years added to l.
func (Date) EqualMonth ¶
EqualMonth returns true if l and b are the same month and year.
func (Date) EqualQuarter ¶
EqualQuarter returns true if l and b are the same quarter and year.
func (Date) GormDBDataType ¶
GormDBDataType returns gorm DB data type based on the current using database.
func (Date) GormDataType ¶
GormDataType returns gorm common data type. This type is used for the field's column type.
func (Date) MarshalJSON ¶
MarshalJSON implements json.Marshaler to convert Time to json serialization.
func (Date) MinusDays ¶
MinusDays returns a new date.Date with the specified number of days subtracted from l.
func (Date) MinusMonths ¶
MinusMonths returns a new date.Date with the specified number of months subtracted from l.
func (Date) MinusYears ¶
MinusYears returns a new date.Date with the specified number of years subtracted from l.
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler to deserialize json data.
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
func TimeFromString ¶ added in v0.6.1
TimeFromString returns a new local.Time from a string.
func (Time) Add ¶ added in v0.4.0
Add returns a new local.Date with the specified duration added to l.
func (Time) AddDays ¶
AddDays returns a new local.Date with the specified number of days added to l.
func (Time) GormDBDataType ¶
GormDBDataType returns gorm DB data type based on the current using database.
func (Time) GormDataType ¶
GormDataType returns gorm common data type. This type is used for the field's column type.
func (Time) IsZero ¶ added in v0.6.0
IsZero reports whether t represents the zero time instant, January 1, year 1, 00:00:00 UTC.
func (Time) MarshalJSON ¶
MarshalJSON implements json.Marshaler to convert Time to json serialization.
func (*Time) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler to deserialize json data.