You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
seaweed/sea.go

31 lines
533 B
Go

package sea
1 year ago
import (
"fmt"
_ "github.com/go-sql-driver/mysql" // для связи с mysql
"github.com/jmoiron/sqlx"
)
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)
checkError("get albums", err)
return albums
}
func openDB() *sqlx.DB {
fmt.Printf("открываю БД sea\n")
db, err := sqlx.Open("mysql", "itman:X753951x@(xigmanas:3306)/sea")
checkError("open db", err)
return db
}