aboutsummaryrefslogtreecommitdiff
path: root/dropped/docker/crupest-api/CrupestApi/CrupestApi.Commons/Crud/IClause.cs
blob: 964a669cab16aacabfc06b07d3607901933c7fdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using Dapper;

namespace CrupestApi.Commons.Crud;

public interface IClause
{
    IEnumerable<IClause> GetSubclauses()
    {
        return Enumerable.Empty<IClause>();
    }

    IEnumerable<string> GetRelatedColumns()
    {
        var subclauses = GetSubclauses();
        var result = new List<string>();
        foreach (var subclause in subclauses)
        {
            var columns = subclause.GetRelatedColumns();
            if (columns is not null)
                result.AddRange(columns);
        }
        return result;
    }
}