{"id":21811188,"url":"https://github.com/mathieumack/linq2couchbaseliteexpression","last_synced_at":"2025-04-13T22:23:58.800Z","repository":{"id":39987971,"uuid":"260721214","full_name":"mathieumack/Linq2CouchBaseLiteExpression","owner":"mathieumack","description":"Linq extension to query couchbase lite repository (Linq to Expression)","archived":false,"fork":false,"pushed_at":"2023-09-19T19:58:10.000Z","size":46,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T12:46:49.498Z","etag":null,"topics":["couchbase-lite","linq"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mathieumack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-02T15:51:39.000Z","updated_at":"2022-07-04T21:10:49.000Z","dependencies_parsed_at":"2024-11-27T13:43:46.942Z","dependency_job_id":"a3c2ec84-dd8c-4c1a-a21b-4a87625da3f5","html_url":"https://github.com/mathieumack/Linq2CouchBaseLiteExpression","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieumack%2FLinq2CouchBaseLiteExpression","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieumack%2FLinq2CouchBaseLiteExpression/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieumack%2FLinq2CouchBaseLiteExpression/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mathieumack%2FLinq2CouchBaseLiteExpression/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mathieumack","download_url":"https://codeload.github.com/mathieumack/Linq2CouchBaseLiteExpression/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248789934,"owners_count":21161914,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["couchbase-lite","linq"],"created_at":"2024-11-27T13:43:41.632Z","updated_at":"2025-04-13T22:23:58.785Z","avatar_url":"https://github.com/mathieumack.png","language":"C#","funding_links":["https://www.buymeacoffee.com/mathieumack"],"categories":[],"sub_categories":[],"readme":"# Linq2CouchBaseLiteExpression\nLinq extension to query couchbase lite repository (Linq to Expression)\n\nWriten in .net standard 2.0\n\n# IC\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=github-Linq2CouchBaseLiteExpression\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=github-Linq2CouchBaseLiteExpression)\n[![Build status](https://dev.azure.com/mackmathieu/Github/_apis/build/status/Linq2CouchBaseLiteExpression)](https://dev.azure.com/mackmathieu/Github/_build/latest?definitionId=17)\n[![NuGet version](https://badge.fury.io/nu/Linq2CouchBaseLiteExpression.svg)](https://badge.fury.io/nu/Linq2CouchBaseLiteExpression)\n\n# How to :\n\nThe class Linq2CouchbaseLiteExpression contains a unique method named GenerateFromExpression that generate an couchbase lite IExpression.\n\nThis generic method works on objects that are class.\n\nFirst of all, install the plugin by the nuget package.\n\n## Example\n\n```csharp\n\n/// \u003csummary\u003e\n/// Entity object\n/// \u003c/summary\u003e\npublic class EntityObject\n{\n    public string Id { get; set; }\n\n    public string Name { get; set; }\n\n\tpublic int Value { get; set; }\n\t\n\tpublic bool IsHuman { get; set; }\n}\n\n```\n```csharp\n\n// Generate IExpression from a Lambda expression :\nvar resultFilter = Linq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e e.Name == \"test\");\n\n```\n\nThis call will generate a Couchbase lite expression like this :\n\n```csharp\n\n// Generate manually the IExpression :\nCouchbase.Lite.Query.Expression.Property(\"Name\").EqualTo(Couchbase.Lite.Query.Expression.String(\"test\"))\n\n```\n\n## Supported operations\nThese operations are now supported\n\nFunction | Example\n--- | ---\n\\\u003e |  \u003cpre lang=csharp\u003e (e) =\u003e e.Value \u003e 10\u003c/pre\u003e\n\\\u003c |  \u003cpre lang=csharp\u003e (e) =\u003e e.Value \u003c 10\u003c/pre\u003e\n\\\u003e= |  \u003cpre lang=csharp\u003e (e) =\u003e e.Value \u003e= 10\u003c/pre\u003e\n\\\u003e= |  \u003cpre lang=csharp\u003e (e) =\u003e e.Value \u003c= 10\u003c/pre\u003e\n== |  \u003cpre lang=csharp\u003e (e) =\u003e e.Name == \"test\"\u003c/pre\u003e\n!= |  \u003cpre lang=csharp\u003e (e) =\u003e e.Name != \"test\"\u003c/pre\u003e\n! |  \u003cpre lang=csharp\u003e (e) =\u003e !e.IsHuman\u003c/pre\u003e\n.Equals | \u003cpre lang=csharp\u003e (e) =\u003e e.Name.Equals(\"test\")\u003c/pre\u003e\nstring.IsNullOrEmpty | \u003cpre lang=csharp\u003e (e) =\u003e string.IsNullOrEmpty(e.Name)\u003c/pre\u003e\n\nYou can also combine conditions :\n\nFunction | Example\n--- | ---\n\\|\\| | \u003cpre lang=csharp\u003e (e) =\u003e e.Name == \"test\" \\|\\| e.Name == \"test 2\"\u003c/pre\u003e\n\\\u0026\\\u0026 | \u003cpre lang=csharp\u003e (e) =\u003e e.Value \u003e 10 \\\u0026\\\u0026 e.Name == \"test 2\"\u003c/pre\u003e\n\u003c/pre\u003e\n\n## Lambda expression writing\n\nThe expression must respect some specific rules :\n* You can set field object at left or at right of the operation :\n```csharp\n\n// Valid :\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e e.Name == \"test\");\n\n// Or :\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e \"test\" = e.Name );\n\n```\n\n* You can use call static method withtout parameters only :\n```csharp\n\n// Valid :\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e e.Name == CallToStaticMethod());\n\n// Invalid :\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e e.Name == CallToStaticMethod(\"Parameter\"));\n\n// Invalid :\nvar customObject = new CustomObject();\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e e.Name ==  customObject.NonPublicMethod());\n\n// Invalid :\nvar customObject = new CustomObject();\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e e.Name ==  customObject.NonPublicMethodWithParameters(\"test\"));\n\n```\n\n* Only the methods are now supported : .Equals() or string.IsNullOrEmpty()\n```csharp\n\n// Valid :\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e e.Name.Equals(\"test\"));\n\n// Valid :\nLinq2CouchbaseLiteExpression.GenerateFromExpression\u003cEntityObject\u003e((e) =\u003e string.IsNullOrEmpty(e.Name);\n\n```\n\n# Contribute\nYou want more ? Feel free to create an issue or contribute by adding new functionnalities by forking the project and create a pull request.\n\nAnd if you like this project, don't forget to star it !\n\nYou can also support me with a coffee :\n\n[![\"Buy Me A Coffee\"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/mathieumack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieumack%2Flinq2couchbaseliteexpression","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmathieumack%2Flinq2couchbaseliteexpression","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmathieumack%2Flinq2couchbaseliteexpression/lists"}