Skip to content

Commit

Permalink
Add Crud Generation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThorstenThiel committed Oct 4, 2024
1 parent 7a8c8bd commit 0997c13
Show file tree
Hide file tree
Showing 221 changed files with 5,443 additions and 286 deletions.
2 changes: 1 addition & 1 deletion src/Benchmark/Bench.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Benchmark;
public class Bench
{
[Params("postgres", "in-memory")]
public string StorageType { get; set; }
public string StorageType { get; set; } = "in-memory";

[IterationSetup]
public void Setup()
Expand Down
Empty file.
12 changes: 12 additions & 0 deletions src/Fluss.Regen/AnalyzerReleases.Unshipped.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
### New Rules

Rule ID | Category | Severity | Notes
--------|----------|----------|-------
FLUSS0001 | Fluss.Regen | Error | CrudInspector
FLUSS0002 | Fluss.Regen | Error | CrudInspector
FLUSS0003 | Fluss.Regen | Error | CrudInspector
FLUSS0004 | Fluss.Regen | Error | CrudInspector
FLUSS0005 | Fluss.Regen | Error | CrudInspector
FLUSS0006 | Fluss.Regen | Error | CrudInspector
FLUSS0007 | Fluss.Regen | Error | CrudInspector
FLUSS0008 | Fluss.Regen | Error | CrudInspector
20 changes: 20 additions & 0 deletions src/Fluss.Regen/Attributes/CrudAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace Fluss.Regen.Attributes;

public sealed class CrudAttribute : IRegenAttribute
{
private const string Namespace = "Fluss.Regen";
private const string AttributeName = "CrudAttribute";

public static string FullName => $"{Namespace}.{AttributeName}";

public string FileName => $"{AttributeName}.g.cs";
public string SourceCode => $$"""
namespace {{Namespace}}
{
[global::System.AttributeUsage(global::System.AttributeTargets.Class)]
public class {{AttributeName}} : System.Attribute
{
}
}
""";
}
1 change: 0 additions & 1 deletion src/Fluss.Regen/Attributes/IRegenAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@

public interface IRegenAttribute
{
string FileName { get; }
string SourceCode { get; }
}
6 changes: 2 additions & 4 deletions src/Fluss.Regen/Attributes/SelectorAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@ public sealed class SelectorAttribute : IRegenAttribute
private const string AttributeName = "SelectorAttribute";

public static string FullName => $"{Namespace}.{AttributeName}";

public string FileName => $"{AttributeName}.g.cs";
public string SourceCode => $$"""
// <auto-generated/>
namespace {{Namespace}}
{
[System.AttributeUsage(System.AttributeTargets.Method)]
[global::System.AttributeUsage(global::System.AttributeTargets.Method)]
public class {{AttributeName}} : System.Attribute
{
}
Expand Down
Loading

0 comments on commit 0997c13

Please sign in to comment.