types

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_LOCALE = "en-US"

Variables

This section is empty.

Functions

func ValidatePhoneNumber added in v1.5.1

func ValidatePhoneNumber(s string) error

Types

type Email added in v1.5.1

type Email string

func NewEmail added in v1.5.1

func NewEmail(s string) (Email, error)

NewEmail validates and returns an Email.

func (Email) MarshalJSON added in v1.5.1

func (e Email) MarshalJSON() ([]byte, error)

func (Email) MarshalText added in v1.5.1

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

func (*Email) Scan added in v1.5.1

func (e *Email) Scan(value any) error

func (Email) String added in v1.5.1

func (e Email) String() string

func (*Email) UnmarshalJSON added in v1.5.1

func (e *Email) UnmarshalJSON(b []byte) error

func (*Email) UnmarshalText added in v1.5.1

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

func (Email) Validate added in v1.5.1

func (e Email) Validate() error

Validate re-validates the value (useful after deserialization).

func (Email) Value added in v1.5.1

func (e Email) Value() (driver.Value, error)

type Language added in v1.5.1

type Language string

Language represents supported languages

const (
	English Language = "en"
	Spanish Language = "es"
)

func (Language) IsValid added in v1.5.1

func (l Language) IsValid() bool

type Locale added in v1.5.1

type Locale string

Locale is a string type with validation

func NewLocaleString added in v1.5.1

func NewLocaleString(locale string) (Locale, error)

NewLocaleString creates a validated locale string

func (Locale) Language added in v1.5.1

func (l Locale) Language() Language

Language returns the language part of the locale

func (Locale) MarshalJSON added in v1.5.1

func (l Locale) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (Locale) Region added in v1.5.1

func (l Locale) Region() string

Region returns the region part of the locale

func (Locale) String added in v1.5.1

func (l Locale) String() string

String returns the locale string

func (*Locale) UnmarshalJSON added in v1.5.1

func (l *Locale) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

type ModelWithCursor

type ModelWithCursor interface {
	GetCursor() string
}

type PhoneNumber added in v1.5.1

type PhoneNumber string

func NewPhoneNumber added in v1.5.1

func NewPhoneNumber(s string) (PhoneNumber, error)

NewPhoneNumber validates and returns a PhoneNumber.

func (PhoneNumber) MarshalJSON added in v1.5.1

func (p PhoneNumber) MarshalJSON() ([]byte, error)

func (PhoneNumber) MarshalText added in v1.5.1

func (p PhoneNumber) MarshalText() ([]byte, error)

func (*PhoneNumber) Scan added in v1.5.1

func (p *PhoneNumber) Scan(value any) error

func (PhoneNumber) String added in v1.5.1

func (p PhoneNumber) String() string

func (*PhoneNumber) UnmarshalJSON added in v1.5.1

func (p *PhoneNumber) UnmarshalJSON(b []byte) error

func (*PhoneNumber) UnmarshalText added in v1.5.1

func (p *PhoneNumber) UnmarshalText(text []byte) error

func (PhoneNumber) Validate added in v1.5.1

func (p PhoneNumber) Validate() error

Validate re-validates the value (useful after deserialization).

func (PhoneNumber) Value added in v1.5.1

func (p PhoneNumber) Value() (driver.Value, error)

type UnixTimestamp added in v1.5.1

type UnixTimestamp int64

func UnixFromRFC3339 added in v1.5.1

func UnixFromRFC3339(dateString string) (UnixTimestamp, error)

func UnixFromTime added in v1.5.1

func UnixFromTime(t time.Time) UnixTimestamp

func UnixTimeNow added in v1.5.1

func UnixTimeNow() UnixTimestamp

func (UnixTimestamp) FormatDate added in v1.5.1

func (i UnixTimestamp) FormatDate() string

func (UnixTimestamp) FormatDateInTimezone added in v1.5.1

func (i UnixTimestamp) FormatDateInTimezone(tz string) (string, error)

func (UnixTimestamp) Time added in v1.5.1

func (i UnixTimestamp) Time() time.Time

func (*UnixTimestamp) UnmarshalJSON added in v1.5.1

func (i *UnixTimestamp) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts either a unix timestamp number or RFC3339 string

Jump to

Keyboard shortcuts

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