Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where条件,目前只支持单一的term匹配 #9

Open
steden opened this issue Sep 27, 2022 · 0 comments
Open

where条件,目前只支持单一的term匹配 #9

steden opened this issue Sep 27, 2022 · 0 comments
Assignees

Comments

@steden
Copy link
Member

steden commented Sep 27, 2022

term只支持对keywords、数字类型的 == 条件。
参考.net的实现

  var time = "30";
  // Judgment time (with complex local function methods)
  TestContext.Data.User.Where(o => o.CreateAt >= DateTime.Now.AddMinutes(-time.ConvertType(0)).ToTimestamps()).ToList();
  // NETS native conditionals and self-resolving conditionals
  TestContext.Data.User
             .Where(q => q.Term(t => t.Age, 33))
             .Where(o => o.UserName.Contains("ste")).ToList();
  // Fuzzy Search and Positive Order Sorting
  TestContext.Data.User.Where(o => o.Desc.Contains("hello")).Asc(o => o.Age).ToList();
  // Prefix search and reverse sorting
  TestContext.Data.User.Where(o => o.Desc.StartsWith("hello")).Desc(o => o.Age).ToList();
  // Suffix search (only Keyword type is supported)
  TestContext.Data.User.Where(o => o.UserName.EndsWith("en")).ToList();
  // Not equal to a value
  TestContext.Data.User.Where(o => o.UserName != "aaa").ToList();
  // and operation, if two Where methods are called, is also equivalent to using and
  TestContext.Data.User.Where(o => o.UserName == "steden" && o.Age == 18).ToList();
  // or operation
  TestContext.Data.User.Where(o => o.UserName == "steden" || o.Age >= 10).ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants