Documentation ¶
Overview ¶
The datatype package implements custom data types like Date and JSON.
Copyright 2022 Dr. Abiira Nathan. All rights reserved. Use of this source code is governed by an MIT-style license that can be found in the LICENSE file.
Index ¶
- type Date
- func (date Date) Day() int
- func (Date) FromString(date string) (Date, error)
- func (date *Date) GobDecode(b []byte) error
- func (date Date) GobEncode() ([]byte, error)
- func (date Date) GormDataType() string
- func (date Date) MarshalJSON() ([]byte, error)
- func (date Date) Month() time.Month
- func (date *Date) Scan(value interface{}) (err error)
- func (date Date) String() string
- func (date *Date) UnmarshalJSON(data []byte) error
- func (date Date) Value() (driver.Value, error)
- func (date Date) Year() int
- type JSON
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Date ¶
Custom date type to support dates of the format "2006-01-02".
Create a new date instance with Date.FromString
func (Date) FromString ¶
FromString creates a new Date object from date string.
If date is not of format matching layout: "2006-01-02", it returns an error
func (Date) GormDataType ¶
GormDataType gorm common data type
func (Date) MarshalJSON ¶
Custom Json encoder Called when go types are being converted to json strings
func (*Date) UnmarshalJSON ¶
Custom Json decoder Called to convert json strings to go types