types

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewTimeFromString

func MustNewTimeFromString(str string) *time.Time

MustNewTimeFromString returns an instance of time.Time from a string formatted as "2006-01-02T15:04:05Z07:00" or panics. Avoid using this function in production code.

func MustTimeFromString

func MustTimeFromString(str string) time.Time

MustTimeFromString returns a time.Time from a string formatted as "2006-01-02T15:04:05Z07:00" or panics. Avoid using this function in production code.

Types

type BigInt

type BigInt struct {
	big.Int
}

BigInt is a wrapper around big.Int that allows for JSON marshaling a big integer as a string.

func MustBigIntFromString

func MustBigIntFromString(s string) *BigInt

MustBigIntFromString provides a helper function to return a big.Int from a string The string is assumed to be base 10 and if it is not a valid big.Int then the function will return nil

func (BigInt) MarshalJSON

func (b BigInt) MarshalJSON() ([]byte, error)

func (*BigInt) UnmarshalJSON

func (b *BigInt) UnmarshalJSON(p []byte) error

type Date

type Date struct {
	time.Time
}

Date is a wrapper around time.Time that allows for JSON marshaling a date string formatted as "2006-01-02".

func DateFromString

func DateFromString(str string) (Date, error)

DateFromString returns a Date from a string formatted as "2006-01-02".

func DateFromTime

func DateFromTime(t time.Time) Date

DateFromTime returns a Date from a time.Time.

func MustDateFromString

func MustDateFromString(str string) Date

MustDateFromString returns a Date from a string formatted as "2006-01-02" or panics. Avoid using this function in production code.

func MustNewDateFromString

func MustNewDateFromString(str string) *Date

MustNewDateFromString returns an instance of Date from a string formatted as "2006-01-02" or panics. Avoid using this function in production code.

func NewDate

func NewDate(t time.Time) *Date

NewDate returns an instance of Date from a time.Time.

func NewDateFromString

func NewDateFromString(str string) (*Date, error)

NewDateFromString returns an instance of Date from a string formatted as "2006-01-02".

func (Date) MarshalJSON

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

func (Date) String

func (d Date) String() string

func (*Date) UnmarshalJSON

func (d *Date) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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