models

package
v1.0.0-alpha Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const InvalidRunes = "{}/\\<>() "

Variables

View Source
var BaseHash string

Functions

func DecodePHC

func DecodePHC(phc string) (p *hashParams, s, h []byte, err error)

func GeneratePHC

func GeneratePHC(password string) (phc string, err error)

func GenerateSalt

func GenerateSalt(s uint32) (b []byte, err error)

func ParseNewsletter

func ParseNewsletter(newsletter interface{}) (err error)

func ValidatePHC

func ValidatePHC(password string, phc string) (err error)

Types

type Body

type Body struct {
	Title string `json:"title"`
	Text  string `json:"text"`
	Html  string `json:"html"`
}

type Credentials

type Credentials struct {
	Username string
	Password string
}

type Newsletter

type Newsletter struct {
	Recipient SubscriberEmail
	Content   *Body
}

type Subscriber

type Subscriber struct {
	ID     string          `json:"id"`
	Email  SubscriberEmail `json:"email" binding:"required"`
	Name   SubscriberName  `json:"name" binding:"required"`
	Status string          `json:"status"`
}

type SubscriberEmail

type SubscriberEmail string

func ParseEmail

func ParseEmail(email string) (subscriber SubscriberEmail, err error)

func (SubscriberEmail) MarshalJSON

func (email SubscriberEmail) MarshalJSON() ([]byte, error)

func (SubscriberEmail) String

func (email SubscriberEmail) String() string

func (*SubscriberEmail) UnmarshalJSON

func (email *SubscriberEmail) UnmarshalJSON(data []byte) (err error)

type SubscriberName

type SubscriberName string

func ParseName

func ParseName(name string) (subscriber SubscriberName, err error)

func (SubscriberName) MarshalJSON

func (name SubscriberName) MarshalJSON() ([]byte, error)

func (SubscriberName) String

func (name SubscriberName) String() string

func (*SubscriberName) UnmarshalJSON

func (name *SubscriberName) UnmarshalJSON(data []byte) (err error)

Jump to

Keyboard shortcuts

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