vo

package
v0.0.0-...-cdc0945 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidID = errors.New("invalid id")

Functions

func BoolInterface

func BoolInterface(i interface{}) *bool

BoolInterface returns a pointer of the interface value.

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a pointer to the string value passed in.

func BoolValue

func BoolValue(b *bool) (v bool)

BoolValue returns the value or false if the pointer is nil.

func Float32Interface

func Float32Interface(i interface{}) *float32

Float32Interface returns a pointer of the interface value.

func Float32Ptr

func Float32Ptr(v float32) *float32

Float32Ptr returns a pointer to the float32 value passed in.

func Float32Value

func Float32Value(f *float32) (v float32)

Float32Value returns the value or 0 if the pointer is nil.

func Float64Interface

func Float64Interface(i interface{}) *float64

Float64Interface returns a pointer of the interface value.

func Float64Ptr

func Float64Ptr(v float64) *float64

Float64Ptr returns a pointer to the float64 value passed in.

func Float64Value

func Float64Value(f *float64) (v float64)

Float64Value returns the value or 0 if the pointer is nil.

func Int32Interface

func Int32Interface(i interface{}) *int32

Int32Interface returns a pointer of the interface value.

func Int32Ptr

func Int32Ptr(v int32) *int32

Int32Ptr returns a pointer to the int value passed in.

func Int32Value

func Int32Value(i *int32) (v int32)

Int32Value returns the value or 0 if the pointer is nil.

func Int64Interface

func Int64Interface(i interface{}) *int64

Int64Interface returns a pointer of the interface value.

func Int64Ptr

func Int64Ptr(v int64) *int64

Int64Ptr returns a pointer to the int value passed in.

func Int64Value

func Int64Value(i *int64) (v int64)

Int64Value returns the value or 0 if the pointer is nil.

func IntInterface

func IntInterface(i interface{}) *int

IntInterface returns a pointer of the interface value.

func IntPtr

func IntPtr(v int) *int

IntPtr returns a pointer to the int value passed in.

func IntValue

func IntValue(i *int) (v int)

IntValue returns the value or 0 if the pointer is nil.

func StringInterface

func StringInterface(i interface{}) *string

StringInterface returns a pointer of the interface value.

func StringPtr

func StringPtr(v string) *string

StringPtr returns a pointer to the string value passed in.

func StringValue

func StringValue(s *string) (v string)

StringValue returns the value or "" if the pointer is nil.

func TimePtr

func TimePtr(time time.Time) *time.Time

TimePtr returns a pointer to the TimePtr value passed in.

func TimeValue

func TimeValue(t *time.Time) (v time.Time)

TimeValue returns the value or zero date if the pointer is nil.

Types

type DateTime

type DateTime time.Time

DateTime is a time.Time type.

func DateTimeNow

func DateTimeNow() DateTime

DateTimeNow generates a datetime with the current date.

func DateTimePtr

func DateTimePtr(dt DateTime) *DateTime

DateTimePtr returns the pointer of a date-time given.

func DateTimeVal

func DateTimeVal(dt *DateTime) DateTime

DateTimeVal return the value of a date-time pointer.

func NewDateTime

func NewDateTime(t time.Time) DateTime

NewDateTime is a constructor.

func (DateTime) Equal

func (dt DateTime) Equal(input DateTime) bool

Equal checks if the calling DateTime has the same value as input's.

func (DateTime) Format

func (dt DateTime) Format(layout string) string

Format returns a string representation of the calling DateTime.

func (DateTime) IsZero

func (dt DateTime) IsZero() bool

IsZero returns true if the DateTime on which it was called is a zero-valued DateTime.

func (DateTime) MarshalJSON

func (dt DateTime) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*DateTime) Scan

func (dt *DateTime) Scan(src interface{}) error

Scan binds the value from the database with the type Time.

func (*DateTime) UnmarshalJSON

func (dt *DateTime) UnmarshalJSON(bytes []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (DateTime) Value

func (dt DateTime) Value() (driver.Value, error)

Value returns the DateTime value to be stored in database.

type ID

type ID uuid.UUID

func IDPtr

func IDPtr(v ID) *ID

IDPtr returns a pointer to the ID value passed in.

func IDValue

func IDValue(id *ID) (v ID)

IDValue returns the value or zero ID if the pointer is nil.

func MustParseID

func MustParseID(s string) ID

MustParseID parses a string and if has any errors will panic.

func NewID

func NewID() ID

NewID returns an ID with a UUID v4 value.

func ParseID

func ParseID(s string) (ID, error)

ParseID is self-described.

func (ID) IsEmpty

func (id ID) IsEmpty() bool

IsEmpty is self-described.

func (ID) MarshalBinary

func (id ID) MarshalBinary() ([]byte, error)

MarshalBinary is self-described.

func (*ID) Scan

func (id *ID) Scan(src interface{}) error

Scan binds the value from the database with the type ID.

func (ID) String

func (id ID) String() string

String is self-described.

func (*ID) UnmarshalBinary

func (id *ID) UnmarshalBinary(data []byte) error

UnmarshalBinary is self-described.

func (ID) Value

func (id ID) Value() (driver.Value, error)

Value returns the ID as a string to be stored in the database as uuid.

Jump to

Keyboard shortcuts

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