package database import ( "database/sql" "log" ) type Fren struct { Id string Name string } func FindFren(dbConn *sql.DB, id string) (*Fren, error) { row := dbConn.QueryRow(`SELECT id, name FROM frens WHERE id = ?;`, id) var fren Fren err := row.Scan(&fren.Id, &fren.Name) if err != nil { log.Println(err) return nil, err } return &fren, nil } func FindFrenByName(dbConn *sql.DB, name string) (*Fren, error) { row := dbConn.QueryRow(`SELECT id, name FROM frens WHERE name = ?;`, name) var fren Fren err := row.Scan(&fren.Id, &fren.Name) if err != nil { log.Println(err) return nil, err } return &fren, nil }