Documentation
¶
Index ¶
- Constants
- Variables
- func Init(initializer any) error
- func InitByContext(ctx context.Context, initializer any) error
- func NewErrParseAddressByURL(input string, cause error) error
- func NewErrParseEndpointByURL(input string, cause error) error
- func NewErrTimestampScanBytes(input []byte) error
- func NewErrTimestampScanInvalidInput(got any) error
- func NewErrUnmarshalSFID(input []byte, cause error) error
- func SetDefaultTimeZone(tz *time.Location)
- type Address
- type Binary
- type DBEngineType
- type DBValue
- type DefaultSetter
- type Endpoint
- type ErrParseAddressByURL
- type ErrParseEndpointByURL
- type ErrTimestampScanBytes
- type ErrTimestampScanInvalidInput
- type ErrUnmarshalSFID
- type Initializer
- type InitializerByContext
- type InitializerByContextWithError
- type InitializerWithError
- type JSONArshaler
- type Password
- type SFID
- type SFIDs
- type SecurityStringer
- type Stringer
- type TextArshaler
- type Timestamp
- func (Timestamp) DBType(engine DBEngineType) 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 NewErrParseAddressByURL ¶ added in v0.1.0
func NewErrParseEndpointByURL ¶ added in v0.1.0
func NewErrTimestampScanBytes ¶ added in v0.1.0
func NewErrTimestampScanInvalidInput ¶ added in v0.1.0
func NewErrUnmarshalSFID ¶ added in v0.1.0
func SetDefaultTimeZone ¶ added in v0.1.0
Types ¶
type Address ¶
type Address struct {
// contains filtered or unexported fields
}
func NewAddress ¶
func ParseAddress ¶
func (Address) DBType ¶ added in v0.1.0
func (a Address) DBType(engine DBEngineType) string
func (Address) MarshalText ¶
func (*Address) UnmarshalText ¶
type DBEngineType ¶ added in v0.1.0
type DBEngineType string
DBEngineType identifies rdb engine type, usually it is `postgres`, `mysql`, `sqlite` or `sqlite3`, etc.
type DBValue ¶ added in v0.1.0
DBValue can convert between rdb value and go value with description of rdb datatype
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 ErrParseAddressByURL ¶ added in v0.1.0
type ErrParseAddressByURL struct {
// contains filtered or unexported fields
}
func (*ErrParseAddressByURL) Error ¶ added in v0.1.0
func (e *ErrParseAddressByURL) Error() string
func (*ErrParseAddressByURL) Unwrap ¶ added in v0.1.0
func (e *ErrParseAddressByURL) Unwrap() error
type ErrParseEndpointByURL ¶ added in v0.1.0
type ErrParseEndpointByURL struct {
// contains filtered or unexported fields
}
func (*ErrParseEndpointByURL) Error ¶ added in v0.1.0
func (e *ErrParseEndpointByURL) Error() string
func (*ErrParseEndpointByURL) Unwrap ¶ added in v0.1.0
func (e *ErrParseEndpointByURL) Unwrap() error
type ErrTimestampScanBytes ¶ added in v0.1.0
type ErrTimestampScanBytes struct {
// contains filtered or unexported fields
}
func (*ErrTimestampScanBytes) Error ¶ added in v0.1.0
func (e *ErrTimestampScanBytes) Error() string
type ErrTimestampScanInvalidInput ¶ added in v0.1.0
type ErrTimestampScanInvalidInput struct {
// contains filtered or unexported fields
}
func (*ErrTimestampScanInvalidInput) Error ¶ added in v0.1.0
func (e *ErrTimestampScanInvalidInput) Error() string
type ErrUnmarshalSFID ¶ added in v0.1.0
type ErrUnmarshalSFID struct {
// contains filtered or unexported fields
}
func (*ErrUnmarshalSFID) Error ¶ added in v0.1.0
func (e *ErrUnmarshalSFID) Error() string
func (*ErrUnmarshalSFID) Unwrap ¶ added in v0.1.0
func (e *ErrUnmarshalSFID) Unwrap() error
type Initializer ¶ added in v0.1.0
type Initializer interface{ Init() }
type InitializerByContext ¶ added in v0.1.0
type InitializerByContextWithError ¶ added in v0.1.0
type InitializerWithError ¶ added in v0.1.0
type InitializerWithError interface{ Init() error }
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) DBType ¶ added in v0.1.0
func (Timestamp) DBType(engine DBEngineType) string
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 UUID ¶ added in v0.0.8
func (UUID) DBType ¶ added in v0.1.0
func (UUID) DBType(engine DBEngineType) string
type ZeroChecker ¶ added in v0.1.0
type ZeroChecker interface{ IsZero() bool }
Source Files
¶
Click to show internal directories.
Click to hide internal directories.