types

package
v1.1.0-rc6 Latest Latest
Warning

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

Go to latest
Published: May 6, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const AddressSchemeName = "asset"
View Source
const (
	DatetimeFormat = time.RFC3339
)

Variables

View Source
var (
	UTC               = time.UTC
	CST               = time.FixedZone("CST", 8*60*60)
	TimestampZero     = Timestamp{time.Time{}}
	TimestampUnixZero = Timestamp{time.Unix(0, 0)}
)
View Source
var (
	RTypeString               = reflect.TypeOf((*String)(nil)).Elem()
	RTypeSecurityString       = reflect.TypeOf((*SecurityString)(nil)).Elem()
	RTypeNamed                = reflect.TypeOf((*Named)(nil)).Elem()
	RTypeTextMarshaler        = reflect.TypeOf((*TextMarshaler)(nil)).Elem()
	RTypeTextUnmarshaler      = reflect.TypeOf((*TextUnmarshaler)(nil)).Elem()
	RTypeDefaultSetter        = reflect.TypeOf((*DefaultSetter)(nil)).Elem()
	RTypeInitializer          = reflect.TypeOf((*Initializer)(nil)).Elem()
	RTypeValidatedInitializer = reflect.TypeOf((*ValidatedInitializer)(nil)).Elem()
	RTypeInitializerWith      = reflect.TypeOf((*InitializerWith)(nil)).Elem()
)

Types

View Source
var (
	DatetimeZero = Datetime{time.Time{}}
)

Functions

func UnmarshalExtra

func UnmarshalExtra(ext url.Values, v interface{}) error

Types

type Address

type Address struct {
	URL string
	Grp string
	Key string
	Ext string
}

func ParseAddress

func ParseAddress(text string) (*Address, error)

func (Address) DataType

func (a Address) DataType(string) string

func (Address) MarshalText

func (a Address) MarshalText() ([]byte, error)

func (*Address) Scan

func (a *Address) Scan(src interface{}) error

func (Address) String

func (a Address) String() string

func (*Address) UnmarshalText

func (a *Address) UnmarshalText(text []byte) error

func (Address) Value

func (a Address) Value() (driver.Value, error)

type Binary

type Binary []byte

func (Binary) MarshalText

func (d Binary) MarshalText() ([]byte, error)

func (*Binary) UnmarshalText

func (d *Binary) UnmarshalText(data []byte) (err error)

type Capacity

type Capacity int64

type CommaSplitInts

type CommaSplitInts []int64

func (CommaSplitInts) MarshalText

func (s CommaSplitInts) MarshalText() (data []byte, err error)

func (*CommaSplitInts) UnmarshalText

func (s *CommaSplitInts) UnmarshalText(text []byte) error

type CommaSplitStrings

type CommaSplitStrings []string

func (CommaSplitStrings) MarshalText

func (s CommaSplitStrings) MarshalText() ([]byte, error)

func (*CommaSplitStrings) UnmarshalText

func (s *CommaSplitStrings) UnmarshalText(text []byte) error

type Datetime

type Datetime struct{ time.Time }

openapi:strfmt date-time

func AsDatetime

func AsDatetime(t time.Time) Datetime

func ParseDatetimeFromString

func ParseDatetimeFromString(s string) (Datetime, error)

func ParseDatetimeFromStringWithFormatterInCST

func ParseDatetimeFromStringWithFormatterInCST(s, formatter string) (Datetime, error)

func (Datetime) DataType

func (Datetime) DataType(engine string) string

func (Datetime) Format

func (t Datetime) Format(layout string) string

func (Datetime) In

func (t Datetime) In(loc *time.Location) Datetime

func (Datetime) IsZero

func (t Datetime) IsZero() bool

func (Datetime) MarshalText

func (t Datetime) MarshalText() ([]byte, error)

func (*Datetime) Scan

func (t *Datetime) Scan(value interface{}) error

func (*Datetime) Set

func (t *Datetime) Set(_t time.Time)

func (Datetime) String

func (t Datetime) String() string

func (*Datetime) UnmarshalText

func (t *Datetime) UnmarshalText(data []byte) (err error)

func (Datetime) Value

func (t Datetime) Value() (driver.Value, error)

type DefaultSetter

type DefaultSetter interface{ SetDefault() }

type Duration

type Duration time.Duration

func AsDuration

func AsDuration(d time.Duration) *Duration

func Spans

func Spans(du ...Span) Duration

func (Duration) Duration

func (d Duration) Duration() time.Duration

func (Duration) Int

func (d Duration) Int() int64

func (Duration) Literal

func (d Duration) Literal() string

func (Duration) MarshalText

func (d Duration) MarshalText() (text []byte, err error)

func (Duration) Span

func (d Duration) Span() Span

func (Duration) String

