Documentation
¶
Index ¶
- Constants
- Variables
- func SetDefaultTimeZone(tz *time.Location)
- type Address
- type Binary
- type DefaultSetter
- type Endpoint
- type JSONArshaler
- type Password
- type SFID
- type SFIDs
- type SecurityStringer
- type Stringer
- type TextArshaler
- type Timestamp
- func (Timestamp) DBType(driver string) string
- func (t Timestamp) IsZero() bool
- func (t Timestamp) MarshalText() ([]byte, error)
- func (t *Timestamp) Scan(value any) error
- func (t Timestamp) String() string
- func (t *Timestamp) UnmarshalText(data []byte) error
- func (t Timestamp) Value() (driver.Value, error)
- type UUID
- type ZeroChecker
Examples ¶
Constants ¶
View Source
const AddressSchemeName = "asset"
View Source
const DefaultTimestampLayout = "2006-01-02T15:04:05.000Z07"
DefaultTimestampLayout default timestamp layout with millisecond precision and time zone
View Source
const MaskedPassword = "--------"
Variables ¶
View Source
var ( UTC = time.UTC CST = time.FixedZone("CST", 8*60*60) // CST Asian/China JST = time.FixedZone("JST", 9*60*60) // JST Asian/Japan SGT = time.FixedZone("SGT", 8*60*60) // SGT Asian/Singapore )
standard time zones
View Source
var ( TimestampZero = Timestamp{time.Time{}} TimestampUnixZero = Timestamp{time.Unix(0, 0)} )
View Source
var ( TypeDefaultSetter = reflect.TypeFor[DefaultSetter]() TypeZeroChecker = reflect.TypeFor[ZeroChecker]() TypeStringer = reflect.TypeFor[Stringer]() TypeSecurityStringer = reflect.TypeFor[SecurityStringer]() )
Functions ¶
func SetDefaultTimeZone ¶ added in v0.1.0
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func NewAddress ¶
func ParseAddress ¶
func (Address) MarshalText ¶
func (*Address) UnmarshalText ¶
type DefaultSetter ¶
type DefaultSetter interface{ SetDefault() }
type Endpoint ¶
type Endpoint struct {
Scheme string
Host string
Port uint16
Base string
Username string
Password Password
Param url.Values
}
func ParseEndpoint ¶
func (Endpoint) MarshalText ¶
func (Endpoint) SecurityString ¶
func (*Endpoint) UnmarshalText ¶
type JSONArshaler ¶ added in v0.1.0
type JSONArshaler interface {
json.Marshaler
json.Unmarshaler
}
type SecurityStringer ¶
type SecurityStringer interface{ SecurityString() string }
type TextArshaler ¶ added in v0.1.0
type TextArshaler interface {
encoding.TextMarshaler
encoding.TextUnmarshaler
}
type Timestamp ¶
openapi:strfmt date-time
func ParseTimestamp ¶ added in v0.1.0
func ParseTimestampWithLayout ¶ added in v0.1.0
func (Timestamp) MarshalText ¶
func (Timestamp) String ¶
String time string with default timestamp layout
Example ¶
input := "2022-10-24T07:30:00.000+08"
SetDefaultTimeZone(UTC)
ts, _ := ParseTimestamp(input)
fmt.Println("UTC:", ts.String())
SetDefaultTimeZone(CST)
ts, _ = ParseTimestamp(input)
fmt.Println("CST:", ts.String())
SetDefaultTimeZone(JST)
ts, _ = ParseTimestamp(input)
fmt.Println("JST:", ts.String())
SetDefaultTimeZone(SGT)
ts, _ = ParseTimestamp(input)
fmt.Println("SGT:", ts.String())
Output: UTC: 2022-10-23T23:30:00.000Z CST: 2022-10-24T07:30:00.000+08 JST: 2022-10-24T08:30:00.000+09 SGT: 2022-10-24T07:30:00.000+08
func (*Timestamp) UnmarshalText ¶
type ZeroChecker ¶ added in v0.1.0
type ZeroChecker interface{ IsZero() bool }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.