herbsjs / herbs2knex

Create repositories using Knex to retrieve and store Entities
Other
7 stars 13 forks source link

feat(custom-convention): add custom convention to repository #36

Closed maikmb closed 2 years ago

maikmb commented 2 years ago

Proposed Changes

  1. Include custom convention to read fields from database

Example

 const ItemRepository = new ItemRepository({
      entity: UserEntity,
      table,
      schema,
      ids: ['id'],
      knex: connection,
      convention: {
        toTableFieldName: field => toCamelCase(field)
      }
    })

Readiness Checklist

Author/Contributor

Reviewing Maintainer

codecov[bot] commented 2 years ago

Codecov Report

Merging #36 (40253b8) into master (3a638e1) will not change coverage. The diff coverage is 100.00%.

:exclamation: Current head 40253b8 differs from pull request most recent head 6744ef8. Consider uploading reports for the commit 6744ef8 to get more accurate results Impacted file tree graph

@@            Coverage Diff            @@
##            master       #36   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines          143       139    -4     
=========================================
- Hits           143       139    -4     
Impacted Files Coverage Δ
src/convention.js 100.00% <ø> (ø)
src/dataMapper.js 100.00% <100.00%> (ø)
src/repository.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update f16a26a...6744ef8. Read the comment docs.

maikmb commented 2 years ago

Hi @maikmb, could you please return back to the default lint/format of the project?

It's very hard do compare whats is new here.

Hi @jhomarolo, to simplify the PR I have separated the refactoring part of the test structure #37

jhomarolo commented 2 years ago

:tada: This PR is included in version 1.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: