Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#33: Make execution of function without verification easier #34

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,23 @@ sealed abstract class DBFunction private(functionName: String,
}

/**
* Executes the function.
* Executes the function without caring about the result. The goal is the side-effect of the function.
* @param connection - the database connection
*/
def execute()(implicit connection: DBConnection): Unit = {
def perform()(implicit connection: DBConnection): Unit = {
execute("")(_ => ())
}

/**
* Executes the function without any verification proceudre. It instantiate the function result(s) and return them in
benedeki marked this conversation as resolved.
Show resolved Hide resolved
* a list.
* @param orderBy - the clause how to order the function result, if empty, default ordering is preserved
* @param connection - the database connection
*/
def getResult(orderBy: String = "")(implicit connection: DBConnection): List[QueryResultRow] = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

TIny

The orderBy 'API' is different in this function and in the execute function. That I find a little bit confusing from users' point of view. Perhaps as they are sharing similar ideas should have similar APIs.

So I would consider making it default also in def execute[R](orderBy: String) (such change is backward compatible and also doesn't overwhelm the user thus probably more preferred variant).

Copy link
Collaborator

@lsulak lsulak Oct 1, 2024

Choose a reason for hiding this comment

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

Also I would document / provide an example of orderBy content, because it's not the full clause (ORDER BY is already provided on line 88)

execute("")(_.toList)
benedeki marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* Executes the function and verifies the result via the verify function.
*
Expand Down
Loading