SV.Db.Sloth
                              
                            
                                0.0.2.4
                            
                        
                    See the version list below for details.
dotnet add package SV.Db.Sloth --version 0.0.2.4
NuGet\Install-Package SV.Db.Sloth -Version 0.0.2.4
<PackageReference Include="SV.Db.Sloth" Version="0.0.2.4" />
<PackageVersion Include="SV.Db.Sloth" Version="0.0.2.4" />
<PackageReference Include="SV.Db.Sloth" />
paket add SV.Db.Sloth --version 0.0.2.4
#r "nuget: SV.Db.Sloth, 0.0.2.4"
#:package SV.Db.Sloth@0.0.2.4
#addin nuget:?package=SV.Db.Sloth&version=0.0.2.4
#tool nuget:?package=SV.Db.Sloth&version=0.0.2.4
sv.db
slothful vic try make db code be sloth flash, because vic lazy, so it can not be fastest, but maybe like flash
What can sv.db do
1. db to entity
Like DapperAOT, use Source Generators generating the necessary code during build to help you use sql more easy.
And Theoretically, you also can do Native AOT deployment
Code exmples:
public async Task<object> OldWay()
{
    var a = factory.GetConnection(StaticInfo.Demo);
    using var dd = await a.ExecuteReaderAsync("""
SELECT count(1)
FROM Weather;
SELECT *
FROM Weather;
""");
    var t = await dd.QueryFirstOrDefaultAsync<int>();
    var r = await dd.QueryAsync<string>().ToListAsync();
    return new { TotalCount = t, Rows = r };
}
2. make select more easy and more complex condition
With define some simple rules for select, we can convert select to db / api / es ....
Theoretically, we can do like:
http query string / body  |------>  select statement    |------>  db (sqlite / mysql/ sqlserver / PostgreSQL)
Expression code           |------>                      |------>  es
                                                        |------>  mongodb
                                                        |------>  more .....
So we can use less code to do some simple select
2.1 complex condition and page for api
Code exmples:
[HttpGet]
public async Task<object> Selects()
{
    return await this.QueryByParamsAsync<Weather>();
}
[Db("Demo")]
[Table(nameof(Weather))]
public class Weather
{
    [Select]
    public string Name { get; set; }
    [Select(Field = "Value")]
    public string V { get; set; }
}
You can use such query string to query api
curl --location 'http://localhost:5259/weather?where=not (name like '%e%')&TotalCount=true'
Response
{
    "totalCount": 1,
    "rows": [
        {
            "name": "H",
            "v": "mery!"
        }
    ]
}
2.2 complex condition and page for Expression code
Code exmples:
You can use such code to query Weather which name no Contains 'e'
[HttpGet("expr")]
public async Task<object> DoSelects()
{
    return await factory.From<Weather>().Where(i => !i.Name.Like("e")).WithTotalCount().ExecuteQueryAsync<dynamic>();
}
[Db("Demo")]
[Table(nameof(Weather))]
public class Weather
{
    [Select]
    public string Name { get; set; }
    [Select(Field = "Value as v")]
    public string V { get; set; }
}
Doc
Query in api
Both has func support use query string or body to query
body or query string will map to Dictionary<string, string> to handle
operater
such filter operater just make api more restful (Where=urlencode(complex condition) will be more better)
{{nl}}is null- query string 
?name={{nl}} - body 
{"name":"{{nl}}"} 
- query string 
 {{eq}}Equal =- query string 
?name=xxx - body 
{"name":"xxx"} 
- query string 
 {{lt}}LessThan or Equal ⇐- query string 
?age={{lt}}30 - body 
{"age":"{{lt}}30"} 
- query string 
 {{le}}LessThan <- query string 
?age={{le}}30 - body 
{"age":"{{le}}30"} 
- query string 
 {{gt}}GreaterThan or Equal >=- query string 
?age={{gt}}30 - body 
{"age":"{{gt}}30"} 
- query string 
 {{gr}}GreaterThan >- query string 
?age={{gr}}30 - body 
{"age":"{{gr}}30"} 
- query string 
 {{nq}}Not Equal !=- query string 
?age={{nq}}30 - body 
{"age":"{{nq}}30"} 
- query string 
 {{lk}}Prefix Like 'e%'- query string 
?name={{lk}}e - body 
{"name":"{{lk}}e"} 
- query string 
 {{rk}}Suffix Like '%e'- query string 
?name={{rk}}e - body 
{"name":"{{rk}}e"} 
- query string 
 {{kk}}Like '%e%'- query string 
?name={{kk}}e - body 
{"name":"{{kk}}e"} 
- query string 
 {{in}}in array (bool/number/string)- query string 
?name={{in}}[true,false] - body 
{"name":"{{in}}[\"s\",\"sky\"]"} 
- query string 
 {{no}}not- query string 
?age={{no}}{{lt}}30 - body 
{"age":"{{no}}{{lt}}30"} 
- query string 
 
