-
Notifications
You must be signed in to change notification settings - Fork 44
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
Added missing docs. #37
base: master
Are you sure you want to change the base?
Conversation
matcracker
commented
Jun 19, 2020
- Documented nullable variable declaration.
- Documented timestamp var type
- Documented list var type
- Documented nullable variable declaration. - Documented timestamp var type - Documented list var type
Declare if the variable can accepts `null` values. It is only allowed inside a query declaration. | ||
|
||
#### Symbol | ||
- `?` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong place. This section is for the statement types, i.e. the symbol immediately following -- #
. ?
is a modifier to the argument type, not a statement type.
@@ -178,6 +184,8 @@ The variable type. Possible values: | |||
- `int` | |||
- `float` | |||
- `bool` | |||
- `timestamp` | |||
- `list` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
list
is not a type. list:{type}
is a modifier on other types. You would probably want to change this to list:{type}
instead of list
.
```sql | ||
-- #{ group.name | ||
-- # :var_name1 list:int | ||
-- # :var_name2 list?float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does list?
mean? Please explain it better.
- `NOW` | ||
|
||
###### `list` | ||
An array of values whose type must be specified in the same way as the variable declaration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this allowed? Just reading the documentation, I would expect this to be usable in INSERT INTO tbl (a, b) VALUES (:a, :b)
where a
and b
are lists. But in fact this is only allowed in the IN
context.
Furthermore, should it be used as WHERE col IN :list
or WHERE col IN (:list)
? Please clarify.
###### `timestamp` default | ||
A numeric value that can be parsed by [`(int)` cast, equivalent to `intval`](https://php.net/intval) or [`(float)` cast, equivalent to `floatval`](https://php.net/floatval) | ||
|
||
**Allowed default values:** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -198,6 +206,26 @@ A numeric value that can be parsed by [`(float)` cast, equivalent to `floatval`] | |||
###### `bool` default | |||
`true`, `on`, `yes` or `1` will result in true. Other values, as long as there is something, will result default false. (If there is nothing, the variable will not be optional) | |||
|
|||
###### `timestamp` default | |||
A numeric value that can be parsed by [`(int)` cast, equivalent to `intval`](https://php.net/intval) or [`(float)` cast, equivalent to `floatval`](https://php.net/floatval) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider restructuring this section entirely. This section is supposed to describe default values, not to describe the types. Since description of the type is required, consider restructuring the section such that each type has its documentation and VAR_DEFAULT
doesn't have its own place.