models

package
v0.0.0-...-73a73dd Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CartItem

type CartItem struct {
	Potion   *Potion
	Quantity int
}

func (*CartItem) Subtotal

func (ci *CartItem) Subtotal() float64

type DB

type DB struct {
	Conn *sql.DB
}

func NewDB

func NewDB(dataSourceName string) (*DB, error)

func (*DB) Close

func (db *DB) Close() error

func (*DB) CreateUser

func (db *DB) CreateUser(user *User) error

CreateUser creates a new user

func (*DB) DeleteUser

func (db *DB) DeleteUser(id int64) error

DeleteUser deletes a user by ID

func (*DB) GetUserByEmail

func (db *DB) GetUserByEmail(email string) (*User, error)

GetUserByEmail gets user by email

func (*DB) GetUserByID

func (db *DB) GetUserByID(id int64) (*User, error)

GetUserByID gets user by ID

func (*DB) UpdateUser

func (db *DB) UpdateUser(user *User) error

UpdateUser updates a user

type Potion

type Potion struct {
	ID          int64
	Name        string
	Description string
	Price       float64
	Properties  []string
}

type Review

type Review struct {
	ID       int64
	PotionID int64
	Author   string
	Text     string
	Rating   int
}

type User

type User struct {
	ID       int64
	Username string
	Email    string
	Password string // Store the hashed password, not plaintext
}

Jump to

Keyboard shortcuts

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