func (d Duration) String() string

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type Endpoint

type Endpoint struct {
	Scheme   string
	Hostname string
	Port     uint16
	Base     string
	Username string
	Password Password
	Param    url.Values
}

func ParseEndpoint

func ParseEndpoint(text string) (*Endpoint, error)

func (Endpoint) Host

func (e Endpoint) Host() string

func (Endpoint) IsTLS

func (e Endpoint) IsTLS() bool

func (Endpoint) IsZero

func (e Endpoint) IsZero() bool

func (Endpoint) MarshalText

func (e Endpoint) MarshalText() ([]byte, error)

func (Endpoint) SchemeHost

func (e Endpoint) SchemeHost() string

func (Endpoint) SecurityString

func (e Endpoint) SecurityString() string

func (Endpoint) String

func (e Endpoint) String() string

func (*Endpoint) UnmarshalText

func (e *Endpoint) UnmarshalText(text []byte) error

type EthAddress added in v1.1.0

type EthAddress string

func (EthAddress) IsZero added in v1.1.0

func (v EthAddress) IsZero() bool

func (EthAddress) MarshalText added in v1.1.0

func (v EthAddress) MarshalText() ([]byte, error)

func (*EthAddress) String added in v1.1.0

func (v *EthAddress) String() string

func (*EthAddress) UnmarshalText added in v1.1.0

func (v *EthAddress) UnmarshalText(txt []byte) error

type GB

type GB int64

type Hour

type Hour int64

func Hours

func Hours(h int64) *Hour

func (Hour) Duration

func (h Hour) Duration() time.Duration

func (Hour) Int

func (h Hour) Int() int64

func (Hour) Literal

func (h Hour) Literal() string

func (Hour) MarshalText

func (h Hour) MarshalText() ([]byte, error)

func (Hour) Span

func (h Hour) Span() Span

func (Hour) String

func (h Hour) String() string

func (*Hour) UnmarshalText

func (h *Hour) UnmarshalText(text []byte) error

type Initializer

type Initializer interface{ Init() }

type InitializerWith

type InitializerWith interface{ Init(context.Context) }

type KB

type KB int64

type MB

type MB float64

func (MB) MarshalText

func (v MB) MarshalText() ([]byte, error)

func (*MB) UnmarshalText

func (v *MB) UnmarshalText(data []byte) error

type Microsecond

type Microsecond int64

func Microseconds

func Microseconds(v int64) *Microsecond

func (Microsecond) Duration

func (us Microsecond) Duration() time.Duration

func (Microsecond) Int

func (us Microsecond) Int() int64

func (Microsecond) Literal

func (us Microsecond) Literal() string

func (Microsecond) MarshalText

func (us Microsecond) MarshalText() ([]byte, error)

func (Microsecond) Span

func (us Microsecond) Span() Span

func (Microsecond) String

func (us Microsecond) String() string

func (*Microsecond) UnmarshalText

func (us *Microsecond) UnmarshalText(text []byte) error

type Millisecond

type Millisecond int64

func Milliseconds

func Milliseconds(s int64) *Millisecond

func (Millisecond) Duration

func (ms Millisecond) Duration() time.Duration

func (Millisecond) Int

func (ms Millisecond) Int() int64

func (Millisecond) Literal

func (ms Millisecond) Literal() string

func (Millisecond) MarshalText

func (ms Millisecond) MarshalText() ([]byte, error)

func (Millisecond) Span

func (ms Millisecond) Span() Span

func (Millisecond) String

func (ms Millisecond) String() string

func (*Millisecond) UnmarshalText

func (ms *Millisecond) UnmarshalText(text []byte) error

type Minute

type Minute int64

func Minutes

func Minutes(h int64) *Minute

func (Minute) Duration

func (m Minute) Duration() time.Duration

func (Minute) Int

func (m Minute) Int() int64

func (Minute) Literal

func (m Minute) Literal() string

func (Minute) MarshalText

func (m Minute) MarshalText() ([]byte, error)

func (Minute) Span

func (m Minute) Span() Span

func (Minute) String

func (m Minute) String() string

func (*Minute) UnmarshalText

func (m *Minute) UnmarshalText(text []byte) error

type Named

type Named interface{ Name() string }

type Nanosecond

type Nanosecond int64

func Nanoseconds

func Nanoseconds(v int64) *Nanosecond

func (Nanosecond) Duration

func (ns Nanosecond) Duration() time.Duration

func (Nanosecond) Int

func (ns Nanosecond) Int() int64

func (Nanosecond) Literal

func (ns Nanosecond) Literal() string

func (Nanosecond) MarshalText

func (ns Nanosecond) MarshalText() ([]byte, error)

func (Nanosecond) Span

func (ns Nanosecond) Span() Span

