Skip to content

Commit 568bc04

Browse files
[release] [minor] remove redundant option filePerQuery (#66)
1 parent cb1947b commit 568bc04

File tree

4 files changed

+3
-15
lines changed

4 files changed

+3
-15
lines changed

CodeGenerator/CodeGenerator.cs

+1-4
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,7 @@ public Task<GenerateResponse> Generate(GenerateRequest generateRequest)
112112
Dictionary<string, Query[]> GetFileQueries()
113113
{
114114
return generateRequest.Queries
115-
.GroupBy(query =>
116-
Options.FilePerQuery
117-
? $"{query.Name}Query"
118-
: QueryFilenameToClassName(query.Filename))
115+
.GroupBy(query => QueryFilenameToClassName(query.Filename))
119116
.ToDictionary(
120117
group => group.Key,
121118
group => group.ToArray());

PluginOptions/Options.cs

-3
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ public Options(GenerateRequest generateRequest)
2121

2222
Enum.TryParse(rawOptions.DriverName, true, out DriverName outDriverName);
2323
DriverName = outDriverName;
24-
FilePerQuery = rawOptions.FilePerQuery;
2524
GenerateCsproj = rawOptions.GenerateCsproj;
2625
DotnetFramework = DotnetFrameworkExtensions.ParseName(rawOptions.TargetFramework);
2726
}
@@ -30,7 +29,5 @@ public Options(GenerateRequest generateRequest)
3029

3130
public DotnetFramework DotnetFramework { get; }
3231

33-
public bool FilePerQuery { get; }
34-
3532
public bool GenerateCsproj { get; }
3633
}

PluginOptions/RawOptions.cs

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ namespace SqlcGenCsharp;
44

55
internal class RawOptions
66
{
7-
[JsonPropertyName("driver")] public required string DriverName { get; init; }
7+
[JsonPropertyName("driver")]
8+
public required string DriverName { get; init; }
89

910
[JsonPropertyName("generateCsproj")]
1011
public bool GenerateCsproj { get; init; } = true; // generating .csproj files by default
1112

1213
[JsonPropertyName("targetFramework")]
1314
public string TargetFramework { get; init; } = DotnetFramework.Dotnet80.ToName();
14-
15-
[JsonPropertyName("filePerQuery")] public bool FilePerQuery { get; init; } // generating single file by default
1615
}

README.md

-5
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,12 @@
33
# sqlc-gen-csharp
44
## Usage
55

6-
### Supported SQL Engines
7-
- MySQL via [MySqlConnector](https://www.nuget.org/packages/MySqlConnector) package - [MySqlConnectorDriver](MySqlConnectorDriver/MySqlConnectorDriver.csproj)
8-
- PostgreSQL via [Npgsql](https://www.nuget.org/packages/Npgsql) package - [NpgsqlDriver](NpgsqlDriver/NpgsqlDriver.csproj)
9-
106
### Options
117
| Option | Possible values | Optional | Info |
128
|-----------------|----------------------------------------------------------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
139
| driver | <br/>values: `MySqlConnector`,`Npgsql` | No | Choosing the driver to use - refer to the [above](#supported-sql-engines) section on supported SQL engines. |
1410
| targetFramework | default: `net8.0`<br/>values: `netstandard2.0`, `netstandard2.1`, `net8.0` | Yes | Determines the target framework for your generated code, meaning the generated code will be compiled to the specified runtime.<br/>For more information and help deciding on the right value, refer to the [Microsoft .NET Standard documentation](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-1-0). |
1511
| generateCsproj | default: `true`<br/>values: `false`,`true` | Yes | Assists you with the integration of SQLC and csharp by generating a `.csproj` file. This converts the generated output to a .dll, a project that you can easily incorporate into your build process. |
16-
| filePerQuery | default: `false`<br/>values: `false`,`true` | Yes | This option allows users control on which `.cs` files to generate, when false it's one file per `.sql` SQLC query file, and when true it's one file per query. |
1712

1813
### Configuration
1914
```yaml

0 commit comments

Comments
 (0)