16 lines
348 B
Go
16 lines
348 B
Go
package operations
|
|
|
|
import (
|
|
"database/sql"
|
|
"sevenkeys/database/entities"
|
|
)
|
|
|
|
func GetGamepieceByName(db *sql.DB, name string) (entities.Gamepiece, error) {
|
|
var gamepiece entities.Gamepiece
|
|
|
|
query := "SELECT Id, Name FROM Gamepiece WHERE Name = ?;"
|
|
err := db.QueryRow(query, name).Scan(&gamepiece.Id, &gamepiece.Name)
|
|
|
|
return gamepiece, err
|
|
}
|