Typesafe dynamic filtering/ordering/paging
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
L’issue non indica file o test del repository. Inizia individuando il percorso del tipo generato da SQL... descritto qui e tracciando come vengono esposte le colonne di output. Il lavoro è completato quando le query idonee con un singolo SELECT supportano valori By type-safe, ordinamento, paginazione e un comando che preserva le clausole applicate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Right now there is no way to dynamically order queries.
This makes the library unsuitable for applications that let the user sort a paged table of records.
That's a lot of applications!
This should be solvable without giving up type safety. Here's the design I have in mind:
Any command that consists of a single SELECT statement which is not known to be a single-row SELECT should be dynamically orderable.
e.g.
type MyQuery = SQL<"select Column1, 1+1 as Column2 from SomeTable">
This means that it gets the following extra stuff in its generated type:
- A nested type
MyQuery.Bywith a private constructor and an overrided ToString(). - Static getters
MyQuery.By.Column1andMyQuery.By.Column2, which return instances ofMyQuery.By - A static method
MyQuery.By.OfString("Column1")which checks that the passed string is one of the statically known output column names.MyQuery.By.OfString(MyQuery.By.Column2.ToString())should work. - A static
OrderBymethod taking aMyQuery.Byand a DUAscending|Descendingand returning aMyQuery.OrderedQuery MyQuery.OrderedQueryhas an instance methodThenBytaking another by+direction,Pagetaking limit+offsetMyQuery.OrderedQueryhas an instanceCommandmethod which is like the regularMyQuery.Command(param1 = ...)method, but includes the orderings applied so far
Hypothetical usage:
type MyQuery = SQL<"select Column1, 1+1 as Column2 from SomeTable where Name like @name">
let example (conn : ConnectionContext) =
MyQuery
.OrderBy(MyQuery.By.Column1, Ascending)
.ThenBy(MyQuery.By.Column2, Descending)
.Page(25, 50)
.Command(name = "%a%")
.Execute(conn)
I think it would be OK to limit to one ThenBy clause. Orderings more complicated than that don't make much sense to generate dynamically.
Thoughts?
- Lingua principale
- F#
- Stelle
- 680
- Fork
- 23
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di fsprojects/Rezoom.SQL
-
fsprojects onboarding Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 20/100
fsprojects/Rezoom.SQL#57 · 1 commento ·
-
Dacpac support info Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
fsprojects/Rezoom.SQL#56 · 1 commento ·
-
Create / Drop Schema support Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 25/100
fsprojects/Rezoom.SQL#52 · 1 commento ·
-
Support for Geography types Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
fsprojects/Rezoom.SQL#50 ·
-
Data type/column type: array Aperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
fsprojects/Rezoom.SQL#48 · 3 commenti ·
Tutte le issue di fsprojects/Rezoom.SQL
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
-
internal.h中,漏掉了1个定义。 Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 95/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
oxc-project/oxc#26944 ·