FeiniuBus Database Operating Competents.Offering DynamicQuery, Object Mapper, Linq Builder, Sql Builder and others.
Framework | Support |
---|---|
netstandard2.0 | +Support |
netcoreapp2.0 | +Support |
golang | +Client Only |
Branch | Status | CI |
---|---|---|
master | 2.0.0 | |
milestone/2.0.0 | RELEASED | |
milestone/2.1.0 | PRE |
Utility library for build data query descriptor or convert it to Linq Expression or SQL Statements. Here is a sample
DynamicQueryBuilder builder = DynamicQueryBuilder.Create(true);
var child1 = builder.ParamGroupBuilder.CreateChildAndGroup();
child1.ParamBuilder.Any("Extra", sub =>
{
sub.ParamBuilder.Equal("Guest", "Andy");
});
var child2 = builder.ParamGroupBuilder.CreateChildOrGroup()
.ParamBuilder
.Contains("Address", "chengdu")
.EndsWith("Address", "lnk")
.Equal("Disabled", false)
.GreaterThan("Amout", 10)
.GreaterThanOrEqual("Price", 100)
.In("Drink", "mileshake,coffee")
.LessThan("Count", 10)
.LessThanOrEqual("Total", 100)
.StartsWith("Url", "Http://");
builder.OrderBy("Amout", ListSortDirection.Ascending)
.Select("Guest").Take(10).Skip(10);
var dynamicQuery = builder.Build();
HashObject,HashList
DynamicQuery-LinqExpression Converter.
public void ConfigureServices(IServiceCollection services)
{
services.AddSQLBuilder(opts =>
{
opts.UseMySQL();
});
}
var mappings = new SqlFieldMappings();
mappings.Map("Guest", "t1.Guest")
.Map("Address", "t1.Address")
.Map("Disabled", "t1.Disabled")
.Map("Amout", "t1.Amout")
.Map("Price", "t1.Price")
.Map("Drink", "t1.Drink")
.Map("Count", "t1.Count")
.Map("Total", "t1.Total");
// Native api also be supported
mappings.Add("Url", "t1.Url");
// `selectBuilder` should be injected from DI. Notice it's lifetime and create service scope any time if necessary.
selectBuilder.Mapping(mappings);
selectBuilder.Where(dynamicQuery.ParamGroup);
var whereClause = selectBuilder.BuildWhere();
var orderbyClause = selectBuilder.OrderBy(dynamicQuery.Order);
** In this case, value of whereClause
is :
((Extra.Guest = @PARAM_0)) AND (t1.Address like @PARAM_1 OR t1.Address like @PARAM_2 OR t1.Disabled = @PARAM_3 OR t1.Amout > @PARAM_4 OR t1.Price >= @PARAM_5 OR t1.Drink IN (mileshake,coffee) OR t1.Count < @PARAM_6 OR t1.Total <= @PARAM_7 OR t1.Url like @PARAM_8)
An encapsulation layer of Ado.NET.
An MySQL dialect implemention of SqlExecuter.