Documentation ¶
Index ¶
- Constants
- Variables
- func MigrateFS(migrationFS fs.FS, dir string) error
- func Open(config PostgresConfig) (*pgxpool.Pool, error)
- type Email
- type EmailService
- type Gallery
- type GalleryService
- func (g *GalleryService) Create(title string, userID int) (*Gallery, error)
- func (g *GalleryService) CreateImage(galleryID int, filename string, contents io.Reader) error
- func (g *GalleryService) DeleteGalleryByID(id int) error
- func (g *GalleryService) DeleteImage(galleryID int, filename string) error
- func (g *GalleryService) GetGalleriesByUserID(userID int) ([]Gallery, error)
- func (g *GalleryService) GetGalleryByID(id int) (*Gallery, error)
- func (g *GalleryService) Image(galleryID int, filename string) (Image, error)
- func (g *GalleryService) Images(galleryID int) ([]Image, error)
- func (g *GalleryService) UpdateGallery(gallery Gallery) error
- type Image
- type PasswordReset
- type PasswordResetService
- type PostgresConfig
- type SMTPConfig
- type Session
- type SessionService
- type User
- type UserService
Constants ¶
View Source
const DefaultResetDuration = 1 * time.Hour
View Source
const DefaultSender = "support@toucan.com"
Variables ¶
View Source
var ( ErrNotFound = errors.New("email or password was wrong") ErrGalleryNotFound = errors.New("Gallery not found") )
Functions ¶
Types ¶
type EmailService ¶
type EmailService struct { DefaultSender string // contains filtered or unexported fields }
func NewEmailService ¶
func NewEmailService() *EmailService
func (EmailService) ForgotPassword ¶
func (es EmailService) ForgotPassword(to, resetURL string) error
func (*EmailService) Send ¶
func (es *EmailService) Send(email Email) error
type GalleryService ¶
func (*GalleryService) Create ¶
func (g *GalleryService) Create(title string, userID int) (*Gallery, error)
func (*GalleryService) CreateImage ¶
func (*GalleryService) DeleteGalleryByID ¶
func (g *GalleryService) DeleteGalleryByID(id int) error
func (*GalleryService) DeleteImage ¶
func (g *GalleryService) DeleteImage(galleryID int, filename string) error
func (*GalleryService) GetGalleriesByUserID ¶
func (g *GalleryService) GetGalleriesByUserID(userID int) ([]Gallery, error)
GetGalleriesByUserID returns all galleries for a given user
func (*GalleryService) GetGalleryByID ¶
func (g *GalleryService) GetGalleryByID(id int) (*Gallery, error)
func (*GalleryService) Image ¶
func (g *GalleryService) Image(galleryID int, filename string) (Image, error)
func (*GalleryService) UpdateGallery ¶
func (g *GalleryService) UpdateGallery(gallery Gallery) error
type PasswordReset ¶
type PasswordResetService ¶
func (*PasswordResetService) Consume ¶
func (p *PasswordResetService) Consume(token string) (*User, error)
func (*PasswordResetService) Create ¶
func (p *PasswordResetService) Create(email string) (*PasswordReset, error)
type PostgresConfig ¶
type PostgresConfig struct { Host string Port string User string Password string Database string SSLMode string }
func DefaultPostgresConfig ¶
func DefaultPostgresConfig() PostgresConfig
func (PostgresConfig) String ¶
func (cfg PostgresConfig) String() string
type SMTPConfig ¶
SMTPConfig load field from env
type SessionService ¶
func (*SessionService) Delete ¶
func (ss *SessionService) Delete(value string) error
type UserService ¶
func (*UserService) Authenticate ¶
func (us *UserService) Authenticate(email, password string) (*User, error)
func (*UserService) CheckUserExist ¶
func (us *UserService) CheckUserExist(email string) (bool, error)
check user exists
func (*UserService) UpdatePassword ¶
func (us *UserService) UpdatePassword(userID int, password string) error
Click to show internal directories.
Click to hide internal directories.