v1.0.2 Albums

main 1.0.2
parent 60128ac058
commit 2b38a8a01d

@ -21,25 +21,30 @@ func Connect() (*Sea, error) {
return &sea, nil
}
func openDB() (*sqlx.DB, error) {
db, err := sqlx.Open("mysql", "itman:X753951x@(xigmanas:3306)/sea")
if err != nil {
return nil, err
}
return db, nil
}
// ============= ALBUM ============
type Album struct {
Seria string
Cnt int
Hash string
}
// func getAlbums(db *sqlx.DB) []Album {
// cmd := "call getAlbums()"
// var albums []Album
// err := db.Select(&albums, cmd)
// return albums
// }
func openDB() (*sqlx.DB, error) {
db, err := sqlx.Open("mysql", "itman:X753951x@(xigmanas:3306)/sea")
func (s *Sea) Albums(db *sqlx.DB) ([]Album, error) {
cmd := "call getAlbums()"
var albums []Album
err := db.Select(&albums, cmd)
if err != nil {
return nil, err
}
return db, nil
return albums, nil
}

Loading…
Cancel
Save