new Expression(expr)
SQL operator/function wrapper
- when expr is string, this string will be put in SQL honestly
- when expr is function, it will be call with two arguments: agent(dialect implementation), values(sql query params list), and expect a legal SQL statement to be returned, along with values list is added if needed
Parameters:
Name | Type | Description |
---|---|---|
expr |
string | function |
- Source:
Methods
and(value) → {Expression}
Append a mathematical & operation
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
- Source:
Returns:
- Type
- Expression
concate(value) → {Expression}
String concatenation
Parameters:
Name | Type | Description |
---|---|---|
value |
Expression | string |
- Source:
Returns:
- Type
- Expression
divide(value) → {Expression}
Append a mathematical / operation
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
- Source:
Returns:
- Type
- Expression
evaluate() → {string}
Return formatted SQL clause, and push params to values list
- Source:
Returns:
SQL statment
- Type
- string
module(value) → {Expression}
Append a mathematical % operation
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
- Source:
Returns:
- Type
- Expression
multiply(value) → {Expression}
Append a mathematical * operation
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
- Source:
Returns:
- Type
- Expression
or(value) → {Expression}
Append a mathematical | operation
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
- Source:
Returns:
- Type
- Expression
plus(value) → {Expression}
Append a mathematical + operation
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
- Source:
Returns:
- Type
- Expression
subtract(value) → {Expression}
Append a mathematical - operation
Parameters:
Name | Type | Description |
---|---|---|
value |
any |
- Source:
Returns:
- Type
- Expression