models

package
v0.0.0-...-517d9f4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package models Time : 2022/1/7 3:26 PM Author : xushiyin contact : yuqingxushiyin@gmail.com

Package models Time : 2021/11/21 10:34 上午 Author : xushiyin contact : yuqingxushiyin@gmail.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAlbum

func AddAlbum(alb Album) (int64, error)

AddAlbum adds the specified album to the database, returning the album ID of the new entry

func MakeDBRequest

func MakeDBRequest() error

func NewDbConfig

func NewDbConfig(user, password, net, addr, dbName string) *mysql.Config

func OpenDb

func OpenDb(cfg *mysql.Config) error

Types

type Album

type Album struct {
	ID     int64
	Title  string
	Artist string
	Price  float32
}

func AlbumByID

func AlbumByID(id int64) (Album, error)

AlbumByID queries for the album with the specified ID.

func AlbumsByArtist

func AlbumsByArtist(name string) ([]Album, error)

AlbumsByArtist queries for albums that have the specified artist name.

type Person

type Person struct {
	Id        uint   `db:"id"`
	FirstName string `db:"first_name"`
	LastName  string `db:"last_name"`
	Email     string `db:"email"`
}

type Place

type Place struct {
	Id      uint           `db:"id"`
	Country string         `db:"country"`
	City    sql.NullString `db:"city"`
	TelCode int            `db:"tel_code"`
}

Jump to

Keyboard shortcuts

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