func SelectAllEquipmentInfo(dbm *gorp.DbMap) ([]EquipmentInfo, error) { var results []EquipmentInfo q := sq.Select( `"EquipmentInfo"."ID"`, `"EquipmentInfo"."CertifiedName"`, `"RadioAccessTechnology"."Description" AS EquipmentType`, `"EquipmentInfo"."Model"`, `"EquipmentInfo"."AuthNumber"`, `"EquipmentInfo"."RadioType"`, `"EquipmentInfo"."IsApplied1421"`, `"EquipmentInfo"."AuthDate"`, `"EquipmentInfo"."Note"`, `"EquipmentInfo"."File"`, ).From( "EquipmentInfo", ).LeftJoin( `"RadioAccessTechnology" ON "EquipmentInfo"."EquipmentType" = "RadioAccessTechnology"."EquipmentType"`, ) sql, _, err := q.ToSql() if err != nil { return results, err } if _, err := dbm.Select(&results, sql); err != nil { return nil, err } return results, nil }