adamdruppe / arsd

This is a collection of modules that I've released over the years. Most of them stand alone, or have just one or two dependencies in here, so you don't have to download this whole repo.
http://arsd-official.dpldocs.info/arsd.html
531 stars 125 forks source link

Get sorted result in Postgres #365

Closed AlexanderZhirov closed 1 year ago

AlexanderZhirov commented 1 year ago

Is it possible to add sorting when getting the result? asc and desc do not affect the query result.

adamdruppe commented 1 year ago

What is your query? This is a standard sql thing so must be something in there you missed...

AlexanderZhirov commented 1 year ago

What is your query? This is a standard sql thing so must be something in there you missed...

Here's an example. I set the sorting by field, but the sorting does not affect the final result.

изображение

AlexanderZhirov commented 1 year ago

I think the problem is here row.toAA()

adamdruppe commented 1 year ago

Why is that row.toAA there anyway? Looks like you don't need it at all and yes, D's AAs are not sorted so.... just don't that and things will work better..

You can foreach(key, value; row) without converting to an AA at all.

AlexanderZhirov commented 1 year ago

You can foreach(key, value; row) without converting to an AA at all.

Yes, thanks. Otherwise, I was thinking of using an associative array for my needs.