namespace BitBadger.Documents.Sqlite.Compat open BitBadger.Documents open BitBadger.Documents.Sqlite [<AutoOpen>] module Parameters = /// Create a JSON field parameter [<CompiledName "AddField">] [<System.Obsolete "Use addFieldParams (F#) / AddFields (C#) instead ~ will be removed in v4.1">] let addFieldParam name field parameters = addFieldParams [ { field with ParameterName = Some name } ] parameters /// Append JSON field name parameters for the given field names to the given parameters [<CompiledName "FieldName">] [<System.Obsolete "Use fieldNameParams (F#) / FieldNames (C#) instead ~ will be removed in v4.1">] let fieldNameParam fieldNames = fieldNameParams fieldNames [<RequireQualifiedAccess>] module Query = /// Create a WHERE clause fragment to implement a comparison on a field in a JSON document [<CompiledName "WhereByField">] [<System.Obsolete "Use WhereByFields instead ~ will be removed in v4.1">] let whereByField field paramName = Query.whereByFields Any [ { field with ParameterName = Some paramName } ] module WithConn = [<RequireQualifiedAccess>] module Count = /// Count matching documents using a JSON field comparison (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field conn = WithConn.Count.byFields tableName Any [ field ] conn [<RequireQualifiedAccess>] module Exists = /// Determine if a document exists using a JSON field comparison (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field conn = WithConn.Exists.byFields tableName Any [ field ] conn [<RequireQualifiedAccess>] module Find = /// Retrieve documents matching a JSON field comparison (->> =) [<CompiledName "FSharpByField">] [<System.Obsolete "Use byFields instead ~ will be removed in v4.1">] let byField<'TDoc> tableName field conn = WithConn.Find.byFields<'TDoc> tableName Any [ field ] conn /// Retrieve documents matching a JSON field comparison (->> =) [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let ByField<'TDoc>(tableName, field, conn) = WithConn.Find.ByFields<'TDoc>(tableName, Any, Seq.singleton field, conn) /// Retrieve the first document matching a JSON field comparison (->> =); returns None if not found [<CompiledName "FSharpFirstByField">] [<System.Obsolete "Use firstByFields instead ~ will be removed in v4.1">] let firstByField<'TDoc> tableName field conn = WithConn.Find.firstByFields<'TDoc> tableName Any [ field ] conn /// Retrieve the first document matching a JSON field comparison (->> =); returns null if not found [<System.Obsolete "Use FirstByFields instead ~ will be removed in v4.1">] let FirstByField<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, field, conn) = WithConn.Find.FirstByFields<'TDoc>(tableName, Any, Seq.singleton field, conn) [<RequireQualifiedAccess>] module Patch = /// Patch documents using a JSON field comparison query in the WHERE clause (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field (patch: 'TPatch) conn = WithConn.Patch.byFields tableName Any [ field ] patch conn [<RequireQualifiedAccess>] module RemoveFields = /// Remove fields from documents via a comparison on a JSON field in the document [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field fieldNames conn = WithConn.RemoveFields.byFields tableName Any [ field ] fieldNames conn [<RequireQualifiedAccess>] module Delete = /// Delete documents by matching a JSON field comparison query (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field conn = WithConn.Delete.byFields tableName Any [ field ] conn [<RequireQualifiedAccess>] module Count = /// Count matching documents using a JSON field comparison (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field = Count.byFields tableName Any [ field ] [<RequireQualifiedAccess>] module Exists = /// Determine if a document exists using a JSON field comparison (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field = Exists.byFields tableName Any [ field ] [<RequireQualifiedAccess>] module Find = /// Retrieve documents matching a JSON field comparison (->> =) [<CompiledName "FSharpByField">] [<System.Obsolete "Use byFields instead ~ will be removed in v4.1">] let byField<'TDoc> tableName field = Find.byFields<'TDoc> tableName Any [ field ] /// Retrieve documents matching a JSON field comparison (->> =) [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let ByField<'TDoc>(tableName, field) = Find.ByFields<'TDoc>(tableName, Any, Seq.singleton field) /// Retrieve the first document matching a JSON field comparison (->> =); returns None if not found [<CompiledName "FSharpFirstByField">] [<System.Obsolete "Use firstByFields instead ~ will be removed in v4.1">] let firstByField<'TDoc> tableName field = Find.firstByFields<'TDoc> tableName Any [ field ] /// Retrieve the first document matching a JSON field comparison (->> =); returns null if not found [<System.Obsolete "Use FirstByFields instead ~ will be removed in v4.1">] let FirstByField<'TDoc when 'TDoc: null and 'TDoc: not struct>(tableName, field) = Find.FirstByFields<'TDoc>(tableName, Any, Seq.singleton field) [<RequireQualifiedAccess>] module Patch = /// Patch documents using a JSON field comparison query in the WHERE clause (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field (patch: 'TPatch) = Patch.byFields tableName Any [ field ] patch [<RequireQualifiedAccess>] module RemoveFields = /// Remove fields from documents via a comparison on a JSON field in the document [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field fieldNames = RemoveFields.byFields tableName Any [ field ] fieldNames [<RequireQualifiedAccess>] module Delete = /// Delete documents by matching a JSON field comparison query (->> =) [<CompiledName "ByField">] [<System.Obsolete "Use ByFields instead ~ will be removed in v4.1">] let byField tableName field = Delete.byFields tableName Any [ field ] open Microsoft.Data.Sqlite /// F# Extensions for the NpgsqlConnection type [<AutoOpen>] module Extensions = type SqliteConnection with /// Count matching documents using a JSON field comparison query (->> =) [<System.Obsolete "Use countByFields instead ~ will be removed in v4.1">] member conn.countByField tableName field = conn.countByFields tableName Any [ field ] /// Determine if documents exist using a JSON field comparison query (->> =) [<System.Obsolete "Use existsByFields instead ~ will be removed in v4.1">] member conn.existsByField tableName field = conn.existsByFields tableName Any [ field ] /// Retrieve documents matching a JSON field comparison query (->> =) [<System.Obsolete "Use findByFields instead ~ will be removed in v4.1">] member conn.findByField<'TDoc> tableName field = conn.findByFields<'TDoc> tableName Any [ field ] /// Retrieve the first document matching a JSON field comparison query (->> =); returns None if not found [<System.Obsolete "Use findFirstByFields instead ~ will be removed in v4.1">] member conn.findFirstByField<'TDoc> tableName field = conn.findFirstByFields<'TDoc> tableName Any [ field ] /// Patch documents using a JSON field comparison query in the WHERE clause (->> =) [<System.Obsolete "Use patchByFields instead ~ will be removed in v4.1">] member conn.patchByField tableName field (patch: 'TPatch) = conn.patchByFields tableName Any [ field ] patch /// Remove fields from documents via a comparison on a JSON field in the document [<System.Obsolete "Use removeFieldsByFields instead ~ will be removed in v4.1">] member conn.removeFieldsByField tableName field fieldNames = conn.removeFieldsByFields tableName Any [ field ] fieldNames /// Delete documents by matching a JSON field comparison query (->> =) [<System.Obsolete "Use deleteByFields instead ~ will be removed in v4.1">] member conn.deleteByField tableName field = conn.deleteByFields tableName Any [ field ] open System.Runtime.CompilerServices type SqliteConnectionCSharpCompatExtensions = /// Count matching documents using a JSON field comparison query (->> =) [<Extension>] [<System.Obsolete "Use CountByFields instead ~ will be removed in v4.1">] static member inline CountByField(conn, tableName, field) = WithConn.Count.byFields tableName Any [ field ] conn /// Determine if documents exist using a JSON field comparison query (->> =) [<Extension>] [<System.Obsolete "Use ExistsByFields instead ~ will be removed in v4.1">] static member inline ExistsByField(conn, tableName, field) = WithConn.Exists.byFields tableName Any [ field ] conn /// Retrieve documents matching a JSON field comparison query (->> =) [<Extension>] [<System.Obsolete "Use FindByFields instead ~ will be removed in v4.1">] static member inline FindByField<'TDoc>(conn, tableName, field) = WithConn.Find.ByFields<'TDoc>(tableName, Any, [ field ], conn) /// Retrieve the first document matching a JSON field comparison query (->> =); returns null if not found [<Extension>] [<System.Obsolete "Use FindFirstByFields instead ~ will be removed in v4.1">] static member inline FindFirstByField<'TDoc when 'TDoc: null and 'TDoc: not struct>(conn, tableName, field) = WithConn.Find.FirstByFields<'TDoc>(tableName, Any, [ field ], conn) /// Patch documents using a JSON field comparison query in the WHERE clause (->> =) [<Extension>] [<System.Obsolete "Use PatchByFields instead ~ will be removed in v4.1">] static member inline PatchByField(conn, tableName, field, patch: 'TPatch) = WithConn.Patch.byFields tableName Any [ field ] patch conn /// Remove fields from documents via a comparison on a JSON field in the document [<Extension>] [<System.Obsolete "Use RemoveFieldsByFields instead ~ will be removed in v4.1">] static member inline RemoveFieldsByField(conn, tableName, field, fieldNames) = WithConn.RemoveFields.byFields tableName Any [ field ] fieldNames conn /// Delete documents by matching a JSON field comparison query (->> =) [<Extension>] [<System.Obsolete "Use DeleteByFields instead ~ will be removed in v4.1">] static member inline DeleteByField(conn, tableName, field) = WithConn.Delete.byFields tableName Any [ field ] conn