email

package
v0.0.38-alpha13 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataType

type DataType struct {
}

DataType represents a datatype that validates and formats an email address Uses mail.ParseAddress from the "net/mail" package to parse the input and verify that it's a valid email Only supports raw email addresses. Doesn't support email addresses with Names e.g. "Barry Gibbs <bg@example.com>" is an invalid datatype It always formats the email address at storage to always be in lowercase and no leading or trailing spaces Don't use a regex here because there's built-in functionality that already does the parsing we need and better to use standard library than re-implement in

func Type

func Type() *DataType

Type returns a datatype that implements the field.DataType interface

func (*DataType) Format

func (t *DataType) Format(val interface{}) (interface{}, error)

Format ensures that the datatype is stored in a consistent format at rest

func (*DataType) Type

func (t *DataType) Type() interface{}

Type returns string to satisfy the field.DataType interface

func (*DataType) Valid

func (t *DataType) Valid(val interface{}) error

Valid validates that the input is a valid email address.

func (*DataType) ValidateAndFormat

func (t *DataType) ValidateAndFormat(val interface{}) (string, error)

ValidateAndFormat calls Valid and then Format if valid

Jump to

Keyboard shortcuts

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