Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDuplicateEntry = errors.New("already exists")
View Source
var ErrNoRows = sql.ErrNoRows
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct { Handle *sql.DB Recipe *RecipeTable Ingredient *IngredientTable User *UserTable }
type Ingredient ¶
Ingredient entity
type IngredientTable ¶
type IngredientTable struct {
// contains filtered or unexported fields
}
RecipeTable object
func NewIngredientTable ¶
func NewIngredientTable(db *sql.DB) *IngredientTable
NewIngredientTable create a IngredientTable object
func (*IngredientTable) Get ¶
func (it *IngredientTable) Get(id uint64) (*Ingredient, error)
Get a recipe by id
type Recipe ¶
type Recipe struct { ID int64 Title string URL string Thumbnail string Ingredients Ingredients CreatedAt string UpdatedAt string }
Recipe entity
type RecipeFilters ¶
RecipeFilters object
type RecipeTable ¶
type RecipeTable struct {
// contains filtered or unexported fields
}
RecipeTable object
func (*RecipeTable) Insert ¶
func (rt *RecipeTable) Insert(recipe Recipe) (int64, error)
Insert a new recipe, returns inserted recipe id
func (*RecipeTable) Paginate ¶
func (rt *RecipeTable) Paginate(page uint64, filters *RecipeFilters) (Recipes, int64, error)
Paginate get paginated recipes
type User ¶
type User struct { ID int64 Username string Password string `json:"-"` FullName string Email string Active bool CreatedAt string UpdatedAt string }
User entity
type UserTable ¶
type UserTable struct {
// contains filtered or unexported fields
}
UserTable object
func (*UserTable) GetByUsername ¶
Get user by id
Click to show internal directories.
Click to hide internal directories.