models

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBool

func NewBool(v bool) *bool

func NewInt

func NewInt(v int) *int

func NewString

func NewString(v string) *string

func ToBool

func ToBool(v *bool) bool

func ToFloat64

func ToFloat64(v *Decimal) float64

func ToInt

func ToInt(v *int) int

func ToString

func ToString(v *string) string

Types

type DateTime

type DateTime struct {
	Time      time.Time
	Precision Precision
}

func Date

func Date(year, month, day int) DateTime

func NewDate

func NewDate(year, month, day int) *DateTime

func NewDateTime

func NewDateTime(time time.Time, precision Precision) *DateTime

func NewYear

func NewYear(year int) *DateTime

func NewYearMonth

func NewYearMonth(year, month int) *DateTime

func ParseDateTime

func ParseDateTime(s string) (d DateTime, err error)

func Year

func Year(year int) DateTime

func YearMonth

func YearMonth(year, month int) DateTime

func (DateTime) MarshalJSON

func (d DateTime) MarshalJSON() ([]byte, error)

func (DateTime) String

func (d DateTime) String() string

func (*DateTime) UnmarshalJSON

func (d *DateTime) UnmarshalJSON(data []byte) (err error)

type Decimal

type Decimal = float64

func NewDecimal

func NewDecimal(v float64) *Decimal

func ToDecimal

func ToDecimal(v *Decimal) Decimal

type Precision

type Precision int
const (
	TimestampPrecision Precision = iota
	DatePrecision
	YearMonthPrecision
	YearPrecision
)

func (Precision) String

func (p Precision) String() string

type Time

type Time struct {
	// contains filtered or unexported fields
}

Time.

func NewTime

func NewTime(hour, minute, second int) *Time

func ParseTime

func ParseTime(s string) (t Time, err error)

func (Time) Hour

func (t Time) Hour() int

func (Time) MarshalJSON

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

func (Time) Minute

func (t Time) Minute() int

func (Time) Second

func (t Time) Second() int

func (*Time) Set

func (t *Time) Set(hour, minute, second int)

func (Time) String

func (t Time) String() string

func (*Time) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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