Built in helper processing to make the API less awkward - #20
Open
PolBreachIty wants to merge 4 commits into
Open
Built in helper processing to make the API less awkward#20PolBreachIty wants to merge 4 commits into
PolBreachIty wants to merge 4 commits into
Conversation
joshdmix
approved these changes
Apr 8, 2022
There was a problem hiding this comment.
Pull request overview
This PR refactors the Casbinex API to improve usability by standardizing input/output handling. The key changes include migrating from Erlang charlists to Elixir binary strings, wrapping NIF return values in result tuples, and introducing helper functions to handle both list and single-value inputs.
Key Changes:
- Migrated all string handling from charlists to binary strings throughout the codebase
- Wrapped NIF functions that return lists in
{:ok, result}tuples for consistency - Added overloaded helper functions to accept both lists and single values for filter operations
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/casbinex_test.exs | Updated all test cases to use binary strings instead of charlists and adjusted assertions to match new result tuple format |
| lib/casbinex/base.ex | New module containing NIF stub definitions that raise when not properly loaded |
| lib/casbinex.ex | Refactored to delegate to Base module and added helper functions for flexible input handling |
| config/test.exs | Updated configuration values from charlists to binary strings |
| c_src/casbin_nif.cpp | Implemented BinToString function, modified string conversion to use binaries, wrapped list returns in result tuples, and fixed error messages |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| end | ||
|
|
||
| def createEnforcer(_modelpath, _policypath) do | ||
| raise "NIF createEnforcerdd/2 not implemented" |
There was a problem hiding this comment.
Corrected spelling of 'createEnforcerdd' to 'createEnforcer'.
Suggested change
| raise "NIF createEnforcerdd/2 not implemented" | |
| raise "NIF createEnforcer/2 not implemented" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.