-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
1,264 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace SqlFun.MsDataSql.AssemblyInfo | ||
|
||
open System.Reflection | ||
open System.Runtime.CompilerServices | ||
open System.Runtime.InteropServices | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[<assembly: AssemblyTitle("SqlFun.MsDataSql")>] | ||
[<assembly: AssemblyDescription("")>] | ||
[<assembly: AssemblyConfiguration("")>] | ||
[<assembly: AssemblyCompany("")>] | ||
[<assembly: AssemblyProduct("SqlFun")>] | ||
[<assembly: AssemblyCopyright("Copyright © 2017")>] | ||
[<assembly: AssemblyTrademark("")>] | ||
[<assembly: AssemblyCulture("")>] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[<assembly: ComVisible(false)>] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[<assembly: Guid("194ea1bf-80f6-405c-8986-a4fef7cdfaa3")>] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [<assembly: AssemblyVersion("1.0.*")>] | ||
[<assembly: AssemblyVersion("2.4.0.*")>] | ||
[<assembly: AssemblyFileVersion("2.4.0.*")>] | ||
|
||
do | ||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<DefineConstants>NET60;MS_DATA_SQLCLIENT</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="AssemblyInfo.fs" /> | ||
<Compile Include="..\SqlFun\MsSql.fs" Link="MsSql.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\SqlFun.Net6\SqlFun.Net6.fsproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace SqlFun.AssemblyInfo | ||
|
||
open System.Reflection | ||
open System.Runtime.CompilerServices | ||
open System.Runtime.InteropServices | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[<assembly: AssemblyTitle("SqlFun.MsSql")>] | ||
[<assembly: AssemblyDescription("")>] | ||
[<assembly: AssemblyConfiguration("")>] | ||
[<assembly: AssemblyCompany("")>] | ||
[<assembly: AssemblyProduct("SqlFun")>] | ||
[<assembly: AssemblyCopyright("Copyright © 2017")>] | ||
[<assembly: AssemblyTrademark("")>] | ||
[<assembly: AssemblyCulture("")>] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[<assembly: ComVisible(false)>] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[<assembly: Guid("194ea1bf-80f6-405c-8986-a4fef7cdfaa3")>] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [<assembly: AssemblyVersion("1.0.*")>] | ||
[<assembly: AssemblyVersion("2.4.0.*")>] | ||
[<assembly: AssemblyFileVersion("2.4.0.*")>] | ||
|
||
do | ||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<connectionStrings> | ||
<add name="SqlFunTests" connectionString="server=localhost;database=sqlfuntest;uid=jacenty;pwd=Mobutu-216;AllowLoadLocalInfile=True;" providerName="MySql" /> | ||
</connectionStrings> | ||
<startup> | ||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> | ||
</startup> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace SqlFun.NpgSql.Tests.AssemblyInfo | ||
|
||
open System.Reflection | ||
open System.Runtime.CompilerServices | ||
open System.Runtime.InteropServices | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[<assembly: AssemblyTitle("SqlFun.MySql.Tests")>] | ||
[<assembly: AssemblyDescription("")>] | ||
[<assembly: AssemblyConfiguration("")>] | ||
[<assembly: AssemblyCompany("")>] | ||
[<assembly: AssemblyProduct("SqlFun.MySqlConnector.Tests")>] | ||
[<assembly: AssemblyCopyright("Copyright © 2023")>] | ||
[<assembly: AssemblyTrademark("")>] | ||
[<assembly: AssemblyCulture("")>] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[<assembly: ComVisible(false)>] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[<assembly: Guid("36916a8b-57f1-45fd-a088-6862c07758a0")>] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [<assembly: AssemblyVersion("1.0.*")>] | ||
[<assembly: AssemblyVersion("1.0.0.0")>] | ||
[<assembly: AssemblyFileVersion("1.0.0.0")>] | ||
|
||
do | ||
() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace SqlFun.MySql.Tests | ||
|
||
module Common = | ||
open System.Configuration | ||
open SqlFun | ||
open SqlFun.Queries | ||
open SqlFun.GeneratorConfig | ||
open MySqlConnector | ||
|
||
let createConnection () = | ||
let config = ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetExecutingAssembly().Location) | ||
new MySqlConnection(config.ConnectionStrings.ConnectionStrings.["SqlFunTests"].ConnectionString) | ||
|
||
let generatorConfig = createDefaultConfig createConnection | ||
|
||
let run f = DbAction.run createConnection f | ||
|
||
let runAsync f = AsyncDb.run createConnection f | ||
|
||
let sql commandText = sql generatorConfig commandText | ||
|
||
let proc name = proc generatorConfig name | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
namespace SqlFun.MySql.Tests | ||
|
||
open System | ||
open SqlFun | ||
open Common | ||
|
||
module Data = | ||
|
||
type Comment = { | ||
id: int | ||
postId: int | ||
parentId: int option | ||
content: string | ||
author: string | ||
createdAt: DateTime | ||
replies: Comment list | ||
} | ||
|
||
type Tag = { | ||
postId: int | ||
name: string | ||
} | ||
|
||
type PostStatus = | ||
| [<EnumValue("N")>] New = 0 | ||
| [<EnumValue("P")>] Published = 1 | ||
| [<EnumValue("A")>] Archived = 2 | ||
|
||
type Post = { | ||
id: int | ||
blogId: int | ||
name: string | ||
title: string | ||
content: string | ||
author: string | ||
createdAt: DateTime | ||
modifiedAt: DateTime option | ||
modifiedBy: string option | ||
status: PostStatus | ||
comments: Comment list | ||
tags: Tag list | ||
} | ||
|
||
type Signature = { | ||
author: string | ||
createdAt: DateTime | ||
modifiedAt: DateTime option | ||
modifiedBy: string option | ||
status: PostStatus | ||
} | ||
|
||
type Blog = { | ||
id: int | ||
name: string | ||
title: string | ||
description: string | ||
owner: string | ||
createdAt: DateOnly | ||
modifiedAt: DateOnly option | ||
modifiedBy: string option | ||
posts: Post list | ||
} | ||
|
||
|
||
type UserProfile = { | ||
id: string | ||
name: string | ||
email: string | ||
avatar: byte array | ||
} | ||
|
||
|
||
open Data | ||
|
||
module Tooling = | ||
|
||
let getNumberOfBlogs: IDataContext -> int = | ||
sql "select count(*) from blog" | ||
|
||
let deleteAllButFirstBlog: IDataContext -> unit = | ||
sql "delete from blog where id > 1" | ||
|
||
let deleteAllUsers: IDataContext -> unit = | ||
sql "delete from userprofile" |
Oops, something went wrong.