Func Fields:
Fieldsreturn some Fields , no Fields orFields=*is return all- query string 
?Fields=name,age,json(data,'$.age') - body 
{"Fields":"name,age,json(data,'$.age')"} 
- query string 
 TotalCountreturn total count- query string 
?TotalCount=true - body 
{"TotalCount":"true"} 
- query string 
 NoRowsno return rows- query string 
?NoRows=true - body 
{"NoRows":"true"} 
- query string 
 OffsetOffset Rows index- query string 
?Offset=10 - body 
{"Offset":10} 
- query string 
 RowsTake Rows count, default is 10- query string 
?Rows=100 - body 
{"Rows":100} 
- query string 
 OrderBysort result- query string 
?OrderBy=name asc,age desc,json(data,'$.age') desc - body 
{"OrderBy":"name asc,age desc,json(data,'$.age') desc"} 
- query string 
 Wherecomplex condition filter- query string 
?Where=urlencode( not(name like 'H%') or name like '%v%' ) - body 
{"Where":"not(name like 'H%') or name like '%v%'"} - operaters
- bool
- example  
trueorfalse 
 - example  
 - number
- example  
12323or1.324or-44.4 
 - example  
 - string
- example  
'sdsdfa'or'sds\'dfa'or"dsdsdsd"or"fs\"dsf" 
 - example  
 = nullis null- example 
name = null 
- example 
 != nullis not null- example 
name != null 
- example 
 =Equal- example 
name = 'sky' 
- example 
 <=LessThan or Equal- example 
age <= 30 
- example 
 <LessThan- example 
age < 30 
- example 
 >=GreaterThan or Equal- example 
age >= 30 
- example 
 >GreaterThan- example 
age > 30 
- example 
 !=Not Equal- example 
age != 30 
- example 
 like 'e%'Prefix Like- example 
name like 'xx%' 
- example 
 like '%e'Suffix Like- example 
name like '%xx' 
- example 
 like '%e%'Like- example 
name like '%xx%' 
- example 
 in ()in array (bool/number/string)- example 
in (1,2,3)orin ('sdsdfa','sdfa')orin (true,false) 
- example 
 not- example 
not( age <= 30 ) 
- example 
 and- example 
age <= 30 and age > 60 
- example 
 or- example 
age <= 30 or age > 60 
- example 
 ()- example 
(age <= 30 or age > 60) and name = 'killer' 
- example 
 
 - bool
 - support json
- example 
json(data,'$.age') > 60 
 - example 
 
- query string 
 
| Product | Versions Compatible and additional computed target framework versions. | 
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. | 
- 
                                                    
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
 - Microsoft.Extensions.Primitives (>= 8.0.0)
 - SV.Db (>= 0.0.2.4)
 - System.Text.Json (>= 8.0.5)
 
 
NuGet packages (7)
Showing the top 5 NuGet packages that depend on SV.Db.Sloth:
| Package | Downloads | 
|---|---|
| 
                                                        
                                                            SV.Db.Sloth.Swagger
                                                        
                                                         Package Description  | 
                                                    |
| 
                                                        
                                                            SV.Db.Sloth.WebApi
                                                        
                                                         Package Description  | 
                                                    |
| 
                                                        
                                                            SV.Db.Sloth.SQLite
                                                        
                                                         Package Description  | 
                                                    |
| 
                                                        
                                                            SV.Db.Sloth.PostgreSQL
                                                        
                                                         Package Description  | 
                                                    |
| 
                                                        
                                                            SV.Db.Sloth.MySql
                                                        
                                                         Package Description  | 
                                                    
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated | 
|---|---|---|
| 0.0.2.21 | 308 | 9/3/2025 | 
| 0.0.2.20 | 419 | 6/13/2025 | 
| 0.0.2.19 | 198 | 6/7/2025 | 
| 0.0.2.18 | 268 | 6/3/2025 | 
| 0.0.2.17 | 292 | 4/1/2025 | 
| 0.0.2.16 | 263 | 12/13/2024 | 
| 0.0.2.15 | 237 | 11/27/2024 | 
| 0.0.2.14 | 231 | 11/26/2024 | 
| 0.0.2.13 | 236 | 11/7/2024 | 
| 0.0.2.12 | 235 | 10/31/2024 | 
| 0.0.2.11 | 242 | 10/24/2024 | 
| 0.0.2.10 | 254 | 10/19/2024 | 
| 0.0.2.9 | 223 | 10/17/2024 | 
| 0.0.2.8 | 224 | 10/16/2024 | 
| 0.0.2.7 | 219 | 10/16/2024 | 
| 0.0.2.6 | 243 | 10/16/2024 | 
| 0.0.2.5 | 221 | 10/16/2024 | 
| 0.0.2.4 | 225 | 10/14/2024 | 
| 0.0.2.3 | 216 | 10/12/2024 | 
| 0.0.2.2 | 226 | 10/12/2024 | 
| 0.0.2.1 | 233 | 10/12/2024 | 
| 0.0.2.1-beta | 220 | 10/12/2024 | 
| 0.0.2-beta | 232 | 10/10/2024 | 
| 0.0.1-beta | 176 | 10/10/2024 |