-
Notifications
You must be signed in to change notification settings - Fork 2
/
Types.fs
55 lines (38 loc) · 1.4 KB
/
Types.fs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
namespace Services
open FSharp.Data
open SwaggerProvider
open FSharp.Data.Sql
open System.Data
[<AutoOpen>]
module ProvidedTypes =
[<Literal>]
let dbVendor = Common.DatabaseProviderTypes.POSTGRESQL
[<Literal>]
let connString =
"User ID=postgres;Password=postgres;Host=localhost;Port=5432;Database=sqlprovider;"
[<Literal>]
let owner = "public, admin, references"
[<Literal>]
let resPath =
__SOURCE_DIRECTORY__ + "../../../../.nuget/packages/npgsql/8.0.2/lib/net8.0"
[<Literal>]
let indivAmount = 1000
[<Literal>]
let useOptTypes = Common.NullableColumnType.NO_OPTION
type sql =
SqlDataProvider<DatabaseVendor=dbVendor, ConnectionString=connString, ResolutionPath=resPath, UseOptionTypes=useOptTypes, Owner=owner>
let ctxFactory connectionStringRuntime =
sql.GetDataContext(connectionStringRuntime: string)
type PetsEndpointProvider = OpenApiClientProvider<"https://petstore.swagger.io/v2/swagger.json">
let petsClientFactory httpClient = PetsEndpointProvider.Client(httpClient)
[<CLIMutable>]
type PersonDto =
{ Name: string
Age: int
Id: int }
static member Map(person: sql.dataContext.``dbo.PersonsEntity``) =
{ Name = person.Name
Age = person.Age
Id = person.Id }
type AppSettingsProvider = JsonProvider<"appsettings.json">
type AppSettings = AppSettingsProvider.Root