types

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 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 UnixSeconds added in v1.5.2

type UnixSeconds int64

UnixSeconds is seconds since Unix epoch (1970-01-01T00:00:00Z)

func UnixSecondsFromRFC3339 added in v1.5.2

func UnixSecondsFromRFC3339(dateString string) (UnixSeconds, error)

UnixSecondsFromRFC3339 parses an RFC3339/RFC3339Nano string into Unix seconds

func UnixSecondsFromTime added in v1.5.2

func UnixSecondsFromTime(t time.Time) UnixSeconds

UnixSecondsFromTime converts a time.Time to Unix seconds (truncates sub-second)

func UnixSecondsNow added in v1.5.2

func UnixSecondsNow() UnixSeconds

UnixSecondsNow returns the current time in Unix seconds

func (UnixSeconds) FormatDate added in v1.5.2

func (us UnixSeconds) FormatDate() string

FormatDate returns dd/mm/yyyy

func (UnixSeconds) FormatDateInTimezone added in v1.5.2

func (us UnixSeconds) FormatDateInTimezone(tz string) (string, error)

FormatDateInTimezone returns dd/mm/yyyy rendered in the provided IANA timezone

func (UnixSeconds) IsZero added in v1.5.2

func (us UnixSeconds) IsZero() bool

IsZero reports whether us == 0

func (UnixSeconds) MarshalJSON added in v1.5.2

func (us UnixSeconds) MarshalJSON() ([]byte, error)

MarshalJSON emits a JSON number (unix seconds)

func (*UnixSeconds) Scan added in v1.5.2

func (us *UnixSeconds) Scan(v any) error

Scan implements sql.Scanner for BIGINT (and a few driver variants).

func (UnixSeconds) Time added in v1.5.2

func (us UnixSeconds) Time() time.Time

Time converts UnixSeconds back to time.Time

func (*UnixSeconds) UnmarshalJSON added in v1.5.2

func (us *UnixSeconds) UnmarshalJSON(data []byte) error

UnmarshalJSON accepts a JSON number (unix seconds)

func (UnixSeconds) Value added in v1.5.2

func (us UnixSeconds) Value() (driver.Value, error)

Value implements driver.Valuer for BIGINT storage.

Jump to

Keyboard shortcuts

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