fsharp(todolist-api): feat: added a working SqlTypeProvider
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
parent
2fd9d0da2e
commit
973fb2c537
|
@ -4,4 +4,6 @@ storage: none
|
||||||
framework: netcore3.1
|
framework: netcore3.1
|
||||||
|
|
||||||
nuget FSharp.Core
|
nuget FSharp.Core
|
||||||
nuget Suave
|
nuget Suave
|
||||||
|
nuget SQLProvider
|
||||||
|
nuget Npgsql
|
|
@ -3,5 +3,122 @@ RESTRICTION: == netcoreapp3.1
|
||||||
NUGET
|
NUGET
|
||||||
remote: https://api.nuget.org/v3/index.json
|
remote: https://api.nuget.org/v3/index.json
|
||||||
FSharp.Core (4.7)
|
FSharp.Core (4.7)
|
||||||
|
Microsoft.NETCore.Platforms (3.1)
|
||||||
|
Microsoft.NETCore.Targets (3.1)
|
||||||
|
Microsoft.Win32.Registry (4.7)
|
||||||
|
System.Security.AccessControl (>= 4.7)
|
||||||
|
System.Security.Principal.Windows (>= 4.7)
|
||||||
|
NETStandard.Library (2.0.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Npgsql (4.1.2)
|
||||||
|
System.Runtime.CompilerServices.Unsafe (>= 4.6)
|
||||||
|
runtime.native.System.Data.SqlClient.sni (4.7)
|
||||||
|
runtime.win-arm64.runtime.native.System.Data.SqlClient.sni (>= 4.4)
|
||||||
|
runtime.win-x64.runtime.native.System.Data.SqlClient.sni (>= 4.4)
|
||||||
|
runtime.win-x86.runtime.native.System.Data.SqlClient.sni (>= 4.4)
|
||||||
|
runtime.win-arm64.runtime.native.System.Data.SqlClient.sni (4.4)
|
||||||
|
runtime.win-x64.runtime.native.System.Data.SqlClient.sni (4.4)
|
||||||
|
runtime.win-x86.runtime.native.System.Data.SqlClient.sni (4.4)
|
||||||
|
SQLProvider (1.1.76)
|
||||||
|
FSharp.Core (>= 3.1.2.5)
|
||||||
|
NETStandard.Library (>= 2.0)
|
||||||
|
System.Console (>= 4.3)
|
||||||
|
System.Data.Common (>= 4.3)
|
||||||
|
System.Data.Odbc (>= 4.5)
|
||||||
|
System.Data.SqlClient (>= 4.4)
|
||||||
|
System.IO (>= 4.3)
|
||||||
|
System.Reflection (>= 4.3)
|
||||||
|
System.Reflection.TypeExtensions (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Runtime.Loader (>= 4.3)
|
||||||
|
System.Runtime.Serialization.Formatters (>= 4.3)
|
||||||
|
System.Runtime.Serialization.Primitives (>= 4.3)
|
||||||
Suave (2.5.6)
|
Suave (2.5.6)
|
||||||
FSharp.Core (>= 4.3.4)
|
FSharp.Core (>= 4.3.4)
|
||||||
|
System.Collections (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Console (4.3.1)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1.2)
|
||||||
|
System.IO (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Text.Encoding (>= 4.3)
|
||||||
|
System.Data.Common (4.3)
|
||||||
|
System.Collections (>= 4.3)
|
||||||
|
System.Globalization (>= 4.3)
|
||||||
|
System.IO (>= 4.3)
|
||||||
|
System.Resources.ResourceManager (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Runtime.Extensions (>= 4.3)
|
||||||
|
System.Text.RegularExpressions (>= 4.3)
|
||||||
|
System.Threading.Tasks (>= 4.3)
|
||||||
|
System.Data.Odbc (4.7)
|
||||||
|
Microsoft.NETCore.Platforms (>= 3.1)
|
||||||
|
System.Data.SqlClient (4.8)
|
||||||
|
Microsoft.Win32.Registry (>= 4.7)
|
||||||
|
runtime.native.System.Data.SqlClient.sni (>= 4.7)
|
||||||
|
System.Security.Principal.Windows (>= 4.7)
|
||||||
|
System.Globalization (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.IO (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Text.Encoding (>= 4.3)
|
||||||
|
System.Threading.Tasks (>= 4.3)
|
||||||
|
System.Reflection (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.IO (>= 4.3)
|
||||||
|
System.Reflection.Primitives (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Reflection.Primitives (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Reflection.TypeExtensions (4.7)
|
||||||
|
System.Resources.ResourceManager (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.Globalization (>= 4.3)
|
||||||
|
System.Reflection (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Runtime (4.3.1)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1.3)
|
||||||
|
System.Runtime.CompilerServices.Unsafe (4.7)
|
||||||
|
System.Runtime.Extensions (4.3.1)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1.3)
|
||||||
|
System.Runtime (>= 4.3.1)
|
||||||
|
System.Runtime.Loader (4.3)
|
||||||
|
System.IO (>= 4.3)
|
||||||
|
System.Reflection (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Runtime.Serialization.Formatters (4.3)
|
||||||
|
System.Collections (>= 4.3)
|
||||||
|
System.Reflection (>= 4.3)
|
||||||
|
System.Resources.ResourceManager (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Runtime.Serialization.Primitives (>= 4.3)
|
||||||
|
System.Runtime.Serialization.Primitives (4.3)
|
||||||
|
System.Resources.ResourceManager (>= 4.3)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Security.AccessControl (4.7)
|
||||||
|
Microsoft.NETCore.Platforms (>= 3.1)
|
||||||
|
System.Security.Principal.Windows (>= 4.7)
|
||||||
|
System.Security.Principal.Windows (4.7)
|
||||||
|
System.Text.Encoding (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
System.Text.RegularExpressions (4.3.1)
|
||||||
|
System.Runtime (>= 4.3.1)
|
||||||
|
System.Threading.Tasks (4.3)
|
||||||
|
Microsoft.NETCore.Platforms (>= 1.1)
|
||||||
|
Microsoft.NETCore.Targets (>= 1.1)
|
||||||
|
System.Runtime (>= 4.3)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
FSharp.Core
|
FSharp.Core
|
||||||
Suave
|
Suave
|
||||||
|
nuget SQLProvider
|
||||||
|
nuget Npgsql
|
12
fsharp/todolist-api/src/Db.fs
Normal file
12
fsharp/todolist-api/src/Db.fs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module Db
|
||||||
|
|
||||||
|
open FSharp.Data.Sql
|
||||||
|
|
||||||
|
[<Literal>]
|
||||||
|
let ConnectionString = "Server=127.0.0.1; Database=todo_api_db; User Id=suave; Password=1234;"
|
||||||
|
|
||||||
|
type Sql = SqlDataProvider<ConnectionString=ConnectionString, DatabaseVendor=Common.DatabaseProviderTypes.POSTGRESQL, CaseSensitivityChange=Common.CaseSensitivityChange.ORIGINAL>
|
||||||
|
|
||||||
|
type DbContext = Sql.dataContext
|
||||||
|
|
||||||
|
type Todo = DbContext.``public.todosEntity``
|
|
@ -5,6 +5,7 @@
|
||||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="src/Db.fs" />
|
||||||
<Compile Include="src/App.fs" />
|
<Compile Include="src/App.fs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project=".paket\Paket.Restore.targets" />
|
<Import Project=".paket\Paket.Restore.targets" />
|
||||||
|
|
Loading…
Reference in a new issue