Documentation ¶
Index ¶
Constants ¶
View Source
const ( ErrNotFound = privateError("resource not found") ErrIDInvalid = privateError("ID has an invalid value") ErrUserPasswordHashRequired = privateError("password hash is required") ErrUserRememberHashRequired = privateError("remember hash is required") ErrUserRememberTooShort = privateError("remember token must be at least 32 bytes long") ErrRecipeUserIDRequired = privateError("user ID is required") ErrUserPasswordRequired = publicError("password is required") ErrUserEmailRequired = publicError("email is required") ErrUserNameRequired = publicError("full name is required") ErrUserPasswordTooShort = publicError("password must be at least 8 characters long") ErrUserEmailInvalid = publicError("email provided has an invalid format") ErrUserEmailTaken = publicError("email is already taken") ErrUserCredentialsInvalid = publicError("email or password provided is invalid") ErrRecipeTitleRequired = publicError("recipe title is required") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Image ¶
func (*Image) RelativePath ¶
type ImageService ¶
type ImageService interface { Create(uint, io.Reader, string) error ByRecipeID(uint) ([]Image, error) Delete(*Image) error }
func NewImageService ¶
func NewImageService() ImageService
type Recipe ¶
type Recipe struct { gorm.Model UserID uint `gorm:"not null;index"` Title string `gorm:"not null"` Description string Ingredients string Instructions string Images []Image `gorm:"-"` }
func (*Recipe) ImagesSplitN ¶
type RecipeService ¶
type RecipeService interface { RecipeDB }
func NewRecipesService ¶
func NewRecipesService(db *gorm.DB) RecipeService
type Services ¶
type Services struct { User UserService Recipe RecipeService Image ImageService // contains filtered or unexported fields }
func NewServices ¶
func NewServices(cfgs ...ServicesConfig) (*Services, error)
func (*Services) AutoMigrate ¶
func (*Services) DestructiveReset ¶
type ServicesConfig ¶
func WithGorm ¶
func WithGorm(connInfo string) ServicesConfig
func WithImage ¶
func WithImage() ServicesConfig
func WithLogMode ¶
func WithLogMode(enabled bool) ServicesConfig
func WithRecipe ¶
func WithRecipe() ServicesConfig
func WithUser ¶
func WithUser(hmacKey, pepper string) ServicesConfig
type UserService ¶
func NewUserService ¶
func NewUserService(db *gorm.DB, hmacKey, pepper string) UserService
Click to show internal directories.
Click to hide internal directories.