model

package
v0.0.0-...-4131fa7 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authentication

type Authentication struct {
	ID         int       `db:"id"`
	UserID     int       `db:"user_id"`
	ValidUntil time.Time `db:"valid_until"`
	Token      string    `db:"token"`
}

type Image

type Image struct {
	ID        int    `db:"id" json:"id"`
	Path      string `db:"path" json:"path"`
	ProductID int    `db:"product_id" json:"product_id"`
}

type Models

type Models struct {
	Products productsRepo
	Users    usersRepo
	Auth     authRepo
}

func New

func New(sqlDB *sqlx.DB) (Models, error)

type Product

type Product struct {
	ID          int     `db:"id" json:"id"`
	Price       float64 `db:"price" json:"price"`
	Name        string  `db:"name" json:"name"`
	Description string  `db:"description" json:"description"`

	Images []*Image `db:"-" json:"images"`
}

type User

type User struct {
	ID       int    `db:"id"`
	Username string `db:"username"`
	Password string `db:"password"`
}

Jump to

Keyboard shortcuts

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