使用数据库(DB)

// Connect to the database
// ...

type Row struct {
    language   string
    percentage float32
}

// SQL query execution
statement, _ := conn.Prepare(`
    SELECT
      Language, Percentage
    FROM countrylanguage
    WHERE 
      CountryCode = ? AND
      Percentage > ?`)

// Get all rows
rows, _ := statement.Query("RUS"0.5)
for rows.Next() {
    row := new(Row)
    rows.Scan(&row.language, &row.percentage)
    fmt.Println(row)
}

// Close the connection
conn.Close()