types

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package types implements special types for Envelope Zero.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Month

type Month time.Time

Month is a month in a specific year.

func MonthOf

func MonthOf(t time.Time) Month

MonthOf returns the Month in which a time occurs in that time's location.

func NewMonth

func NewMonth(year int, month time.Month) Month

NewMonth returns a new Month.

func ParseMonth

func ParseMonth(s string) (Month, error)

ParseMonth parses a string in RFC3339 full-date format and returns the Month value it represents.

func (Month) AddDate

func (m Month) AddDate(years, months int) Month

AddDate adds a specified amount of years and months.

func (Month) After

func (m Month) After(n Month) bool

After reports whether the month instant m is after n.

func (Month) AfterTime

func (m Month) AfterTime(t time.Time) bool

AfterTime reports whether the month instant m is after the time instant t.

func (Month) Before

func (m Month) Before(n Month) bool

Before reports whether the month instant m is before n.

func (Month) BeforeTime

func (m Month) BeforeTime(t time.Time) bool

BeforeTime reports whether the month instant m is before the time instant t.

func (Month) Contains

func (m Month) Contains(t time.Time) bool

Contains reports whether the time instant is in the month.

func (Month) Equal

func (m Month) Equal(n Month) bool

Equal reports whether m and n represent the same month.

func (Month) GormDataType

func (Month) GormDataType() string

GormDataType defines the data type used by gorm the type.

func (Month) IsZero

func (m Month) IsZero() bool

IsZero reports if the month is the zero value.

func (Month) MarshalJSON

func (m Month) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. The output is the result of m.StringRFC3339().

func (*Month) Scan

func (m *Month) Scan(value interface{}) (err error)

Scan writes the value from the database.

func (Month) String

func (m Month) String() string

String returns the time formatted as YYYY-MM.

func (*Month) UnmarshalJSON

func (m *Month) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface. The month is expected to be a string in a format accepted by ParseDate.

func (Month) Value

func (m Month) Value() (driver.Value, error)

Value returns the value for the SQL driver to write to the database.

Jump to

Keyboard shortcuts

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