func IsExist(login string) (bool, string, string, string) {
	db := connect.DBConnect()
	var id, hash, salt string
	query := connect.DBSelect("users", []string{"login"}, "id", "password", "salt")
	stmt, err := db.Prepare(query)
	utils.HandleErr("[IsExist] Prepare: ", err)
	defer connect.DBClose(db, stmt)
	err = stmt.QueryRow(login).Scan(&id, &hash, &salt)
	return err != sql.ErrNoRows, id, hash, salt
}
func (this Entity) Select(where map[string]interface{}, fields ...string) []interface{} {
	keys := make([]string, len(where))
	vals := make([]interface{}, len(where))
	j := 0
	for i, v := range where {
		keys[j] = i
		vals[j] = v
		j++
	}
	db := connect.DBConnect()
	query := connect.DBSelect(this.TableName, keys, fields...)
	stmt, err := db.Prepare(query)
	utils.HandleErr("[Entity.Select] Prepare: ", err)
	defer connect.DBClose(db, stmt)

	rows, err := stmt.Query(vals...)
	utils.HandleErr("[Entity.Select] Query: ", err)

	rowsInf, err := stmt.Exec(vals...)
	utils.HandleErr("[Entity.Select] Exec: ", err)

	columns, err := rows.Columns()
	utils.HandleErr("[Entity.Select] Columns: ", err)

	row := make([]interface{}, len(columns))
	values := make([]interface{}, len(columns))
	for i, _ := range row {
		row[i] = &values[i]
	}

	l, err := rowsInf.RowsAffected()
	utils.HandleErr("[Entity.Select] RowsAffected: ", err)
	answer := make([]interface{}, l)
	j = 0

	for rows.Next() {
		rows.Scan(row...)
		answer[j] = make(map[string]interface{}, len(values))
		record := make(map[string]interface{}, len(values))
		for i, col := range values {
			if col != nil {
				fmt.Printf("\n%s: type= %s\n", columns[i], reflect.TypeOf(col))
				switch col.(type) {
				default:
					utils.HandleErr("Entity.Select: Unexpected type.", nil)
				case bool:
					record[columns[i]] = col.(bool)
				case int:
					record[columns[i]] = col.(int)
				case int64:
					record[columns[i]] = col.(int64)
				case float64:
					record[columns[i]] = col.(float64)
				case string:
					record[columns[i]] = col.(string)
				case []byte:
					record[columns[i]] = string(col.([]byte))
				case []int8:
					record[columns[i]] = col.([]string)
				case time.Time:
					record[columns[i]] = col
				}
			}
			answer[j] = record
		}
		j++
	}
	return answer
}