models

package
v0.0.0-...-6b49015 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID     string  `json:"id"`
	Title  string  `json:"title"`
	Artist string  `json:"artist"`
	Price  float64 `json:"price"`
}

Album represents data about a record album.

type AlbumModel

type AlbumModel struct {
	DbPool *pgxpool.Pool
}

Custom AlbumModel type which wraps the connection pool.

func (AlbumModel) GetAll

func (m AlbumModel) GetAll(c context.Context) ([]Album, error)

Fetch all albums from the database.

func (AlbumModel) GetByID

func (m AlbumModel) GetByID(c context.Context, id int) (*Album, error)

Fetch an album from the database by its ID.

func (AlbumModel) Insert

func (m AlbumModel) Insert(c context.Context, a Album) error

Insert a new album into the database

Jump to

Keyboard shortcuts

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