Skip to content

Commit

Permalink
Merge pull request #1 from codibre/param-options
Browse files Browse the repository at this point in the history
feat: creating params support
  • Loading branch information
Farenheith authored Oct 14, 2024
2 parents 437bb2f + 9c4b040 commit 2d5a06b
Show file tree
Hide file tree
Showing 53 changed files with 1,087 additions and 798 deletions.
14 changes: 4 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ csharp_style_var_elsewhere = true
# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_accessors = true
Expand Down Expand Up @@ -148,7 +148,7 @@ csharp_preserve_single_line_statements = true
csharp_preserve_single_line_blocks = true
csharp_using_directive_placement = outside_namespace:silent
csharp_prefer_simple_using_statement = true
csharp_style_namespace_declarations = file_scoped:error
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true
csharp_style_prefer_top_level_statements = true
csharp_style_expression_bodied_lambdas = true
Expand Down Expand Up @@ -176,13 +176,7 @@ dotnet_diagnostic.IDE0051.severity = error
#IDE0051: unused private methods, fields, properties, and events (entire category of rules)
dotnet_analyzer_diagnostic.category-CodeQuality.severity = error

# IDE0160: Convert to block scoped namespace
dotnet_diagnostic.IDE0160.severity = none
# IDE0161: Convert to file scoped namespace
dotnet_diagnostic.IDE0161.severity = error

# IDE0023: Use block body for conversion operator
dotnet_diagnostic.IDE0023.severity = none

# IDE0058: Expression value is never used
dotnet_diagnostic.IDE0058.severity = none

dotnet_diagnostic.IDE0005.severity = none
3 changes: 2 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: publish

on:
workflow_dispatch:
push:
tags:
- 'v*'
workflow_dispatch:

jobs:
publish:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,24 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Prepare Node
uses: actions/setup-node@v4
with:
node-version: "lts/*"

- name: Install dependencies
run: npm ci

- name: Prepare Db
run: npm run prepare-test-db

- name: Test
uses: paambaati/codeclimate-action@v2.6.0
uses: paambaati/codeclimate-action@v9.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageCommand: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./coverage/lcov.info
coverageLocations: ${{github.workspace}}/test/Codibre.MSSqlSession.Test/coverage/lcov.info:lcov
coverageLocations: ${{github.workspace}}/test/Codibre.GrpcSqlProxy.Test/coverage/lcov.info:lcov

- name: Unload Db
run: npm run unload-test-db
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
npx lint-staged
npm test
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"*.cs": "npm run lint:fix"
}
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,18 @@ While using the same channel, every command you'll be sent the same connection,

The details for each connection are sent by the application client, so, if you have two applications with the exact same connection string, the chances are that they'll share the same connection pools.

Sql parameters are not supported yet but it's feasible to do so in the near future.
You can also pass parameters, and it's possible to change compression or packetSize options for a single request, as showed below:
```c#
var result = await channel.QueryFirstOrDefault<TB_PRODUTO>("SELECT * FROM MyTable WHERE id = @Id", new()
{
Params = new
{
Id = 1
},
PacketSize = 10,
Compress = false
});
```

The result sets returned by the method **Query** are IAsyncEnumerable instances because the packets returned are processed on demand. This is done to keep the memory usage of the proxy controlled. For now, the methods available to execute sql commands are:

Expand Down
2 changes: 1 addition & 1 deletion node_modules/.modules.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2d5a06b

Please sign in to comment.