date

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package date contains methods and structs to deal with timeless date

Index

Constants

View Source
const DATE = "2006-01-02"

DATE is a time.Time layout for the a date (no time)

Variables

View Source
var ErrMsgInvalidFormat = "invalid format"

ErrMsgInvalidFormat reprensents the error message returned when an invalid update format is provided

Functions

This section is empty.

Types

type Date

type Date struct {
	time.Time
}

Date represents a time.Time that uses DATE for json input/output instead of RFC3339

func New

func New(date string) (*Date, error)

New accepts "year-month" or "year-month-day"

func Today

func Today() *Date

Today returns the current local day.

func (*Date) Equal

func (t *Date) Equal(u *Date) bool

Equal checks if the given date is equal to the current one

func (*Date) IsAfter

func (t *Date) IsAfter(u *Date) bool

IsAfter checks if the current date is after the given one

func (*Date) IsBefore

func (t *Date) IsBefore(u *Date) bool

IsBefore checks if the current date is before the given one

func (Date) MarshalJSON

func (t Date) MarshalJSON() ([]byte, error)

MarshalJSON returns a valid json representation of the struct https://golang.org/pkg/encoding/json/#Marshaler

func (*Date) Scan

func (t *Date) Scan(value interface{}) error

Scan assigns a value from a database driver https://golang.org/pkg/database/sql/#Scanner

func (*Date) ScanString

func (t *Date) ScanString(date string) error

ScanString implements the go-params Scanner interface

func (Date) String

func (t Date) String() string

String implements the fmt.Stringer interface https://golang.org/pkg/fmt/#Stringer

func (*Date) UnmarshalJSON

func (t *Date) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON tries to parse a json data into a valid struct https://golang.org/pkg/encoding/json/#Unmarshaler

func (*Date) Value

func (t *Date) Value() (driver.Value, error)

Value returns a value that the database can handle https://golang.org/pkg/database/sql/driver/#Valuer

Jump to

Keyboard shortcuts

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