Documentation ¶
Index ¶
- Variables
- func DecodeTime(value string) (time.Time, error)
- func DecodeUnixtime(value string) (time.Time, error)
- func DereferencedType(v any) reflect.Type
- func IsNil(value reflect.Value) bool
- func PanicOnError(err error)
- func Pointerize[T any](v T) *T
- func TypeOf[T any]() reflect.Type
- func UnsupportedType(rt reflect.Type) error
- type AnyStringableAdaptor
- type Bool
- type ByteSlice
- type Complex128
- type Complex64
- type Float32
- type Float64
- type Int
- type Int16
- type Int32
- type Int64
- type Int8
- type String
- type StringMarshaler
- type StringUnmarshaler
- type Stringable
- type StringableAdaptor
- type Time
- type Uint
- type Uint16
- type Uint32
- type Uint64
- type Uint8
Constants ¶
This section is empty.
Variables ¶
var ( ErrTypeMismatch = errors.New("type mismatch") ErrUnsupportedType = owl.ErrUnsupportedType )
Functions ¶
func DecodeTime ¶
DecodeTime parses data bytes as time.Time in UTC timezone. Supported formats of the data bytes are: 1. RFC3339Nano string, e.g. "2006-01-02T15:04:05-07:00". 2. Date string, e.g. "2006-01-02". 3. Unix timestamp, e.g. "1136239445", "1136239445.8", "1136239445.812738".
func DecodeUnixtime ¶ added in v0.15.0
value must be valid unix timestamp, matches reUnixtime.
func DereferencedType ¶ added in v0.18.0
DereferencedType returns the underlying type of a pointer.
func PanicOnError ¶ added in v0.15.0
func PanicOnError(err error)
func Pointerize ¶ added in v0.15.0
func Pointerize[T any](v T) *T
func TypeOf ¶ added in v0.15.0
TypeOf returns the reflect.Type of a given type. e.g. TypeOf[int]() returns reflect.TypeOf(0)
func UnsupportedType ¶ added in v0.15.0
Types ¶
type AnyStringableAdaptor ¶ added in v0.15.0
type AnyStringableAdaptor func(any) (Stringable, error)
func NewAnyStringableAdaptor ¶ added in v0.15.0
func NewAnyStringableAdaptor[T any](adapt StringableAdaptor[T]) AnyStringableAdaptor
type ByteSlice ¶ added in v0.15.0
type ByteSlice []byte
ByteSlice is a wrapper of []byte to implement Stringable. NOTE: we're using base64.StdEncoding here, not base64.URLEncoding.
func (*ByteSlice) FromString ¶ added in v0.15.0
type Complex128 ¶ added in v0.15.0
type Complex128 complex128
func (*Complex128) FromString ¶ added in v0.15.0
func (cv *Complex128) FromString(s string) error
func (Complex128) ToString ¶ added in v0.15.0
func (cv Complex128) ToString() (string, error)
type Complex64 ¶ added in v0.15.0
type Complex64 complex64
func (*Complex64) FromString ¶ added in v0.15.0
type StringMarshaler ¶ added in v0.15.0
type StringUnmarshaler ¶ added in v0.15.0
type Stringable ¶ added in v0.15.0
type Stringable interface { StringMarshaler StringUnmarshaler }
func NewStringable ¶ added in v0.15.0
func NewStringable(rv reflect.Value) (Stringable, error)
NewStringable returns a Stringable from the given reflect.Value. We assume that the given reflect.Value is a non-nil pointer to a value. It will panic if the given reflect.Value is not a pointer.
type StringableAdaptor ¶ added in v0.15.0
type StringableAdaptor[T any] func(*T) (Stringable, error)