Incorporate doc lib v4 ordering

This commit is contained in:
2024-08-22 23:00:25 -04:00
parent d4c0e4e26c
commit cc3e41ddc5
15 changed files with 184 additions and 181 deletions
+7 -3
View File
@@ -10,8 +10,8 @@ open MyWebLog.Data
/// SQLite myWebLog theme data implementation
type SQLiteThemeData(conn : SqliteConnection, log: ILogger) =
/// The JSON field for the theme ID
let idField = $"data->>'{nameof Theme.Empty.Id}'"
/// The name of the theme ID field
let idName = nameof Theme.Empty.Id
/// Convert a document to a theme with no template text
let withoutTemplateText (rdr: SqliteDataReader) =
@@ -25,7 +25,11 @@ type SQLiteThemeData(conn : SqliteConnection, log: ILogger) =
/// Retrieve all themes (except 'admin'; excludes template text)
let all () =
log.LogTrace "Theme.all"
conn.customList $"{Query.find Table.Theme} WHERE {idField} <> 'admin' ORDER BY {idField}" [] withoutTemplateText
let fields = [ Field.NE idName "admin" ]
conn.customList
(Query.byFields (Query.find Table.Theme) Any fields + Query.orderBy [ Field.Named idName ] SQLite)
(addFieldParams fields [])
withoutTemplateText
/// Does a given theme exist?
let exists (themeId: ThemeId) =