func (Nanosecond) String

func (ns Nanosecond) String() string

func (*Nanosecond) UnmarshalText

func (ns *Nanosecond) UnmarshalText(text []byte) error

type Password

type Password string

func (*Password) Decode

func (p *Password) Decode(method string) (raw string, err error)

func (Password) Encode

func (p Password) Encode(method string) (security string, err error)

func (Password) SecurityString

func (p Password) SecurityString() string

func (Password) String

func (p Password) String() string

type Perm

type Perm fs.FileMode

type SFID

type SFID uint64

func (SFID) MarshalText

func (sf SFID) MarshalText() ([]byte, error)

func (SFID) String

func (sf SFID) String() string

func (*SFID) UnmarshalText

func (sf *SFID) UnmarshalText(data []byte) (err error)

type SFIDs

type SFIDs []SFID

func (SFIDs) ToUint64

func (sfs SFIDs) ToUint64() []uint64

type Second

type Second int64

func Seconds

func Seconds(s int64) *Second

func (Second) Duration

func (s Second) Duration() time.Duration

func (Second) Int

func (s Second) Int() int64

func (Second) Literal

func (s Second) Literal() string

func (Second) MarshalText

func (s Second) MarshalText() ([]byte, error)

func (Second) Span

func (s Second) Span() Span

func (Second) String

func (s Second) String() string

func (*Second) UnmarshalText

func (s *Second) UnmarshalText(text []byte) error

type SecurityString

type SecurityString interface{ SecurityString() string }

type Signal

type Signal syscall.Signal

func (Signal) Error

func (s Signal) Error() string

func (Signal) Int

func (s Signal) Int() int

func (Signal) MarshalText

func (s Signal) MarshalText() ([]byte, error)

func (Signal) String

func (s Signal) String() string

func (*Signal) UnmarshalText

func (s *Signal) UnmarshalText(data []byte) error

type Span

type Span interface {
	// Duration returns common duration value as `time.Duration`
	Duration() time.Duration
	// Int returns an integer value, such as int64(Span.Duration())
	Int() int64
	// String returns a duration formatted string, commonly call Span.Duration().String()
	// eg: Second(1).String() returns `"1s"`
	String() string
	// Literal returns a string presents an integer value regardless of time unit
	// eg: Second(1).Literal() returns `"1"`
	Literal() string
	// Span
	Span() Span
	TextMarshaler
	TextUnmarshaler
}

Span defines a time duration

type SqlValue

type SqlValue interface {
	driver.Value
	sql.Scanner
	DataType(engine string) string
}

SqlValue can convert between sql value and describe sql datatype

type String

type String interface{ String() string }

type TextMarshaler

type TextMarshaler = encoding.TextMarshaler

type TextUnmarshaler

type TextUnmarshaler = encoding.TextUnmarshaler

type Timestamp

type Timestamp struct{ time.Time }

openapi:strfmt date-time

func AsTimestamp

func AsTimestamp(t time.Time) Timestamp

func ParseTimestampFromString

func ParseTimestampFromString(s string) (Timestamp, error)

func ParseTimestampFromStringWithLayout

func ParseTimestampFromStringWithLayout(input, layout string) (Timestamp, error)

func (Timestamp) DataType

func (Timestamp) DataType(engine string) string

func (Timestamp) Format

func (t Timestamp) Format(layout string) string

func (Timestamp) In

func (t Timestamp) In(loc *time.Location) Timestamp

func (Timestamp) IsZero

func (t Timestamp) IsZero() bool

func (Timestamp) MarshalText

func (t Timestamp) MarshalText() ([]byte, error)

func (*Timestamp) Scan

func (t *Timestamp) Scan(value interface{}) error

func (*Timestamp) Set

func (t *Timestamp) Set(_t time.Time)

func (Timestamp) String

func (t Timestamp) String() string

func (Timestamp) Unix

func (t Timestamp) Unix() int64

func (*Timestamp) UnmarshalText

func (t *Timestamp) UnmarshalText(data []byte) (err error)

func (Timestamp) Value

func (t Timestamp) Value() (driver.Value, error)

type UID

type UID uint64

func AsUID

func AsUID(v uint64) UID

func (UID) MarshalText

func (uid UID) MarshalText() ([]byte, error)

func (UID) String

func (uid UID) String() string

func (UID) Uint

func (uid UID) Uint() uint64

func (*UID) UnmarshalText

func (uid *UID) UnmarshalText(data []byte) error

type UIDs

type UIDs []UID

type ValidatedInitializer

type ValidatedInitializer interface{ Init() error }

type ValidatedInitializerWith added in v1.1.0

type ValidatedInitializerWith interface{ Init(context.Context) error }

type ZeroChecker

type ZeroChecker interface{ IsZero() bool }

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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