nuget.org : dbcrud.elasticsearch
简单的ElasticSearch增删改查 简写查询 【日期范围查询】。 var date_result = testdb.GetPagingDataAndResult<Dictionary<string, object>>(dictable, "DDATE>='2023-06-05 09:12:24' AND DDATE<='2023-06-05 13:28:48'", sort: "!DDATE", pageindex: 1, pagecount: 10); 【组合查询查询】。 var date_result = testdb.GetPagingDataAndResult<Dictionary<string, object>>(dictable, "DDATE>='2023-06-05 09:12:24' AND DDATE<='2023-06-05 13:28:48' AND id>2", sort: "!DDATE", pageindex: 1, pagecount: 10); 【SQL语法,查找开头】,查找name中'Mongodbi'开头的数据,条件不区分大小写,字段名称区分大小写 var like_result = testdb.FindAndResult<Dictionary<string, object>>(autoIDData, "Name like'Mongodb%'"); 【SQL语法,查找结尾】,查找name中'crud'开头的数据,条件不区分大小写,字段名称区分大小写 var like_result1 = testdb.FindAndResult<Dictionary<string, object>>(autoIDData, "Name like'%crud'"); 【SQL语法,包含】,查找name中包含'odb'的数据,条件不区分大小写,字段名称区分大小写 var like_result2 = testdb.FindAndResult<Dictionary<string, object>>(autoIDData, "Name like'%odb%'"); 【MongoDB原生语法】,查找name中'Mongodbi'开头的数据,不区分大小写 var bsonwheredata = testdb.Find<Dictionary<string, object>>(autoIDData, "{Name:/^Mongodb/i}"); 【in模糊查询】查找Name=Batch insert和data结尾的数据。 var in_fuzzy = testdb.GetPagingDataAndResult<Dictionary<string, object>>(dictable, "Name in('Batch insert','Úta')", sort: "!DDATE", pageindex: 1, pagecount: 10); 【正则表达式查询】查找Name=Batch开头的数据。 var in_regex = testdb.GetPagingDataAndResult<Dictionary<string, object>>(dictable, "Name reg'^Batch'", sort: "!DDATE", pageindex: 1, pagecount: 10);s 【sql语句查询】查找_id=1的数据 string sqlcmd = $"select _id,Name,DDATE from {dictable} where _id=1"; var sqldata = testdb.Find<Dictionary<string, object>>(sqlcmd); 【Linq查询】 var link_where = testdb.FindAndResult<CrudTestModel>(tb_custormer, q=>q.ID>6 && q.ID<=10 && q.Name.Contains("obje")); Key-Value操作,常用于配置信息 string key = "test"; var v = DateTime.Now; //保存 var result = testdb.SaveKeyValue(key, v); //判断是否存在 bool isExists= testdb.KeyValueExists(key) //获取 var getv = testdb.GetKeyValue<DateTime>(key); //删除 bool ok= testdb.DelKeyValue(key)
Registry
- Homepage
- JSON
purl: pkg:nuget/dbcrud.elasticsearch
Keywords:
DB
, CRUD
, NOSQL
, MongoDB
, .NET
, C#
License: Apache-2.0
Latest release: about 1 month ago
First release: almost 2 years ago
Downloads: 1,418 total
Last synced: 12 days ago