Skip to content

Built in helper processing to make the API less awkward - #20

Open
PolBreachIty wants to merge 4 commits into
mainfrom
easier_api
Open

Built in helper processing to make the API less awkward#20
PolBreachIty wants to merge 4 commits into
mainfrom
easier_api

Conversation

@PolBreachIty

Copy link
Copy Markdown
Contributor

No description provided.

@PolBreachIty PolBreachIty changed the title wip: POC built in helper processing Built in helper processing to make the API less awkward Apr 6, 2022
@PolBreachIty
PolBreachIty requested a review from Copilot December 30, 2025 16:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread lib/casbinex/base.ex
end

def createEnforcer(_modelpath, _policypath) do
raise "NIF createEnforcerdd/2 not implemented"

Copilot AI Dec 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'createEnforcerdd' to 'createEnforcer'.

Suggested change
raise "NIF createEnforcerdd/2 not implemented"
raise "NIF createEnforcer/2 not implemented"

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants