format

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFormatForTypeYearMonth = errors.New("invalid format: expecting type#year-month")
	ErrInvalidEmailType              = errors.New("invalid email type: expecting inbox or sent")
	ErrInvalidEmailYear              = errors.New("invalid email year: expecting 4 digit integer string")
	ErrInvalidEmailMonth             = errors.New("invalid email type: expecting 2 digit integer string")
)

Errors

Functions

func ExtractTypeYearMonth

func ExtractTypeYearMonth(s string) (emailType string, yearMonth string, err error)

ExtractTypeYearMonth parses type-year-month string and returns EmailType and year-month

func FormatDate

func FormatDate(date string) string

FormatDate formats Date from SMTP headers to RFC3399, as it's used by DynamoDB.

TODO: date from Gmail produce an error

func FormatDateTime

func FormatDateTime(t time.Time) string

FormatDateTime converts time.Time to dd-hh:mm:ss

func FormatTypeYearMonth

func FormatTypeYearMonth(emailType string, t time.Time) (string, error)

FormatTypeYearMonth formats time.Time to type#YYYY-MM

func RejoinDate

func RejoinDate(ym string, dt string) string

RejoinDate converts year-month and date-time to RFC3399

Types

This section is empty.

Jump to

Keyboard shortcuts

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